`# Setup
hide mouse
sync on : sync rate 60
 
`dim menu options
DIM menu$(15)
menu$(0)="Quit"
menu$(1)="New Game"
menu$(2)="Load Game"
menu$(3)="Options"
menu$(4)="Game 1" :`Load Game
menu$(5)="Game 2" :`Load Game
menu$(6)="Game 3" :`Load Game
menu$(7)="Game 4" :`Load Game
menu$(8)="Exit" :`Load Game/Options
menu$(9)="Audio" :`Options
menu$(10)="Display" :`Options
menu$(11)="Volume" :`Audio
menu$(12)="Exit" :`Audio/Display
menu$(13)="Graphics Detail" :`Display
menu$(14)="Draw Distance" :`Display
menu$(15)="FOV" :`Display
`dim active menu option positions
DIM menupos(2)
menupos(0)= 100
menupos(1)= 240
menupos(2)= 380
 
set text font "algerian",1
 
`skip to menu
menu(0,3,1,1)
 
`# Main Program
print "The game would now begin."
END
 
`# Functions
FUNCTION menu(min,max,sel,exitsel)
   REPEAT
      Repeat
         `input
         old=u+d
         u=upkey() : d=downkey()
         `adjust and bind selection
         if u+d>old then inc sel,d-u
         if sel<min then sel=max
         if sel>max then sel=min
         `get currently displayed options
         if sel-1<min then menu1$=menu$(max) else menu1$=menu$(sel-1)
         menu2$=menu$(sel)
         if sel+1>max then menu3$=menu$(min) else menu3$=menu$(sel+1)
         `display
         ink rgb(128,128,128),0
         set text size 12
         center text 320,100,menu1$
         center text 320,380,menu3$
         ink rgb(255,255,255),0
         set text size 20
         center text 320,240,menu2$
         sync:cls
      Until returnkey()=1
 
      rem crappy delay for single key press
      repeat : until returnkey()=0
 
      `selected options that aren't exit
      select sel
       case 0 : end : endcase :`Quit
       case 2 : menu(4,8,4,8) : endcase :`Load Game
       case 3 : menu(8,10,9,8) : endcase :`Options
       case 9 : menu(11,12,11,12) : endcase :`Audio
       case 10: menu(12,15,15,12) : endcase :`Display
      endselect
   UNTIL sel=exitsel
ENDFUNCTION