Post by Azan on May 26, 2005 19:25:32 GMT -5
Heres the module
Global clicked=9429036810376821658096734752168287
Global page=0 Type button
Field x#,y#,sizex#,sizey#,lable$,clicked,centerx#,centery#,l#,le#,cr,cg,cb,cr2,cg2,cb2,ir,ig,ib,mr,mg,mb,clickedr,clickedg,clickedb,ID
Field activated
End Type
Function button(x#,y#,sizex#,sizey#,lable$,ID,activated,cr,cg,cb,ir,ig,ib,mr,mg,mb,clickedr,clickedg,clickedb)
b.button=New button
b\lable$=lable$
b\activated=activated
b\ID=ID
b\x#=x#
b\y#=y#
b\sizex#=sizex#
b\sizey#=sizey#
b\cr=cr
b\cg=cg
b\cb=cb
b\cr2=cr
b\cg2=cg
b\cb2=cb
b\ir=ir
b\ig=ig
b\ib=ib
b\mr=mr
b\mg=mg
b\mb=mb
b\clickedr=clickedr
b\clickedg=clickedg
b\clickedb=clickedb
b\clicked=0
End Function
Function DrawButton()
For b.button=Each button
If b\activated=1 Then
b\l#=Len(b\lable$)
b\le#=b\l#*4
b\centerx#=b\x#+b\sizex#/2-b\le#
b\centery#=b\y#+b\sizey#/2-6.5
Color b\cr,b\cg,b\cb
Rect b\x#,b\y#,b\sizex#+2,b\sizey#+2
Color b\ir,b\ig,b\ib
Rect b\x#+2,b\y#+2,b\sizex#-2,b\sizey#-2
Color b\cr,b\cg,b\cb
Text b\centerx#,b\centery#,b\lable$
Color 255,255,255
EndIf
Next
End Function
Function clickcheck()
For b.button=Each button
If b\activated=1 Then
b\cr=b\cr2 ;resets the colors for mouseover
b\cg=b\cg2
b\cb=b\cb2
If MouseX()>b\x# And MouseX()<b\x#+b\sizex# And MouseY()>b\y# And MouseY()<b\y#+b\sizey Then
b\cr=b\mr
b\cg=b\mg
b\cb=b\mb
EndIf
If MouseX()>b\x# And MouseX()<b\x#+b\sizex# And MouseY()>b\y# And MouseY()<b\y#+b\sizey And MouseDown(1) Then
b\cr=b\clickedr
b\cg=b\clickedg
b\cb=b\clickedb
clicked=b\ID
EndIf
EndIf
Next
End Function
Function buttonposition()
;;;;;BUTTON POSITIONING SYSTEM;;;;
For b.button=Each button
If KeyDown(208) Then
b\centery#=b\centery#+1
b\y#=b\y#+1
EndIf
If KeyDown(200) Then
b\centery#=b\centery#-1
b\y#=b\y#-1
EndIf
If KeyDown(203) Then
b\centerx#=b\centerx#-1
b\x#=b\x#-1
EndIf
If KeyDown(205) Then
b\centerx#=b\centerx#+1
b\x#=b\x#+1
EndIf
If KeyDown(205) Or KeyDown(203) Or KeyDown(208) Or KeyDown(200) Then
b\lable$=b\x#+" "+b\y#
EndIf
Next
;;;;;END BUTTON POSITIONING SYSTEM;;;;
End Function