title menu

Blitz3D Forums/Blitz3D Beginners Area/title menu

Okay... just wrote a bit of code that works!

Graphics 640,480,32,2

; make some graphics
Dim button(9,1)
Data "Start","Stop","Rewind","Fast Forward","Pause","Eject","Save","Load","Help","Blitz!"
For n=0 To 9
Read t$
button(n,0)=CreateImage(100,20)
button(n,1)=CreateImage(100,20)
Color 0,0,200
Rect 0,0,100,20,True
Color 160,160,160
Text 50,10,t,True,True
GrabImage button(n,0),0,0
Color 255,255,255
Text 50,10,t,True,True
Rect 0,0,100,20,False
GrabImage button(n,1),0,0
Next

SetBuffer BackBuffer()

Repeat

; draw the screen
For n=0 To 9
If clickbox(button(n,0),button(n,1),50+(n*30),20+(n*30)) Then Text 0,0,"Button "+n+" Clicked!"
Next

Flip
Cls
Until KeyHit(1)
End


Function clickbox(off_image,on_image,x,y)
     xw=ImageWidth(on_image)
     yw=ImageHeight(on_image)
     If MouseX()>=x And MouseX()<=x+xw And MouseY()>=y And MouseY()<=y+yw
          DrawImage on_image,x,y
          If MouseDown(1) Then Return True
          Else
          DrawImage off_image,x,y
          Return False
          EndIf
End Function