Following is the basic version of my menu system which i use in a racing game, if you want the enhanced version including the full source code of the racing game, i can sell it to you
still i believe you can find much to learn below..
Download Media Here, dumb forum says 50mb max file limit but cant load 1mb
http://rapidshare.de/files/20090304/Game_Menu.zip.html
Oh and by the way, my graphic card doesnt support gamma altering, if anyone of you can test if it works or not, please let me know.
Rem ***** Main Source File *****
lbl_programPathVariables:
REM PATH GLOBAL VARIABLES
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GLOBAL pthRoot As String
GLOBAL pthMenuImages As String
GLOBAL pthMenuMusic As String
GLOBAL pthMenuSound As String
GLOBAL pthSaveGame As String
GLOBAL pthProfiles As String
REM PATH GLOBAL VARIABLES
pthRoot = GET DIR$()
pthMenuImages = "Menu/Images"
pthMenuMusic = "Menu/Music"
pthMenuSound = "Menu/Sound"
pthSaveGame = "SaveGame"
pthProfiles = "Profiles"
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programDefaults:
REM DEFAULTS
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SYNC ON
AUTOCAM OFF
SET DISPLAY MODE 640, 480, 16
GLOBAL musicVolume = 100
GLOBAL soundVolume = 100
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programSetupNecessaryStuff:
REM SETUP NECESSARY STUFF
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GOSUB lblr_programTypes
GOSUB lblr_programMenuGlobals
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programMenu:
REM MENU
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
lblr_programMenuGlobals:
REM MENU GLOBAL VARIABLES
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
GLOBAL checkDisplay = 1
GLOBAL checkGraphic = 2
GLOBAL checkFont = 3
GLOBAL checkControlDevices = 4
GLOBAL checkDrives = 5
GLOBAL checkFilesProfile = 6
GLOBAL checkFilesSave = 7
GLOBAL checkNetConnections = 8
GLOBAL checkNetSessions = 9
GLOBAL checkNetPlayers = 10
GLOBAL checkEffectValues = 11
GLOBAL checkEffectErrors = 12
GLOBAL DIM buttons(10) As buttonProperties
GLOBAL DIM sliders(10,1) As buttonProperties
GLOBAL DIM menuChecklist(12, 500) As checklist
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programMenuImages:
REM MENU IMAGES
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SET DIR pthMenuImages
imgArrowU = freeImage() : Load Image "imgArrowU.png", imgArrowU, 1
imgArrowD = freeImage() : Load Image "imgArrowD.png", imgArrowD, 1
imgGoBackU = freeImage() : Load Image "imgGoBackU.png", imgGoBackU, 1
imgGoBackD = freeImage() : Load Image "imgGoBackD.png", imgGoBackD, 1
imgSlideU = freeImage() : Load Image "imgSlideU.png", imgSlideU, 1
imgSlideD = freeImage() : Load Image "imgSlideD.png", imgSlideD, 1
imgScrMain = freeImage() : Load Image "scrMainA.png", imgScrMain, 1
imgScrProfile = freeImage() : Load Image "scrProfileA.png", imgScrProfile, 1
imgScrLoad = freeImage() : Load Image "scrLoadA.png", imgScrLoad, 1
imgScrSave = freeImage() : Load Image "scrSaveA.png", imgScrSave, 1
imgScrOptions = freeImage() : Load Image "scrOptionsA.png", imgScrOptions, 1
imgProfile = freeImage() : Load Image "imgProfile.png", imgProfile, 1
sprProfile = freeSprite() : setSprite(sprProfile, 320, 100, imgProfile)
imgNew = freeImage() : Load Image "imgNew.png", imgNew, 1
sprNew = freeSprite() : setSprite(sprNew, 320, 135, imgNew)
imgLoad = freeImage() : Load Image "imgLoad.png", imgLoad, 1
sprLoad = freeSprite() : setSprite(sprLoad, 320, 170, imgLoad)
imgSave = freeImage() : Load Image "imgSave.png", imgSave, 1
sprSave = freeSprite() : setSprite(sprSave, 320, 205, imgSave)
imgOptions = freeImage() : Load Image "imgOptions.png", imgOptions, 1
sprOptions = freeSprite() : setSprite(sprOptions, 320, 240, imgOptions)
imgExit = freeImage() : Load Image "imgExit.png", imgExit, 1
sprExit = freeSprite() : setSprite(sprExit, 320, 275, imgExit)
SET DIR pthRoot
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programMenuMusic:
REM MENU MUSIC
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SET DIR pthMenuMusic
mscTriumph = freeMusic() : Load Music "mscTriumph1.mp3", mscTriumph
SET DIR pthRoot
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programMenuSound:
REM MENU SOUND
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SET DIR pthMenuSound
sndHeli = freeSound() : Load Sound "sndHeli.wav", sndHeli
sndHit = freeSound() : Load Sound "sndHit.wav", sndHit
SET DIR pthRoot
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programMenuBackGround:
REM SET UP MENU BACKGROUND
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COLOR BACKDROP 0
plain3D = Hud2D(200, 200, 400, 220, 140, "SPHERE")
Scale Object plain3D, 200, 100, 200
Set Object Transparency plain3D, 1
Set Sphere Mapping On plain3D, imgScrMain
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programMenuChecklists:
REM SETUP MENU CHECKLISTS
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
REM GRAPHIC CARDS
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
PERFORM CHECKLIST FOR GRAPHICS CARDS
check = CHECKLIST QUANTITY()
If check > 0
For f = 1 To check
menuChecklist(checkGraphic, f).s = CHECKLIST STRING$( f )
Next f
EndIf
EMPTY CHECKLIST
menuChecklist(checkGraphic, 0).check = check
GLOBAL menuGraphicItem = 1
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM DISPLAY MODES
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
PERFORM CHECKLIST FOR DISPLAY MODES
check = CHECKLIST QUANTITY()
If check > 0
For f = 1 To check
menuChecklist(checkDisplay, f).s = CHECKLIST STRING$( f )
If CHECKLIST VALUE A( f ) <> 0 Then menuChecklist(checkDisplay, f).a = CHECKLIST VALUE A( f )
If CHECKLIST VALUE B( f ) <> 0 Then menuChecklist(checkDisplay, f).b = CHECKLIST VALUE B( f )
If CHECKLIST VALUE C( f ) <> 0 Then menuChecklist(checkDisplay, f).c = CHECKLIST VALUE C( f )
Next f
EndIf
EMPTY CHECKLIST
menuChecklist(checkDisplay, 0).check = check
GLOBAL menuDisplayItem = 20
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM PROFILE FILES
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SET DIR pthProfiles
PERFORM CHECKLIST FOR FILES
SET DIR pthRoot
check = CHECKLIST QUANTITY()
If check > 0
For f = 1 To check
menuChecklist(checkFilesProfile, f).s = CHECKLIST STRING$( f )
If CHECKLIST VALUE A( f ) <> 0 Then menuChecklist(checkFilesProfile, f).a = CHECKLIST VALUE A( f )
If CHECKLIST VALUE B( f ) <> 0 Then menuChecklist(checkFilesProfile, f).b = CHECKLIST VALUE B( f )
If CHECKLIST VALUE C( f ) <> 0 Then menuChecklist(checkFilesProfile, f).c = CHECKLIST VALUE C( f )
Next f
EndIf
EMPTY CHECKLIST
menuChecklist(checkFilesProfile, 0).check = check
GLOBAL menuFilesItem = 1
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
REM SAVE FILES
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SET DIR pthSaveGame
PERFORM CHECKLIST FOR FILES
SET DIR pthRoot
check = CHECKLIST QUANTITY()
If check > 0
For f = 1 To check
menuChecklist(checkFilesSave, f).s = CHECKLIST STRING$( f )
If CHECKLIST VALUE A( f ) <> 0 Then menuChecklist(checkFilesSave, f).a = CHECKLIST VALUE A( f )
If CHECKLIST VALUE B( f ) <> 0 Then menuChecklist(checkFilesSave, f).b = CHECKLIST VALUE B( f )
If CHECKLIST VALUE C( f ) <> 0 Then menuChecklist(checkFilesSave, f).c = CHECKLIST VALUE C( f )
Next f
EndIf
EMPTY CHECKLIST
menuChecklist(checkFilesSave, 0).check = check
GLOBAL menuFilesItem = 1
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programMenuLoop:
REM RUN MENU
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
WHILE exitMenu = 0
Select menu
REM PROFILE MENU
Case 1
REM SHOW PROFILE MENU SPRITES
If buttons(7).n > 0 Then Show Sprite buttons(7).n
REM HIDE OTHER SPRITES
For spr = sprProfile To sprExit
If Sprite Visible(spr) Then Hide Sprite spr
Next spr
REM BACKGROUND IMAGE
Paste Image imgScrProfile, 0, 0, 1
REM SHOW SAVED PROFILES
For file = 3 to menuChecklist(checkFilesProfile, 0).check
Center Text 320, 100+file*15, Upper$(menuChecklist(checkFilesProfile, file).s)
inTxtZone(320, 100+file*15, menuChecklist(checkFilesProfile, file).s, "C")
Next file
REM BUTTON GO BACK
menuButton2d(7, 70, 260, 64, 32, "R", imgGoBackU, imgGoBackD)
If buttons(7).clicked = 1 And buttons(7).click = 0 Then buttons(7).click = 1
If buttons(7).click = 1
buttons(7).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
menu = 0
EndIf
If buttons(7).clicked = 0 Then buttons(7).click = 0
EndCase
REM LOAD MENU
Case 2
REM SHOW LOAD MENU SPRITES
If buttons(7).n > 0 Then Show Sprite buttons(7).n
REM HIDE OTHER SPRITES
For spr = sprProfile To sprExit
If Sprite Visible(spr) Then Hide Sprite spr
Next spr
REM BACKGROUND IMAGE
Paste Image imgScrLoad, 0, 0, 1
REM SHOW SAVED PROFILES
For file = 3 to menuChecklist(checkFilesSave, 0).check
Center Text 320, 100+file*15, Upper$(menuChecklist(checkFilesSave, file).s)
inTxtZone(320, 100+file*15, menuChecklist(checkFilesSave, file).s, "C")
Next file
REM BUTTON GO BACK
menuButton2d(7, 70, 260, 64, 32, "R", imgGoBackU, imgGoBackD)
If buttons(7).clicked = 1 And buttons(7).click = 0 Then buttons(7).click = 1
If buttons(7).click = 1
buttons(7).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
menu = 0
EndIf
If buttons(7).clicked = 0 Then buttons(7).click = 0
EndCase
REM SAVE MENU
Case 3
REM SHOW SAVE MENU SPRITES
If buttons(7).n > 0 Then Show Sprite buttons(7).n
REM HIDE OTHER SPRITES
For spr = sprProfile To sprExit
If Sprite Visible(spr) Then Hide Sprite spr
Next spr
REM BACKGROUND IMAGE
Paste Image imgScrSave, 0, 0, 1
REM BUTTON GO BACK
menuButton2d(7, 70, 260, 64, 32, "R", imgGoBackU, imgGoBackD)
If buttons(7).clicked = 1 And buttons(7).click = 0 Then buttons(7).click = 1
If buttons(7).click = 1
buttons(7).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
menu = 0
EndIf
If buttons(7).clicked = 0 Then buttons(7).click = 0
EndCase
REM OPTIONS MENU
Case 4
REM SHOW OPTIONS MENU SPRITES
For i = 1 to 7
If buttons(i).n > 0 Then Show Sprite buttons(i).n
If sliders(i,0).n > 0 Then Show Sprite sliders(i,0).n
If sliders(i,1).n > 0 Then Show Sprite sliders(i,1).n
Next i
REM HIDE OTHER SPRITES
For spr = sprProfile To sprExit
If Sprite Visible(spr) Then Hide Sprite spr
Next spr
REM BACKGROUND IMAGE
Paste Image imgScrOptions, 0, 0, 1
CENTER TEXT 379, 52, menuChecklist(checkGraphic, menuGraphicItem).s
REM BUTTON SCREEN CARD LEFT
menuButton2d(1, 170, 50, 48, 24, "L", imgArrowU, imgArrowD)
If buttons(1).clicked = 1 And buttons(1).click = 0 Then buttons(1).click = 1
If buttons(1).click = 1
buttons(1).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
menuGraphicItem = menuGraphicItem - 1
If menuGraphicItem < 1 Then menuGraphicItem = 1
`SET DISPLAY MODE menuChecklist(checkGraphic, menuGraphicItem).a, menuChecklist(checkGraphic, menuGraphicItem).b, menuChecklist(checkGraphic, menuGraphicItem).c
EndIf
If buttons(1).clicked = 0 Then buttons(1).click = 0
REM BUTTON SCREEN CARD RIGHT
menuButton2d(2, 540, 50, 48, 24, "R", imgArrowU, imgArrowD)
If buttons(2).clicked = 1 And buttons(2).click = 0 Then buttons(2).click = 1
If buttons(2).click = 1
buttons(2).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
menuGraphicItem = menuGraphicItem + 1
If menuGraphicItem > menuChecklist(checkGraphic, 0).check Then menuGraphicItem = menuChecklist(checkGraphic, 0).check
EndIf
If buttons(2).clicked = 0 Then buttons(2).click = 0
REM DISPLAY MODE AVAILABILTY
CENTER TEXT 379, 86, menuChecklist(checkDisplay, menuDisplayItem).s
REM BUTTON DISPLAY MODE LEFT
menuButton2d(3, 170, 84, 48, 24, "L", imgArrowU, imgArrowD)
If buttons(3).clicked = 1 And buttons(3).click = 0 Then buttons(3).click = 1
If buttons(3).click = 1
buttons(3).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
menuDisplayItem = menuDisplayItem - 1
If menuDisplayItem < 1 Then menuDisplayItem = 1
EndIf
If buttons(3).clicked = 0 Then buttons(3).click = 0
REM BUTTON DISPLAY MODE RIGHT
menuButton2d(4, 540, 84, 48, 24, "R", imgArrowU, imgArrowD)
If buttons(4).clicked = 1 And buttons(4).click = 0 Then buttons(4).click = 1
If buttons(4).click = 1
buttons(4).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
menuDisplayItem = menuDisplayItem + 1
If menuDisplayItem > menuChecklist(checkDisplay, 0).check Then menuDisplayItem = menuChecklist(checkDisplay, 0).check
EndIf
If buttons(4).clicked = 0 Then buttons(4).click = 0
REM CHECK GAMMA AVAILABILTY
checkCalibrateGammaAvailable = CALIBRATEGAMMA AVAILABLE()
If checkCalibrateGammaAvailable = 0
stringCalibrateGammaAvailable$ = "NOT SUPPORTED BY GRAPHIC CARD"
CENTER TEXT 379, 120, stringCalibrateGammaAvailable$
Else
REM BUTTON SCREEN GAMMA LEFT
menuButton2d(5, 170, 118, 48, 24, "L", imgArrowU, imgArrowD)
If buttons(5).clicked = 1 And buttons(5).click = 0 Then buttons(5).click = 1
If buttons(5).click = 1
buttons(5).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
screenGamma = screenGamma - 1
rGamma = rGamma - screenGamma
gGamma = gGamma - screenGamma
bGamma = bGamma - screenGamma
EndIf
If buttons(5).clicked = 0 Then buttons(5).click = 0
REM BUTTON SCREEN GAMMA RIGHT
menuButton2d(6, 540, 118, 48, 24, "R", imgArrowU, imgArrowD)
If buttons(6).clicked = 1 And buttons(6).click = 0 Then buttons(6).click = 1
If buttons(6).click = 1
buttons(6).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
screenGamma = screenGamma + 1
rGamma = rGamma + screenGamma
gGamma = gGamma + screenGamma
bGamma = bGamma + screenGamma
EndIf
If buttons(6).clicked = 0 Then buttons(6).click = 0
SET GAMMA rGamma, gGamma, bGamma
EndIf
REM MUSIC VOLUME
musicVolume = menuSlider2d(1, 380, 200, 200, musicVolume, imgSlideU, imgSlideD, 0)
inZoneMusicVolumeSlider = inSprZone(sliders(1,0).n)
If inZoneMusicVolumeSlider
Set Music Volume mscTriumph, musicVolume
Loop Music mscTriumph
Else
If Music Playing(mscTriumph) Then Stop Music mscTriumph
EndIf
REM SOUND VOLUME
soundVolume = menuSlider2d(2, 380, 250, 100, soundVolume, imgSlideU, imgSlideD, 50)
inZoneSoundVolumeSlider = inSprZone(sliders(2,0).n)
If inZoneSoundVolumeSlider
Set Sound Volume sndHeli, soundVolume
If Sound Playing(sndHeli) = 0 Then Loop Sound sndHeli
Else
If Sound Playing(sndHeli) = 1 Then Stop Sound sndHeli
EndIf
REM BUTTON GO BACK
menuButton2d(7, 70, 260, 64, 32, "R", imgGoBackU, imgGoBackD)
If buttons(7).clicked = 1 And buttons(7).click = 0 Then buttons(7).click = 1
If buttons(7).click = 1
buttons(7).click = 2
REM DO SOMETHING HERE
Play Sound sndHit
menu = 0
EndIf
If buttons(7).clicked = 0 Then buttons(7).click = 0
EndCase
REM EXIT MENU
Case 5
Paste Image imgScrMain, 0, 0, 1
If Sound Playing(sndHit) = 0 Then End
EndCase
REM MAIN MENU
Case DEFAULT
REM SHOW MAIN MENU SPRITES
For spr = sprProfile To sprExit
If Sprite Visible(spr) = 0 Then Show Sprite spr
Next spr
REM HIDE OTHER SPRITES
For i = 1 to 7
If buttons(i).n > 0 Then Hide Sprite buttons(i).n
If sliders(i,0).n > 0 Then Hide Sprite sliders(i,0).n
If sliders(i,1).n > 0 Then Hide Sprite sliders(i,1).n
Next i
REM BACKGROUND IMAGE
Paste Image imgScrMain, 0, 0, 1
inZoneProfile = sprFlash(sprProfile, 255, 0, 0)
inZoneNew = sprFlash(sprNew, 255, 0, 0)
inZoneLoad = sprFlash(sprLoad, 255, 0, 0)
inZoneSave = sprFlash(sprSave, 255, 0, 0)
inZoneOptions = sprFlash(sprOptions, 255, 0, 0)
inZoneExit = sprFlash(sprExit, 255, 0, 0)
Rem Profile
If inZoneProfile And MouseClick()
Play Sound sndHit
menu = 1
EndIf
Rem New
If inZoneNew And MouseClick()
exitMenu = 1
EndIf
Rem Load
If inZoneLoad And MouseClick()
Play Sound sndHit
menu = 2
EndIf
Rem Save
If inZoneSave And MouseClick()
Play Sound sndHit
menu = 3
EndIf
Rem Options
If inZoneOptions And MouseClick()
Play Sound sndHit
menu = 4
EndIf
Rem Exit
If inZoneExit And MouseClick()
Play Sound sndHit
menu = 5
EndIf
EndCase
EndSelect
REM RUN BACKGROUND
plain3dAng# = plain3dAng# + 0.1
yRotate Object plain3D, plain3dAng#
REMSTART
EZro_Set OBJECT ANGLE X(plain3D),OBJECT ANGLE Y(plain3D),OBJECT ANGLE Z(plain3D)
EZro_LY 1
ROTATE OBJECT plain3D, EZro_GetX(), EZro_GetY(), EZro_GetZ()
REMEND
SYNC
ENDWHILE
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_programMenuEnd:
REM END MENU HERE
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
REM CLEAN MEMORY
UNDIM buttons()
UNDIM sliders()
UNDIM menuChecklist()
For ent = 1 To 100
If Image Exist(ent) Then Delete Image ent
If Sprite Exist(ent) Then Delete Sprite ent
If Music Exist(ent) Then Delete Music ent
If Sound Exist(ent) Then Delete Sound ent
If Object Exist(ent) Then Delete Object ent
Next img
FLUSH VIDEO MEMORY
CLS
`END
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
COLOR BACKDROP Rgb(0, 0, 255)
imgAniBunny = freeImage() : sprAniBunny = freeSprite()
Create Animated Sprite sprAniBunny, "aniBunny.png", 21, 1, imgAniBunny
MAke Matrix 1, 1000, 1000, 10, 10
Position Matrix 1, -500, 0, -500
Position Camera 0, 10, 0
Do
Paste Sprite sprAniBunny, 287, 250
Play Sprite sprAniBunny, 1, 21, 42
Center Text 320, 50, "GAME LOOPS HERE"
Sync
Loop
REMSTART
PREPARE NEWTON
LOAD LEVEL, Chosen by the level file loaded depending on profile or load game
LOAD PLAYER, Chosen by the profile file
LOAD ENEMIES, Generic AI cars
LOAD BOSS', One big cool enemy here every level Chosen by the level hardness
LOAD ENVIRONMENT, atmospheric environment, chosen by level file
RUN ALL
INGAME MENU
ENDSCREEN
REMEND
lblr_programTypes:
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Type vec2d
x As Integer
y As Integer
EndType
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Type buttonProperties
n As Integer
s As vec2d
p As vec2d
a As vec2d
click As Integer
clicked As Integer
EndType
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Type checklist
s As String `String
a As Integer `checklist a
b As Integer `checklist b
c As Integer `checklist c
d As Integer `checklist d
check As Integer
EndType
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
RETURN
lbl_functions2d:
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`n = sprite number
`x = sprite x position
`y = sprite y position
`xSize = sprite x Size
`ySize = sprite y Size
`d = sprite direction ("L" or "R")
`up = sprite up image
`down = sprite down image
Function menuButton2d(n As Integer, x As Integer, y As Integer, xSize As Integer, ySize As Integer, d As String, up As Integer, down As Integer)
If buttons(n).n = 0
buttons(n).n = freeSprite()
Sprite buttons(n).n, x, y, up
Size Sprite buttons(n).n, xSize, ySize
If d = "L" Then Mirror Sprite buttons(n).n
buttons(n).s.x = Sprite Width(buttons(n).n)
buttons(n).s.y = Sprite Height(buttons(n).n)
EndIf
mx = mouseX()
my = mouseY()
If mx > x And mx < x + buttons(n).s.x And my > y And my < y + buttons(n).s.y
If MouseClick() = 1 And buttons(n).clicked = 0 Then buttons(n).clicked = 1
If buttons(n).clicked = 1
Set Sprite Image buttons(n).n, down
Else
Set Sprite Image buttons(n).n, up
EndIf
If MouseClick() = 0 Then buttons(n).clicked = 0
Else
Set Sprite Image buttons(n).n, up : buttons(n).clicked = 0
EndIf
EndFunction
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`n = sprite number
`x = sprite x position
`y = sprite y position
`xSize = sprite x Size Scale
`menuItem= variable place holder
`up = sprite up image
`down = sprite down image
`def = start value
Function menuSlider2d(n As Integer, x As Integer, y As Integer, xSize As Integer, menuItem As Integer, up As Integer, down As Integer, def As Integer)
If sliders(n,0).n = 0
sliders(n,1).n = freeSprite()
Sprite sliders(n,1).n, x, y, down
Size Sprite sliders(n,1).n, xSize, Sprite Height((sliders(n,1).n))
sliders(n,1).s.x = Sprite Width(sliders(n,1).n)
sliders(n,1).s.y = Sprite Height(sliders(n,1).n)
Offset Sprite sliders(n,1).n, sliders(n,1).s.x / 2.0, sliders(n,1).s.y / 2.0
sliders(n,0).n = freeSprite()
Sprite sliders(n,0).n, x + def, y, up
sliders(n,0).s.x = Sprite Width(sliders(n,0).n)
sliders(n,0).s.y = Sprite Height(sliders(n,0).n)
Offset Sprite sliders(n,0).n, sliders(n,0).s.x / 2.0, sliders(n,0).s.y / 2.0
EndIf
mx = mouseX() : mmx = mouseMoveX()
my = mouseY() : mmy = mouseMoveY()
sliders(n,0).p.x = sprite x(sliders(n,0).n)
sliders(n,0).p.y = sprite y(sliders(n,0).n)
x1# = sliders(n,0).p.x - sliders(n,0).s.x / 2.0
x2# = sliders(n,0).p.x + sliders(n,0).s.x / 2.0
y1# = sliders(n,0).p.y - sliders(n,0).s.y / 2.0
y2# = sliders(n,0).p.y + sliders(n,0).s.y / 2.0
If mx > x1# And mx < x2# And my > y1# And my < y2#
if mouseclick() = 1
sliders(n,0).p.x = mx
if sliders(n,0).p.x < x - sliders(n,1).s.x / 2.0 Then sliders(n,0).p.x = x - sliders(n,1).s.x / 2.0
if sliders(n,0).p.x > x + sliders(n,1).s.x / 2.0 Then sliders(n,0).p.x = x + sliders(n,1).s.x / 2.0
endif
endif
menuItem = abs(x - sliders(n,1).s.x / 2.0 - sliders(n,0).p.x)
center text x,y+20, str$(menuItem)
sprite sliders(n,1).n, x, y, down
sprite sliders(n,0).n, sliders(n,0).p.x, y, up
EndFunction menuItem
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`n = sprite number
`x = sprite x position
`y = sprite y position
`img = sprite image number
Function setSprite(n As Integer, x As Integer, y As Integer, img As Integer)
Sprite n, x, y, img
Offset Sprite n, Sprite Width(n) / 2.0, Sprite Height(n) / 2.0
EndFunction
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`n = sprite number
`r = red color
`g = green color
`b = blue color
Function sprFlash(n As Integer, r As Integer, g As Integer, b As Integer)
inZone = inSprZone(n)
If inZone = 1
Set Sprite Diffuse n, r, g, b
Else
Set Sprite Diffuse n, 255, 255, 255
EndIf
EndFunction inZone
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`n = sprite number
Function inSprZone(n As Integer)
mx = mouseX()
my = mouseY()
x1# = Sprite X(n) - Sprite Width(n) / 2.0
x2# = Sprite X(n) + Sprite Width(n) / 2.0
y1# = Sprite Y(n) - Sprite Height(n) / 2.0
y2# = Sprite Y(n) + Sprite Height(n) / 2.0
If mx > x1# And mx < x2# And my > y1# And my < y2#
inZone = 1
Else
inZone = 0
EndIf
EndFunction inZone
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`x = Text x position
`y = Text y position
`str = Text String
`typ = Text Type "C" (Center Text) or "")
Function inTxtZone(x As Integer, y As Integer, str As String, typ As String)
mx = mouseX()
my = mouseY()
tw# = Text Width(str)
th# = Text Height(str)
y1# = y : y2# = y + th#
If typ = "C"
x1# = x - tw# / 2.0 : x2# = x + tw# / 2.0
Else
x1# = x : x2# = x + tw#
EndIf
If mx > x1# And mx < x2# And my > y1# And my < y2#
inZone = 1
Line x1#, y1#, x1#, y2#
Line x2#, y1#, x2#, y2#
Else
inZone = 0
EndIf
EndFunction inZone
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_functions3d:
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`xSize = object 2d x Size
`ySize = object 2d y Size
`xPos = object 2d x Position
`yPos = object 2d y Position
Function Hud2D(xSize As Integer, ySize As Integer, zSize As Integer, xPos As Integer, yPos As Integer, obj As String)
scrW = Screen Width() : scrW2 = scrW / 2.0
scrH = Screen Height() : scrH2 = scrH / 2.0
hud = freeObject()
if obj = "BOX" Then Make Object Box hud, xSize, ySize, zSize
if obj = "CUBE" Then Make Object Cube hud, xSize : ySize = xSize
if obj = "SPHERE" Then Make Object Sphere hud, xSize : ySize = xSize
if obj = "PLAIN" Then Make Object Plain hud, xSize, ySize
Position Object hud, 0-(scrW2-xSize/2.0)+xPos, (scrH2-ySize/2.0)-yPos, ((scrW - scrH) * 2.5)
`Point Object Hud, camera Position x(), camera Position y(), camera Position z()
Lock Object On hud
EndFunction hud
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
lbl_functionsFree:
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeDll()
Repeat
Inc i
Until DLL Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeMemblock()
Repeat
Inc i
Until MemBlock Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeObject()
Repeat
Inc i
Until Object Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeSound()
Repeat
Inc i
Until Sound Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeMusic()
Repeat
Inc i
Until Music Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeAnimation()
Repeat
Inc i
Until Animation Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeBitmap()
Repeat
Inc i
Until Bitmap Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeEffect()
Repeat
Inc i
Until Effect Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeImage()
Repeat
Inc i
Until Image Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeLight()
Repeat
Inc i
Until Light Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeLimb()
Repeat
Inc i
Until Limb Exist(i,i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeMatrix()
Repeat
Inc i
Until Matrix Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeMesh()
Repeat
Inc i
Until Mesh Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freePixelshader()
Repeat
Inc i
Until Pixel Shader Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeParticles()
Repeat
Inc i
Until Particles Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeSprite()
Repeat
Inc i
Until Sprite Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeTerrain()
Repeat
Inc i
Until Terrain Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeVertexshader()
Repeat
Inc i
Until Vertex Shader Exist(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Function freeFile()
Repeat
Inc i
Until File Open(i) = 0
EndFunction i
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Too Sexy