Blackjack++
  Button class  

Button class


void draw()

Draws the button.
Color updates with state of the button (hovered/clicked).
Hovered: darker than given fg color.
Clicked: brighter than given fg color.

void update()

Checks the mouse to update the status of active and clicked states of the button.
This should be called regularly to update your button.

bool isActive()

Returns the state of active, which keeps track of whether or not the mouse is hovering over the button.

bool isHeld()

Returns the state of held, which keeps track of whether or not the mouse is holding down the button.

bool isClicked()

Will return true ONCE each time the button is clicked.
Holding the button will not result in more true results from isClicked().

Button(BITMAP* pbuf,char* ptext,int px,int py,int pw,int ph,int pfg,int pbg)

Constructor that sets up the button.
Will draw the button on pbuf with text ptext, at coordinates px,py with dimensions pw*ph.
The button will use pfg as the base foreground color (border and text) and pbg as the base background color.

~Button()

Default destructor. No explicit function.
Stephen Cole - Pitt Community College - December 2006