Atrinik Client 2.5
Functions | Variables
toolkit/button.c File Reference
#include <global.h>

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 _Spritebutton_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

void button_create ( button_struct button)

Initialize a button's default values.

Parameters:
buttonButton.

Definition at line 141 of file button.c.

static _Sprite* button_determine_sprite ( button_struct button) [static]

Determine button's sprite, based on its bitmap settings and whether it is currently pressed, or mouse is over it.

Parameters:
buttonButton.
Returns:
Sprite to use.

Definition at line 122 of file button.c.

int button_event ( button_struct button,
SDL_Event *  event 
)

Handle SDL event for a button.

Parameters:
buttonButton to handle.
eventThe event.
Returns:
1 if the event makes the button pressed, 0 otherwise.

Definition at line 213 of file button.c.

void button_render ( button_struct button,
const char *  text 
)

Render a button.

Parameters:
buttonButton to render.
textOptional 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_idBitmap ID to use for the button.
bitmap_id_overBitmap ID to use for the button when the mouse is over the button. -1 to use 'bitmap_id'.
bitmap_id_clickedBitmap ID to use for the button when left mouse button is down. -1 to use 'bitmap_id'.
xX position of the button.
yY position of the button.
textText to display in the middle of the button. Can be NULL for no text.
fontFont to use for the text. One of FONT_xxx.
colorColor to use for the text.
color_shadowShadow color of the text.
color_overColor to use when the mouse is over the button. -1 to use 'color'.
color_over_shadowShadow color to use when the mouse is over the button. -1 to use 'color_shadow'.
flagsText 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:
buttonButton.
fontFont to use for the tooltip text.
textTooltip text.

Definition at line 273 of file button.c.


Variable Documentation

uint32 ticks = 0 [static]

Last clicked ticks to prevent single button click from triggering many actions at once.

Definition at line 35 of file button.c.

uint32 ticks_delay [static]

How many milliseconds must past before a button repeat is triggered.

Definition at line 38 of file button.c.