while working on my game engine i coded this menu system, and thought id share it w/ u guys
press esc to bring up menu
use number keys or up/down arrow keys to navagate
exit and resume are working.
you have to code save and load
Rem Project: menu system
Rem Created: Thursday, November 04, 2010
Rem ***** Main Source File *****
set display mode desktop width(),DESKTOP HEIGHT(), 32, 1
set window off
global menu as integer
Global Press as integer
menu = 1
DISABLE ESCAPEKEY
do
rem //////////////////////////////////////////////////////////////////
cls
if KEYSTATE(1) then showmenu = 1 :` esc key
if showmenu = 1
if KEYSTATE(2) then menu = 1
if KEYSTATE(3) then menu = 2
if KEYSTATE(4) then menu = 3
if KEYSTATE(5) then menu = 4
if upkey() = 1 and press=0 then menu = menu - 1; press=1
if downkey() = 1 and press=0 then menu = menu + 1; press=1
if upkey()=0 and downkey()=0 then press=0
if menu > 4 then menu = 1
if menu < 1 then menu = 4
render_menu(menu)
if KEYSTATE(28) : `enter key
choice = menu
if choice = 1 then showmenu = 0
if choice = 2
endif
if choice = 3
ENDIF
if choice = 4 then exit
ENDIF
ENDIF
loop
rem ///////////////////////////////////////////////////////////////////
end
function render_menu(menu)
cls
if menu = 1 then SET TEXT TO BOLD
TEXT 0,0,"Resume"
SET TEXT TO normal
if menu = 2 then SET TEXT TO BOLD
TEXT 0,15,"Save"
SET TEXT TO normal
if menu = 3 then SET TEXT TO BOLD
TEXT 0,30,"Load"
sET TEXT TO normal
if menu = 4 then SET TEXT TO BOLD
TEXT 0,45,"Exit"
sET TEXT TO normal
ENDFUNCTION
please include me in credits if used,
comment below if you need help
(thanks 2 Madscientist for help on this thread http://forum.thegamecreators.com/?m=forum_view&t=177491&b=1)