Highlightable Transparent Menu Button Function by TinTin23rd Feb 2007 6:10
|
---|
Summary Highlightable Transparent Menu Button Function Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ` Use a suitable background image Load Image "Background.Jpg",1,1 ` Get middle of screen coordinates MX = Screen Width()/2 MY = Screen Height()/2 ` The main menu loop Do Paste Image 1,0,0 : But = 0 If Button(MX,MY-20," Option 1 ") Then But = 1 If Button(MX,MY ," Option 2 ") Then But = 2 If Button(MX,MY+20," Option 3 ") Then But = 3 Loop ` Button Function Function Button(X,Y,B$) rB as dWord TH=(Text Height(B$)/2)+1 TW=(Text Width(B$)/2)+1 MX=MouseX() : MY=MouseY() If MX>X-TW and MX<X+TW and MY>Y-TH and MY<Y+TH CV = RGBA(128,128,0,128) rB = MouseClick() If rB<>0 then CV = RGBA(255,128,0,128) Else CV = RGBA(0,0,128,64) rB = 0 EndIf Box X-TW,Y-TH,X+TW,Y+TY,CV,CV,CV,CV Center Text X,Y-(TH-1),B$ EndFunction rB ` RGBA Function Function RGBA(R,G,B,A) rB as dWord rB = (A<<24)||(R<<16)||(G<<8)||(B) EndFunction rB |