--Bilder und farben laden
Bildname = Image.load("background.jpg")
white = Color.new(255,255,255)
black = Color.new(0,0,0)
red = Color.new(255, 0, 0)
green = Color.new(0, 255, 0)
blue = Color.new(0,0,255)
light_blue = Color.new(0,180,255)
orange = Color.new(235,115,0)
yellow = Color.new(255,255,0)
gray = Color.new(160,160,160)
--hier werden die menüpunkte "kreiert"
--hier das was man auf dem Bildschirm sieht
punkte={}
punkte[1]="Lua menue TuT"
punkte[2]=":)"
punkte[3]="beenden"
--und hier was beim x drücken passiert
f={}
f[1]=function ()
end
f[2]=function ()
end
f[3]=function ()
System.Quit()
end
--hier noch ein paar letzte sachen die das programm braucht
current = 1
farbe={}
ypos=15
oldpad=Controls.read()
while true do
pause=0
pad =Controls.read()
screen:clear()
screen:blit(0,0,Bildname)
if pad:up() then
if current>1 then
current=current-1
pause=6
end
if ypos<30-(current*15) then
ypos=30-15*current
end
end
if pad:analogY()<-30 then
if current>1 then
current=current-1
pause=pad:analogX()/128
end
if ypos<30-(current*15) then
ypos=30-15*current
end
end
if pad:down() then
if current<table.getn(punkte) then
current=current+1
pause=6
end
if ypos>240-(current*15) then
ypos=0-(15*(current-17))
end
end
if pad:analogY()>30 then
if current<table.getn(punkte) then
current=current+1
pause=(pad:analogY()/127)*(-1)
end
if ypos>240-(current*15) then
ypos=0-(15*(current-17))
end
end
if current > table.getn(punkte) then
current = 1
else if current<1 then
current=table.getn(punkte)
end
--Hier werden die schriftfarben jeder einzelnen zeile definiert
counterfarbe=0
while counterfarbe<current do
counterfarbe=counterfarbe+1
farbe[counterfarbe]=black
end
counterfarbe=current
while counterfarbe<table.getn(punkte) do
counterfarbe=counterfarbe+1
farbe[counterfarbe]=black
end
farbe[current]=green
--und hier wird das ganze auf den bildschirm gebracht
counter=0
yposa=ypos
ypos=ypos+4
while counter<table.getn(punkte) do
counter=counter+1
screen:print(10,ypos,punkte[counter],farbe[counter])
ypos=ypos+15
end
if pad:cross() then
f[current]()
end
end
ypos=yposa
screen.flip()
screen.waitVblankStart(pause)
oldpad=pad
end