Rem ***** Included Source File *****
GOSUB Menu_Setup
menu = 1
Sync On : SYnc Rate 60
Set Display Mode 800,600,32
DO
`menu 1 is the main menu
if menu = 1 then GOSUB Main_Menu
`menu 2 is the option menu
if menu = 2 then GOSUB Menu_Options
SYNC : Cls
LOOP
Menu_Setup:
dim c(1,1)
rem set colours
c(0,0) = rgb(128,128,128) : c(0,1) = rgb(128,0,0)
c(1,0) = rgb(255,255,255) : c(1,1) = rgb(255,0,0)
rem button text array
dim msg$(3)
rem button names
data "New Game","Continue","Options","Quit"
rem fill array
for x = 0 to 3
read msg$(x)
next x
`reset the focus
focus = 0
RETURN
Main_Menu:
IF image exist(65535) then paste image 65535,0,0
` focus=0 :`this is which button is currently focused on.
rem === MAIN ===
rem -- input --
oldin = newin
newin = downkey()-upkey()
rem -- process --
if newin<>0
if newin>oldin or newin<oldin or holdkeytimer > 15
rem increase the focus by the newin value
inc focus, newin
rem make the focus wrap
if focus>3 then focus = 0
if focus<0 then focus = 3
if holdkeytimer > 15 then holdkeytimer = 10
endif
rem keep track of the time the player has held down the key, so we know when to scroll fast
inc holdkeytimer
else
holdkeytimer = 0
endif
rem -- output --
for b = 0 to 3
active=(b=focus)
draw_btn(msg$(b),b*120+80,c(active,1),c(active,0))
next b
IF ReturnKey()=1
SELECT FOCUS
CASE 0 : Game=1 : PauseSTate=0 : Show ALl Sprites : ENDCASE
CASE 1 : game=(2*pausestate) : Show ALl Sprites : ENDCASE
CASE 2 : gosub options_setup : menu = 2 : ENDCASE
CASE 3 : END : ENDCASE
ENDSELECT
ENDIF
`sync
RETURN
Options_Setup:
dim c(1,1)
rem set colours
c(0,0) = rgb(128,128,128) : c(0,1) = rgb(128,0,0)
c(1,0) = rgb(255,255,255) : c(1,1) = rgb(255,0,0)
rem button text array
dim msg$(3)
rem button names
data "Sound","Video","Keybind Control","Back"
rem fill array
for x = 0 to 3
read msg$(x)
next x
`reset the focus
focus = 0
RETURN
Menu_Options:
IF image exist(65535) then paste image 65535,0,0
` focus=0 :`this is which button is currently focused on.
rem === MAIN ===
rem -- input --
oldin = newin
newin = downkey()-upkey()
rem -- process --
if newin<>0
if newin>oldin or newin<oldin or holdkeytimer > 15
rem increase the focus by the newin value
inc focus, newin
rem make the focus wrap
if focus>3 then focus = 0
if focus<0 then focus = 3
if holdkeytimer > 15 then holdkeytimer = 10
endif
rem keep track of the time the player has held down the key, so we know when to scroll fast
inc holdkeytimer
else
holdkeytimer = 0
endif
rem -- output --
for b = 0 to 3
active=(b=focus)
draw_btn(msg$(b),b*120+80,c(active,1),c(active,0))
next b
IF ReturnKey()=1
SELECT FOCUS
CASE 0 : ENDCASE
CASE 1 : ENDCASE
CASE 2 : ENDCASE
CASE 3 : gosub menu_setup : menu = 1 : ENDCASE
ENDSELECT
ENDIF
`sync
RETURN
SnapShot:
FOR I=1 to 65535
If Sprite Exist(I) then Paste Sprite I,Sprite X(I),Sprite Y(I)
NEXT I
Make Memblock from bitmap 1,0
`Copy Memblock 1,2,0,0,Get Memblock Size(1)
Make Image From Memblock 65535,1
Hide All Sprites
RETURN
UnSprite:
FOR I=1 to 65535
IF Sprite Exist(I) then Delete Sprite I
NEXT I
RETURN
end
rem "Since all these buttons function the same I will describe just one in detail." :P
function draw_btn(btn$,y,fg,bg)
ink bg,0
box 220,y,420,y+100
rem draw a line border, clockwise.
ink fg,0
box 220,y,420,y
box 420,y,420,y+100
box 220,y+100,420,y+100
box 220,y,220,y+100
rem write text
center text 320,y,btn$
endfunction
okay, I'll be honest. I'm really having trouble with this. I've got a little post-Christmas bug, and I not thinking very well. Am I going anywhere in the right direction? I think I'm having trouble understanding what's going on in the code. I can't work on at anymore right now.
yrotate when you can spin?
God Bless!
