I've got a load of functions that i use for creating buttons with images.
Function Hide_Button(BI)
GUI(BI).Draw = 0
EndFunction
Function Show_Button(BI)
GUI(BI).Draw = 1
EndFunction
Function Update_GUI(I)
If I = 0 then I = 500
For t=1 to I
If GUI(t).Draw = 1 then Paste Image GUI(t).Image,GUI(t).Pos.X,GUI(t).Pos.Y
Next t
EndFunction
Function Make_Button(BI,Image,X,Y,SizeX,SizeY)
Gui(BI).ButtonIndex = BI
Gui(BI).Image = Image
Gui(BI).Pos.X = X
Gui(BI).Pos.Y = Y
Gui(BI).Size.X = SizeX
Gui(BI).Size.Y = SizeY
Gui(BI).Draw = 1
EndFunction
Function Position_Button(BI,X,Y)
Gui(BI).Pos.X = X
Gui(BI).Pos.Y = Y
EndFunction
Function Button_Clicked(t)
MX = MouseX()
MY = MouseY()
If t=0 then t=500
For BI=1 to t
If MouseClick() = 0 then Gui(BI).Clicked = 0
If MouseClick() = 1 and Gui(BI).Clicked = 0
If MX>Gui(BI).Pos.X and MX<Gui(BI).Pos.X + Gui(BI).Size.X
If MY>Gui(BI).Pos.Y and MY<Gui(BI).Pos.Y + Gui(BI).Size.Y
ReturnValue = BI
Gui(BI).Clicked = 1
ExitFunction ReturnValue
Endif
Endif
Endif
Next BI
EndFunction ReturnValue
You will need to declare a typed array at the top of your program.
Type XYZ
X as Integer
Y as Integer
Z as Integer
EndType
Type Gui
ButtonIndex as Integer
Image as Integer
Pos as XYZ
Size as XYZ
Clicked as Boolean
Draw as Boolean
EndType
Dim Gui(500) as Gui