Simple Button Class
Monkey Forums/Monkey Code/Simple Button Class
| ||
| This is for basic, simple needs. I know there are some snazzy button classes out there, but I don't know where I saw them. This uses an image's width, height (no rotation) for the click extents. If you draw in on the OnRender(), then it's active. You don't draw it, it's not active. I'm sure I could enhance this by extending the Image Class, but for now, it's fine. USEAGE:
''pseudocode
Class Game Extends App
OnCreate()
button:CButton = New CButton
button.SetFlashColor(250,150,150) ''optional
OnUpdate()
CButton.OnUpdate() ''always needed
if button.isClick
DoSomething()
endif
OnRender()
CButton.OnRender() ''always needed
button.Draw(anyimage,x,y,0,scalex,scaley)
If button.LastButtonPressed()
DrawImage(popup_menu,x,y)
simplebutton.monkey |