-- Variabelen
white = Color.new(210,210,210)
red = Color.new(180,30,30)
blue = Color.new(20,20,150)
green = Color.new(0,130,0)
bild = Image.load("bgold.png")
counter = Timer.new()
-- Variablen/Schriftarten
stoppedtime = Font.load("arialsmall.ttf")
stoppedtime:setPixelSizes(15,14)
font = Font.load("bankgoth.ttf")
font:setPixelSizes(13,15)
fontarial = Font.load("arial.ttf")
fontarial:setPixelSizes(25,30)
fontbig = Font.createProportional()
fontbig:setPixelSizes(0, 30)
arialsmall = Font.load("arialsmall.ttf")
arialsmall:setPixelSizes(13,12)
fontarialkomma = Font.load("arial.ttf")
fontarialkomma:setPixelSizes(23,27)
runtime = counter:time()
pad = Controls.read()
-- funkitonen
while true do --Mainloop
pad = Controls.read()
runtime = counter:time()
screen:clear()
screen:blit(0,0,bild)
if pad:triangle() then
datei = io.open("score.txt","w")
datei:write("Letzte gespeicherte Zeit: " .. runtime)
datei:close()
end
if runtime > 1 then
txt = io.open("score.txt","r")
inhalt = txt:read(50)
screen:fontPrint(fontarialkomma,50,200,inhalt,green)
txt:close()
end
if pad:select() then
dofile("script.lua")
end
if pad:cross() then
counter:start()
end
if pad:circle() then
counter:stop()
end
if pad:square() then
counter:reset(0)
end
-- Mainloop/Kommasetzung
if runtime > 1 and runtime < 10000 then
screen:fontPrint(fontarialkomma,180,136,",",white)
end
if runtime > 10000 and runtime < 100000 then
screen:fontPrint(fontarialkomma,194,136,",",white)
end
if runtime > 100000 and runtime < 1000000 then
screen:fontPrint(fontarialkomma,208,136,",",white)
end
if runtime > 1000000 and runtime < 10000000 then
screen:fontPrint(fontarialkomma,222,136,",",white)
end
if runtime > 10000000 and runtime < 100000000 then
screen:fontPrint(fontarialkomma,236,136,",",white)
end
if runtime > 100000000 and runtime < 1000000000 then
screen:fontPrint(fontarialkomma,250,136,",",white)
end
if runtime > 1000000000 and runtime < 10000000000 then
screen:fontPrint(fontarialkomma,264,136,",",white)
end
-- Mainloop/front
screen:fontPrint(fontarial, 15, 136,"Aktuelle Zeit: " .. runtime,white)
screen:fontPrint(arialsmall,1,10,"X = Startet den Timer",blue)
screen:fontPrint(arialsmall,1,23,"O = Stopt den Timer",blue)
screen:fontPrint(arialsmall,1,36,"[] = Setzt den Timer auf null",blue)
screen:fontPrint(arialsmall,1,49,"/\\ = Zeit zwischenspeichern",blue)
screen:fontPrint(arialsmall,1,62,"select = Zum Auswahlbildschirm",blue)
screen:fontPrint(font,1,269," version 0.01 Homebrew made by Manu",red)
-- Mainloop/end
screen.waitVblankStart()
screen.flip()
end