not very good. but i dont have time to improve it. i got to go
Menus=6 : Dim MenuItem(Menus) : Dim MenuEntryX(Menus) : Dim MenuEntryY(999) : Dim MenuItem$(Menus) : Dim Items(Menus) : Dim Item$(Menus,99) : Dim Action(Menus,99)
Items(1)=9 : Items(2)=13 : Items(3)=9 : Items(4)=6 : Items(5)=1 : Title$="Demo Menu System"
MenuItem$(1)="File" : MenuItem$(2)="Objects" : MenuItem$(3)="Lights \ Sounds" : MenuItem$(4)="Windows" : MenuItem$(5)="Help" : Item$(1,1)="New" : Item$(1,2)="-" : Item$(1,3)="Save" : Item$(1,4)="Save As..." : Item$(1,5)="-" : Item$(1,6)="Load Level"
Item$(1,7)="Load Texture" : Item$(1,8)="-" : Item$(1,9)="Exit" : Item$(2,1)="Add CUBE" : Item$(2,2)="Add SPHERE" : Item$(2,3)="Add CONE" : Item$(2,4)="Add CYLINDER" : Item$(2,5)="-" : Item$(2,6)="Load Object" : Item$(2,7)="-" : Item$(2,8)="Position Object"
Item$(2,9)="Rotate Object" : Item$(2,10)="Scale Object" : Item$(2,11)="-": Item$(2,12)="Color Object" : Item$(2,13)="Texture Object" : Item$(3,1)="Add LIGHT" : Item$(3,2)="Position Light" : Item$(3,3)="Rotate Light" : Item$(3,4)="-" : Item$(3,5)="Spot Light Angle"
Item$(3,6)="-" : Item$(3,7)="Color Light" : Item$(3,8)="Load Sound" : Item$(3,9)="Position Sound" : Item$(4,1)="Object Propertites" : Item$(4,2)="-" : Item$(4,3)="Select Object" : Item$(4,4)="Select Sound" : Item$(4,5)="Select Light" : Item$(4,6)="Select Texture" : Item$(5,1)="About..."
sync rate 0 : sync on : backdrop on : do : MainBar(Menus,Title$,LevelName$,1,"Arial Narrow",Help$)
for x = 1 to Menus : for y= 1 to 99 : if Action(x,y)=1 : Action(x,y)=0
do : backdrop off : cls 0 : text 0,0,"Hello there! and thanx for trying my Menu Function" : text 0,15,"This is where the demo ends.." : text 0,30,"You selected The '"+MenuItem$(x)+"' Menu and the '"+Item$(x,y)+"' Item iside that Menu" : text 0,45,"This and more can be found on my website" : text 0,75,"www.lukasw.com" : text 15,90,"-Lukas Wadenhof" : if scancode()>0 : end : endif : sync:loop
endif : next y : next x : sync:loop
function MainBar(a,a$,b$,time,c$,Help$)
sw=screen width():sh=screen height() : mx=mousex():my=mousey():mc=mouseclick() : if mouseclick()=0 : latch = 1 : else : latch = 0 : endif
ink rgb(255,255,255),0 : box 0,0,sw-1,15 : ink rgb(96,96,96),0 : box 1,1,sw-1,15 : ink rgb(196,196,196),0 : box 1,1,sw-2,14 : ink rgb(0,0,0),0 : set text size 16 : set text font c$ : text 3,0,a$ : center text sw/2,0,b$ : if time=1 then text sw-100,1,get date$()+"-"+get time$() : ink rgb(225,225,225),0 : box 0,16,sw-1,31
Ink RGB(0,0,0),0 : MenuEntryX(0)=0 : for x = 1 to a-1 : number=len(MenuItem$(x))*6 : text MenuEntryX(x)+4,16,MenuItem$(x) : MenuEntryX(x+1)=MenuEntryX(x)+number : next x
for x = 1 to a-1 : number=len(MenuItem$(x))*6 : if my>=16 and my<=31 : if mx>=MenuEntryX(x) and mx<=MenuEntryX(x)+number : ink rgb(192,192,192),0 : box MenuEntryX(x),16,MenuEntryX(x)+number,31 : ink rgb(0,0,0),0 : text MenuEntryX(x)+4,16,MenuItem$(x) : if latch = 0 : if DisplayMenu>0 : DisplayMenu=0 : endif : if DisplayMenu=0 : DisplayMenu=x : endif : endif : endif : endif : next x
if DisplayMenu>0 : MenuEntryY(1)=31 : number=len(MenuItem$(DisplayMenu))*6 : ink rgb(255,255,255),0 : box MenuEntryX(DisplayMenu),16,MenuEntryX(DisplayMenu)+number,31 : ink rgb(100,100,100),0 : text MenuEntryX(DisplayMenu)+4,16,MenuItem$(DisplayMenu)
for z=1 to Items(DisplayMenu) : number=len(Item$(DisplayMenu,z)) : ink rgb(255,255,255),0 : box MenuEntryX(DisplayMenu),MenuEntryY(z),MenuEntryX(DisplayMenu)+128,MenuEntryY(z)+15 : ink rgb(0,0,0),0 : if mid$(Item$(DisplayMenu,z),number)="-" : line MenuEntryX(DisplayMenu)+2,MenuEntryY(z)+9,MenuEntryX(DisplayMenu)+126,MenuEntryY(z)+9 : else : if mx>=MenuEntryX(DisplayMenu) and mx<=MenuEntryX(DisplayMenu)+128
if my>=MenuEntryY(z) and my<=MenuEntryY(z)+15 : ink rgb(192,192,192),0 : box MenuEntryX(DisplayMenu)+2,MenuEntryY(z)+2,MenuEntryX(DisplayMenu)+126,MenuEntryY(z)+13 : ink rgb(0,0,0),0 : if mc=1 : Action(DisplayMenu,z)=1:DisplayMenu=0 : endif : endif : endif : text MenuEntryX(DisplayMenu)+8,MenuEntryY(z),Item$(DisplayMenu,z) : endif : text MenuEntryX(DisplayMenu)+8,MenuEntryY(z),Item$(DisplayMenu,z) : if z<Items(DisplayMenu) : MenuEntryY(z+1)=MenuEntryY(z)+15 : endif : next z
if latch = 0 : if mx<=MenuEntryX(DisplayMenu) or mx>=MenuEntryX(DisplayMenu)+128 or my<=31 or my>=(15*Items(DisplayMenu)) : DisplayMenu=0 : endif : endif : endif
endfunction