Code archives/Algorithms/Menu
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
How to make simple menu | |||||
Graphics 800,600,16,60,1 Const x:Int=50 Const y:Int=100 ' place of the list t=1 Repeat Cls SetColor 255,255,255 If t=1 Then SetColor 255,0,0 DrawText "Chosen number 1",200,200 End If DrawText "Choice 1",x,y SetColor 255,255,255 If t=2 Then SetColor 255,0,0 DrawText "Chosen number 2",200,200 End If DrawText "Choice 2",x,y+20 SetColor 255,255,255 If t=3 Then SetColor 255,0,0 DrawText "Chosen number 3",200,200 End If DrawText "Choice 3",x,y+40 SetColor 255,255,255 If t=4 Then SetColor 255,0,0 DrawText "Chosen number 4",200,200 End If DrawText "Choice 4",x,y+60 SetColor 255,255,255 If t=5 Then SetColor 255,0,0 DrawText "Chosen number 5",200,200 End If DrawText "Choice 5",x,y+80 If KeyHit(KEY_UP) Then t=t-1 If KeyHit(KEY_DOWN) Then t=t+1 If t=0 Then t=5 If t=6 Then t=1 Flip Until KeyDown(KEY_ESCAPE) End |
Comments
| ||
choice |
| ||
Another menuSuperStrict Graphics 1024,768,1 Local x:Int=50 Local Y:Int=50 Local Choise:Int=0 Repeat DrawText "Choise 1",x,y DrawText "Choise 2",x,y+20 DrawText "Choise 3",x,y+40 DrawText "Quit",x,y+60 DrawText "<==",x+70,Choise*20+50 Flip;Cls If KeyHit(key_up) Then Choise=Choise-1 If KeyHit(key_down) Then Choise = Choise +1 If Choise = -1 Then Choise =3 If Choise= 4 Then Choise =0 If Choise = 0 And KeyHit(key_return) Then go_to_0() If Choise = 1 And KeyHit(key_return) Then go_to_1() If Choise = 2 And KeyHit(key_return) Then go_to_2() If Choise = 3 And KeyHit(key_return) Then End Forever Function go_to_0() Cls DrawText "Chosen number 1",50,200 Flip Delay(1000) End Function Function go_to_1() Cls DrawText "Chosen number 2",50,200 Flip Delay(1000) End Function Function go_to_2() Cls DrawText "Chosen number 3",50,200 Flip Delay(1000) End Function |
Code Archives Forum