BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"Simple start menu"
, by boywonder
Start menu with image links.
Code
;--------------------------------- About --------------------------------- ; A simple start menu by boywonder. ; ; You probably notice that there are lots of possible improvements to do ; but I think this can help you to start ; Enjoy - it's royalty free ;) ; ; NOTICE - YOU NEED TO CREATE THOSE IMAGES THIS TO WORK!!! ; ;------------------------------------------------------------------------- ;--------------------------------- settings --------------------------------- AppTitle "Simple Graphic Start menu" ;graphics Graphics3D 640, 480, 16, 2 SetBuffer BackBuffer() ;hide's the mouse pointer HidePointer ;loads the mousepointer and masks it Global mousepointer=LoadImage("mousepointer.bmp") ;load the option graphic images menu_options = LoadImage("options.bmp") menu_quit = LoadImage("quit.bmp") menu_credits = LoadImage("credits.bmp") menu_back = LoadImage("back.bmp") ;set the font to be verdana 14px myFont12 = LoadFont("verdana", 14, False, False, False) SetFont myFont12 ;status means is the current "place" where you are Global status = 1 ;the starting Y position of the first menu item Global buttonY Global buttonX = 100 ;this checks whether the mouse is hitted (I experienced wierd problems when I tried to put condition 'If MouseHit(1)' to my code) Global mousehitted = False ;--------------------------------- menu loop --------------------------------- ;loop until status is changed to 0 While (status <> 0) ;initialize the starting position and clear the screen buttonY = 150 Cls ;check for mouse click mousehitted = False If (MouseHit(1)) mousehitted = True EndIf ;render elements. UpdateWorld RenderWorld ;select the menu item Select status Case 1 ;main menu drawButton(menu_credits, 2) ;this changes the status to be 2 drawButton(menu_options, 3) ;this changes the status to be 3 drawButton(menu_quit, 0) ;changes status to 0 -> which quits statusdesc$ = "here's the main menu" Case 2 ;credits drawButton(menu_back, 1) ;moves back to main menu (status=1) statusdesc$ = "this is 'credits' -part" Case 3 ;options drawButton(menu_back, 1) ;moves back to main menu (status=1) statusdesc$ = "you are now in the options menu" End Select ;draws the mouse pointer DrawImage mousepointer,MouseX(),MouseY() ;white text to Color 255, 255, 255 Text buttonX,50, statusdesc$ Flip Wend ;--------------------------------- drawButton function --------------------------------- ;the first parameter is the image you want to draw ;the second parameter is the status after mouse click Function drawButton(img, fstatus) posY = buttonY posX = buttonX DrawImage img, posX, posY If ( ImagesOverlap(img, posX, posY, mousepointer,MouseX(),MouseY()) And mousehitted=True ) status = fstatus EndIf buttonY = buttonY + height + 100 End Function End
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations