Yeah... I had made a button system for one of my projects and I figured I would share it with you guys! Lol anyways I will upload it in a while (I have to add a link to this thread in the help file and organize some stuff). I hope it helps. In the meantime here is the commandlist. You only need to use like 4 commands to make a functional menu. It should be easy to learn if you would like to use it in all.
COMMAND LIST:
SQ_Makebutton( Button Number, Left, Top, Right, bottom)
SQ_DeleteButton(Button Number )
SQ_ReviveButton( Button Number )
SQ_SetButtonImage( Button Number, normal image, highlight image)
SQ_SetButtonProperties( global button sprite, transparency flag )
SQ_SerButtonColors( Normal Color, Highlight Color, Normal Text Color, Highlighted Text Color )
SQ_GetMaxbutton( )
SQ_HideButton( Button Number )
SQ_ShowButton( Button Number )
SQ_PositionButton( Button Number, X Coordinate, Y Coordinate )
SQ_SizeButton( Button Number, X Size, Y Size )
SQ_HideButton( Button Number )
SQ_ShowButton( Button Number )
SQ_UpdateButtons( Start Button, End Button )
SQ_ButtonX( Button Number )
SQ_ButtonY( Button Number )
SQ_ButtonWidth( Button Number )
SQ_ButtonHeight( Button Number )
SQ_ButtonPress( Button Number, Mouse Click )
SQ_ButtonHighlight( Button Number )
SQ_ButtonExist( Button Number )
SQ_GetButtonText( Button Number )
SQ_SetButtonText( Button Number, TEXT )
SQ_PointInButton( Button Number, X , Y )
I'll upload the file in a bit. Here's a screenshot of what I was able to do with just 4 actual functions. The quit button actually works, and here is the code (it's one of the examples that comes with the file). The mouse is invisible because that's what PrntScrn does. It doesn't look very impressive but I've found it to be helpful.
REM Project: Example 1
REM Created: 12/17/2006 4:34:40 PM
REM
REM ***** Main Source File *****
REM THIS IS THE SIMPLEST EXAMPLE.
sync on
sync rate 60
GOSUB SQ_SetupButtons
#Include "../SQ_ButtonFunctions.dba"
rem *************************************
rem MAKE OUR BUTTONS NOW!
rem *************************************
rem Make our first button.
SQ_Makebutton(1, 0, 0, 400,30,"DO NOTHING")
rem Make our second button.
SQ_Makebutton(2, 0, 50, 400,80,"QUIT")
do
rem If you click the second button then it quits.
if SQ_ButtonPress(2,1) then end
rem Update our buttons.
SQ_UpdateButtons(1,2)
sync
loop
And here the buttons are again, in a more practical situation. Also, the buttons have images on them this time
FUNCTION LIST FOR DBA FILE(Some of the ones in the download had bugs, so i fixed them here)
Updated December 27,2006
rem ********************************************
rem ============================================
rem
rem BUTTON FUNCTIONS
rem
rem ============================================
rem ********************************************
end
function SQ_Makebutton(Num,Left,Top,right,bottom,T as string)
if Num>0 and Num<=1000 then : :else: exitfunction -1
SQ_Buttons(Num).active=1
SQ_Buttons(Num).left=LEft
SQ_Buttons(Num).right=right
SQ_Buttons(Num).top=Top
SQ_Buttons(Num).bottom=Bottom
SQ_Buttons(Num).t=T
SQ_Buttons(Num).visible=1
for b = 1 to 1000
if SQ_Buttons(b).active=1 then TehMaxButton=b
next b
endfunction 1
function SQ_DeleteButton(Num)
if SQ_ButtonExist(Num)=0 then exitfunction -1
SQ_Buttons(Num).active=0
for b = 1 to 1000
if SQ_Buttons(b).active=1 then TehMaxButton=b
next b
endfunction 1
function SQ_ReviveButton(Num)
if SQ_ButtonExist(Num)=0 then exitfunction -1
SQ_Buttons(Num).active=1
for b = 1 to 1000
if SQ_Buttons(b).active=1 then TehMaxButton=b
next b
endfunction 1
SQ_SetupButtons:
type button
left as integer
top as integer
right as integer
bottom as integer
active as integer
visible as integer
t as string
image1 as integer
image2 as integer
endtype
DIM SQ_Buttons(1000) as button
SQ_Buttons(0).left=rgb(255,0,0)
SQ_Buttons(0).right=rgb(0,0,255)
SQ_Buttons(0).top=rgb(0,0,255)
SQ_Buttons(0).bottom=rgb(255,0,0)
SQ_Buttons(0).active=31234
Global TehMaxButton
return
function SQ_SetButtonImage(Num,Normal,Highlight)
if SQ_ButtonExist(Num)=0 and Num<>0 then exitfunction -1
if Normal<=0 or highlight<=0 then exitfunction -1
if image exist(Normal)=0 or image exist(highlight)=0 then exitfunction -1
if Num>0
SQ_Buttons(Num).image1=Normal
SQ_Buttons(Num).image2=Highlight
else
for b = 1 to tehmaxbutton
if SQ_ButtonExist(b)=1 then SQ_Buttons(b).image1=Normal : SQ_Buttons(b).image2=Highlight
next b
endif
endfunction 1
function SQ_SetButtonProperties(Spr as integer,Transparency as boolean)
if Spr<=0 then spr=SQ_Buttons(0).active
SQ_Buttons(0).active=Spr
SQ_Buttons(0).visible=Transparency
endfunction
function SQ_SetButtonColors(BackNormal,Backhighlight,TextNormal,TextHighlight)
if BackHighlight=-1 then Backhighlight=rgb(255-rgbr(BackNormal),255-rgbg(BackNormal),255-rgbb(BackNormal))
if TextHighlight=-1 then Texthighlight=rgb(255-rgbr(TextNormal),255-rgbg(TextNormal),255-rgbb(TextNormal))
SQ_Buttons(0).left=BackNormal
SQ_Buttons(0).right=BackHighlight
SQ_Buttons(0).top=TextNormal
SQ_Buttons(0).bottom=TextHighlight
endfunction
function SQ_GetMaxButton()
Temp=TehMaxbutton
endfunction Temp
function SQ_HideButton(Num)
if Num>0
SQ_Buttons(Num).visible=0
else
for b = 1 to SQ_GetMaxButton()
SQ_HideButton(b)
next b
endif
endfunction
function SQ_ShowButton(Num)
if Num>0
SQ_Buttons(Num).visible=1
else
for b = 1 to SQ_GetMaxButton()
SQ_HideButton(b)
next b
endif
endfunction
function SQ_UpdateButtons(S,E)
if s=0 and e=0 then SQ_Updatebuttons(1,SQ_GetMaxbutton()) : exitfunction
for b = 1 to SQ_GetMaxButton()
if SQ_ButtonExist(b)
if b<s or b>e then SQ_HideButton(b) else SQ_ShowButton(b)
endif
next b
for b = S to E
if SQ_ButtonExist(b)
cr=rgbr(SQ_Buttons(0).left)
cg=rgbg(SQ_Buttons(0).left)
cb=rgbb(SQ_Buttons(0).left)
ink SQ_Buttons(0).top,0
if SQ_ButtonHighlight(b)=1
cr=rgbr(SQ_Buttons(0).right)
cg=rgbg(SQ_Buttons(0).right)
cb=rgbb(SQ_Buttons(0).right)
ink SQ_Buttons(0).bottom,0
endif
if SQ_Buttons(b).visible=1
if SQ_Buttons(b).image1=0 or SQ_Buttons(b).image2=0
Box
SQ_Buttons(b).left,SQ_Buttons(b).top,SQ_Buttons(b).right,SQ_Buttons(b).bottom,rgb(cr,cg,cb),0,rgb(cr,cg,cb),0
else
if SQ_ButtonHighlight(b)=0 then Sprite SQ_Buttons(0).active,0,0,SQ_Buttons(b).image1 else Sprite
SQ_Buttons(0).active,0,0,SQ_Buttons(b).image2
set sprite SQ_Buttons(0).active,1,SQ_Buttons(0).visible
size sprite
SQ_Buttons(0).active,SQ_Buttons(b).right-SQ_Buttons(b).left,SQ_Buttons(b).bottom-SQ_Buttons(b).top
hide sprite SQ_Buttons(0).active
paste sprite SQ_Buttons(0).active,SQ_Buttons(b).left,SQ_Buttons(b).top
endif
`center text SQ_Buttons(b).left+(SQ_Buttons(b).right-SQ_Buttons(b).left)/2 ,
SQ_Buttons(b).Top+(SQ_Buttons(b).bottom-SQ_Buttons(b).top)/2,SQ_Buttons(b).T
if SQ_Buttons(b).t<>"" then Text SQ_Buttons(b).left ,
SQ_Buttons(b).Top+(SQ_Buttons(b).bottom-SQ_Buttons(b).top)/2,SQ_Buttons(b).T
endif
endif
next b
endfunction
function SQ_LmbButtonPress(Num)
if SQ_ButtonExist(Num)=0 and Num>0 then exitfunction -1
value=0
if Num=0
for b = 1 to tehMaxbutton
if SQ_LmbButtonPress(b)=1 then value=b
next b
else
if mouseclick()=1 and SQ_ButtonHighlight(Num)=1 then value=1
endif
endfunction value
function SQ_RmbButtonPress(Num)
if SQ_ButtonExist(Num)=0 and Num>0 then exitfunction -1
value=0
if Num=0
for b = 1 to tehMaxbutton
if SQ_RmbButtonPress(b)=1 then value=b
next b
else
if mouseclick()=2 and SQ_ButtonHighlight(Num)=1 then value=1
endif
endfunction value
function SQ_ButtonPress(Num,MouseCLK)
if SQ_ButtonExist(Num)=0 and Num>0 then exitfunction -1
value=0
if Num=0
for b = 1 to tehMaxbutton
if SQ_ButtonPress(b,MouseCLK)=1 then value=b
next b
else
if MouseCLK>0
if mouseclick()=MouseCLK and SQ_ButtonHighlight(Num)=1 then value=1
else
if mouseclick()=1 or mouseclick()=2 or mouseclick()=3 or mouseclick()=4
if SQ_ButtonHighlight(Num)=1 then value=1
endif
endif
endif
endfunction value
function SQ_ButtonHighlight(Num)
if SQ_ButtonExist(Num)=0 and NUM>0 then exitfunction -1
temp=0
if Num>0
if SQ_Buttons(Num).visible=1
LEft=SQ_Buttons(Num).left
Right=SQ_Buttons(Num).right
Top=SQ_Buttons(Num).top
Bottom=SQ_Buttons(Num).bottom
if mousex()>=Left and Mousex()<=Right and Mousey()>=Top and Mousey()<=Bottom then temp=1
endif
endif
if Num=0
for b = 1 to TehMaxbutton
if SQ_ButtonHighlight(b)=1 then temp=b
next b
endif
endfunction temp
function SQ_ButtonWidth(Num)
TEMP#=SQ_Buttons(Num).right-SQ_Buttons(Num).left
endfunction TEMP#
function SQ_ButtonHeight(Num)
TEMP#=SQ_Buttons(Num).top-SQ_Buttons(Num).bottom
endfunction TEMP#
function SQ_ButtonX(Num)
TEMP=SQ_Buttons(Num).left
endfunction TEMP
function SQ_ButtonY(Num)
TEMP=SQ_Buttons(Num).top
endfunction TEMP
function SQ_PositionButton(Num,NXPQ as integer,NYPQ as integer)
SQ_Buttons(Num).right=SQ_Buttons(Num).right+(NXPQ-SQ_Buttons(Num).left)
SQ_Buttons(Num).bottom=SQ_Buttons(Num).bottom+(NYPQ-SQ_Buttons(Num).top)
SQ_Buttons(Num).left=NXPQ
SQ_Buttons(Num).top=NYPQ
endfunction
function SQ_SetButtonText(Num,T as string)
SQ_Buttons(Num).t=T
endfunction
function PointInbutton(Num,XSQ as integer,YSQ as integer)
TEMP=0
LEft=SQ_Buttons(Num).left
Right=SQ_Buttons(Num).right
Top=SQ_Buttons(Num).top
Bottom=SQ_Buttons(Num).bottom
if XSQ>=Left and XSQ<=Right and YSQ>=Top and YSQ<=Bottom then temp=1
endfunction TEMP
function SQ_SizeButton(Num,XSSQ,YSSQ)
SQ_Buttons(Num).right=SQ_Buttons(Num).left+XSSQ
SQ_Buttons(Num).bottom=SQ_Buttons(Num).top+YSSQ
endfunction
function SQ_ButtonExist(Num)
temp=SQ_Buttons(Num).active
endfunction temp
function SQ_GetButtonText(Num)
s$=SQ_Buttons(Num).t
endfunction s$
function SQ_GetButtonNumber( T as string )
T=lower$(t)
TEMP=0
for b = 1 to SQ_GetMaxButton()
if lower$(SQ_Buttons(b).t)=T and SQ_ButtonExist(b) then TEMP=b : exit
next b
endfunction TEMP
EDIT: Okay here it is:
Click here to download the functon pack
If you need anything ( more examples, etc. ) just ask
I hope this helps. Please post your responses.