Go to the source code of this file.
Functions |
| int | button_show (int bitmap_id, int bitmap_id_over, int bitmap_id_clicked, int x, int y, const char *text, int font, const char *color, const char *color_shadow, const char *color_over, const char *color_over_shadow, uint64 flags) |
| static _Sprite * | button_determine_sprite (button_struct *button) |
| void | button_create (button_struct *button) |
| void | button_render (button_struct *button, const char *text) |
| int | button_event (button_struct *button, SDL_Event *event) |
| void | button_tooltip (button_struct *button, int font, const char *text) |
Variables |
| static uint32 | ticks = 0 |
| static uint32 | ticks_delay |
Detailed Description
Button API.
Definition in file button.c.
Function Documentation
Initialize a button's default values.
- Parameters:
-
Definition at line 141 of file button.c.
Determine button's sprite, based on its bitmap settings and whether it is currently pressed, or mouse is over it.
- Parameters:
-
- Returns:
- Sprite to use.
Definition at line 122 of file button.c.
Handle SDL event for a button.
- Parameters:
-
| button | Button to handle. |
| event | The event. |
- Returns:
- 1 if the event makes the button pressed, 0 otherwise.
Definition at line 213 of file button.c.
Render a button.
- Parameters:
-
| button | Button to render. |
| text | Optional text to render. |
Definition at line 162 of file button.c.
| int button_show |
( |
int |
bitmap_id, |
|
|
int |
bitmap_id_over, |
|
|
int |
bitmap_id_clicked, |
|
|
int |
x, |
|
|
int |
y, |
|
|
const char * |
text, |
|
|
int |
font, |
|
|
const char * |
color, |
|
|
const char * |
color_shadow, |
|
|
const char * |
color_over, |
|
|
const char * |
color_over_shadow, |
|
|
uint64 |
flags |
|
) |
| |
Show a button.
- Parameters:
-
| bitmap_id | Bitmap ID to use for the button. |
| bitmap_id_over | Bitmap ID to use for the button when the mouse is over the button. -1 to use 'bitmap_id'. |
| bitmap_id_clicked | Bitmap ID to use for the button when left mouse button is down. -1 to use 'bitmap_id'. |
| x | X position of the button. |
| y | Y position of the button. |
| text | Text to display in the middle of the button. Can be NULL for no text. |
| font | Font to use for the text. One of FONT_xxx. |
| color | Color to use for the text. |
| color_shadow | Shadow color of the text. |
| color_over | Color to use when the mouse is over the button. -1 to use 'color'. |
| color_over_shadow | Shadow color to use when the mouse is over the button. -1 to use 'color_shadow'. |
| flags | Text flags. |
- Returns:
- 1 if left mouse button is being held over the button, 0 otherwise.
Definition at line 61 of file button.c.
| void button_tooltip |
( |
button_struct * |
button, |
|
|
int |
font, |
|
|
const char * |
text |
|
) |
| |
Render a tooltip, if possible.
- Parameters:
-
| button | Button. |
| font | Font to use for the tooltip text. |
| text | Tooltip text. |
Definition at line 273 of file button.c.
Variable Documentation
Last clicked ticks to prevent single button click from triggering many actions at once.
Definition at line 35 of file button.c.
How many milliseconds must past before a button repeat is triggered.
Definition at line 38 of file button.c.