Experimental clean up.
This commit is contained in:
parent
5b49940c51
commit
2fd822b195
12
demo.lua
12
demo.lua
|
@ -14,12 +14,11 @@ pallet = {} --will store colors
|
|||
pallet_last = 0
|
||||
mem_pallet_last = 0
|
||||
|
||||
file:write([[from draw import *
|
||||
file:write([[from draw import draw, fancy_text
|
||||
black=(0,0,0)
|
||||
for x in range(384):
|
||||
for y in range(192):
|
||||
S(x,y,black)
|
||||
while 1:
|
||||
set_pixel(x,y,black)
|
||||
]])
|
||||
|
||||
for i = 1, 12, 1 do
|
||||
|
@ -34,7 +33,7 @@ for i = 1, 12, 1 do
|
|||
end
|
||||
local getpixel, setpixel = bitmap.pixel_interface(image_bitmap)
|
||||
|
||||
file:write("\n ", [[data=b"]])
|
||||
file:write("\n", [[data=b"]])
|
||||
--end
|
||||
|
||||
for j = 1, image_infos.height, 1 do
|
||||
|
@ -52,18 +51,19 @@ for i = 1, 12, 1 do
|
|||
--let's write the pallet
|
||||
if pallet_last > mem_pallet_last then
|
||||
mem_pallet_last = pallet_last
|
||||
file:write("\n pallet={")
|
||||
file:write("\npallet={")
|
||||
for i, v in pairs(pallet) do
|
||||
file:write(v, ":(", i, "),")
|
||||
end
|
||||
file:write("}")
|
||||
end
|
||||
|
||||
file:write("\n draw(", math.floor(192 - image_infos.width / 2), ",")
|
||||
file:write("\ndraw(", math.floor(192 - image_infos.width / 2), ",")
|
||||
file:write(math.floor(96 - image_infos.height / 2), ",data,pallet,")
|
||||
file:write(image_infos.width, ")")
|
||||
|
||||
first = false
|
||||
end
|
||||
file:write('wait_ac("Press AC/ON to continue...")')
|
||||
|
||||
file:close()
|
||||
|
|
22
draw.py
22
draw.py
|
@ -1,13 +1,27 @@
|
|||
from casioplot import set_pixel as S
|
||||
from casioplot import show_screen as R
|
||||
from casioplot import *
|
||||
|
||||
def draw(x, y, data, pallet, width):
|
||||
sx = x
|
||||
width += sx
|
||||
for v in data:
|
||||
S(x, y, pallet[v])
|
||||
set_pixel(x, y, pallet[v])
|
||||
x += 1
|
||||
if x == width:
|
||||
x = sx
|
||||
y += 1
|
||||
R()
|
||||
show_screen()
|
||||
|
||||
def fancy_text(x, y, text):
|
||||
draw_string(x, y, text)
|
||||
draw_string(x+2, y, text)
|
||||
draw_string(x, y+2, text)
|
||||
draw_string(x+2, y+2, text)
|
||||
draw_string(x+1, y+1, text, (255, 255, 255))
|
||||
|
||||
def wait_ac(text):
|
||||
fancy_text(0, 0, text)
|
||||
try:
|
||||
while 1:
|
||||
show_screen()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
menu.py
4
menu.py
|
@ -1,4 +1,4 @@
|
|||
from casioplot import *
|
||||
from draw import *
|
||||
|
||||
choices = ("imagination", "tron", "image_clef_usb", "exit")
|
||||
selection = 0
|
||||
|
@ -9,7 +9,7 @@ try:
|
|||
try:
|
||||
while 1:
|
||||
clear_screen()
|
||||
draw_string(0, 0, choices[selection].upper().replace("_", " "))
|
||||
fancy_text(0, 0, choices[selection].upper().replace("_", " "))
|
||||
show_screen()
|
||||
cursor += 1
|
||||
if cursor == 64:
|
||||
|
|
11
tron.py
11
tron.py
|
@ -1,4 +1,4 @@
|
|||
from casioplot import *
|
||||
from draw import *
|
||||
from math import floor
|
||||
|
||||
C_BLACK = (0, 0, 0)
|
||||
|
@ -34,3 +34,12 @@ while play:
|
|||
for i in range(100): show_screen()
|
||||
except KeyboardInterrupt:
|
||||
xspd, yspd = yspd, -xspd
|
||||
|
||||
loop = True
|
||||
while 1:
|
||||
try:
|
||||
fancy_text(0, 0, "GAME OVER, press AC/ON to continue.")
|
||||
while 1:
|
||||
show_screen()
|
||||
except:
|
||||
loop = False
|
||||
|
|
Loading…
Reference in New Issue