#include <guibutton.h>
Public Methods | |
GUIButton (Game *parentgame, Texture *icon, const char *tooltip, int x, int y, Vector &baseposition, SDLKey hotkey=SDLK_UNKNOWN, int modifier=KMOD_NONE) | |
GUIButton (Game *parentgame, const char *text, int x, int y, Vector &baseposition, SDLKey hotkey=SDLK_UNKNOWN, int modifier=KMOD_NONE) | |
~GUIButton () | |
void | setAutoRefresh (bool enable) |
void | setCallback (void(*callback)()) |
bool | clicked () |
void | render () |
void | refresh () |
void | setFont (BFont *tipfont) |
Private Attributes | |
int | ismouseover |
Texture * | tex |
const char * | tip |
const char * | buttontext |
Vector | pos |
Vector | size |
Vector * | basepos |
Game * | game |
BFont * | font |
int | buttontype |
float | normalcolor [4] |
float | hovercolor [4] |
float | activecolor [4] |
float | currentcolor [4] |
void(* | buttonCallback )() |
bool | click |
bool | autorefresh |
SDLKey | hotk |
int | modk |
|
Create new button with icon and tooltip at specific position. Render() adds baseposition to x,y and it can be changed at any time. Optionally hotkey and key modifier (KMOD_ALT, KMOD_CTRL etc) can be set.
|
|
Create new button with text at specific position. Other options are same with icon button.
|
|
Destructor.
|
|
Return true if button is clicked. Cliked status will be cleared in next refresh().
|
|
Check input and update state, call this every frame when button is visible.
|
|
Render a button.
|
|
Set autorefresh mode, If enable is true refresh() will be called in render(), otherwise refresh() must be called separately. By default autorefresh is enabled.
|
|
Set a callback fuction for button press. Callback can't be a member of class, must be C-function like: void test().
|
|
Set tooltip font.
|
|
|
|
|
|
|
|
Call this function when pressed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|