Thanks,
dChan
Code: Select all
System.usbDiskModeActivate ()
white = Color.new (255,255,255)
black = Color.new (0,0,0)
red = Color.new (255,0,0)
lime = Color.new (128,255,0)
fontcherl = Font.load ("cherl.ttf")
fontcherl:setPixelSizes (72,72)
fontcherl2 = Font.load ("cherl.ttf")
fontcherl2:setPixelSizes (28,28)
fontcheri = Font.load ("CHERI.ttf")
fontcheri:setPixelSizes (36,36)
fonttrashco = Font.load ("trashco.ttf")
fonttrashco:setPixelSizes (48,48)
category = {}
category[1] = {c = "One-Handed Solve"}
category[2] = {c = "Speed Solve"}
category[3] = {c = "Blindfolded Solve"}
categorynumber = 2
categoryrecord = "ss"
counter = Timer.new ()
counter:stop ()
background = Image.createEmpty (480,272)
background:clear (white)
function timerControls ()
if categorynumber == 1 then
categoryrecord = "oh"
end
if categorynumber == 2 then
categoryrecord = "ss"
end
if categorynumber == 3 then
categoryrecord = "bld"
end
if counter:time () > 600000 then
counter:reset (0)
end
if pad:cross () then
counter:stop ()
end
if pad:square () then
counter:stop ()
counter:reset (0)
end
if pad:triangle () then
file = io.open ("record"..categoryrecord..".txt","w")
file:write (currentTime)
file:close ()
end
if pad:r () and categorynumber < 3 then
categorynumber = categorynumber + 1
end
if pad:l () and categorynumber > 1 then
categorynumber = categorynumber - 1
end
if pad:r () and pad:l () and counter:stop () then
counter:reset (0)
counter:start ()
end
end
while true do
screen:clear ()
screen:blit (0,0,background)
currentTime = counter:time () / 1000
file = io.open ("record"..categoryrecord..".txt","r")
record = file:read ("*n")
file:close ()
screen:fontPrint (fonttrashco,140,50,"cWatch",lime)
screen:fontPrint (fontcherl2,140,80,category[categorynumber].c,black)
screen:fontPrint (fontcherl,140,136,currentTime,black)
screen:fontPrint (fontcherl2,60,200,"Personal Record:",black)
screen:fontPrint (fontcheri,300,200,record,black)
pad = Controls.read ()
timerControls ()
screen.waitVblankStart ()
screen.flip ()
if pad:start () then
break
end
end