|
|
|
|
Etk_Utils
Detailed Description
A set of utility functions and macros.
|
Defines |
#define | _(string) gettext(string) |
#define | ETK_MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2)) |
#define | ETK_MIN(v1, v2) (((v1) < (v2)) ? (v1) : (v2)) |
#define | ETK_CLAMP(value, left, right) ((value) < (left) ? (left) : ((value) > (right) ? (right) : (value))) |
#define | ETK_ROUND(a) ((a < 0.0) ? (int)(floor(a - 0.5)) : (int)(floor(a + 0.5))) |
#define | ETK_INSIDE(x, y, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy))) |
#define | ETK_WARNING(format,...) fprintf(stderr, "[Etk-Warning] (%s:%d - %s()):\n" format "\n\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) |
Functions |
Etk_Bool | etk_callback_set_null (void *data) |
| A utility function to use as a swapped callback. It sets to NULL the pointer located at the adress stored in data.
For example, if you want to set "pointer" to NULL when "button" is clicked, you can do:
etk_signal_connect_swapped(ETK_OBJECT(button), "clicked", ETK_CALLBACK(etk_callback_set_null), &pointer);.
|
unsigned int | etk_current_time_get () |
| Gets the current time, in milliseconds.
|
Define Documentation
#define _ |
( |
string |
|
) |
gettext(string) |
Finds a translation of "string" according to the locale settings (use gettext)
#define ETK_MAX |
( |
v1, |
|
|
v2 |
|
) |
(((v1) > (v2)) ? (v1) : (v2)) |
Gets the max of the two values
#define ETK_MIN |
( |
v1, |
|
|
v2 |
|
) |
(((v1) < (v2)) ? (v1) : (v2)) |
Gets the min of the two values
#define ETK_CLAMP |
( |
value, |
|
|
left, |
|
|
right |
|
) |
((value) < (left) ? (left) : ((value) > (right) ? (right) : (value))) |
Clamps the value against the boudaries
#define ETK_ROUND |
( |
a |
|
) |
((a < 0.0) ? (int)(floor(a - 0.5)) : (int)(floor(a + 0.5))) |
Rounds the float value to the nearest integer
#define ETK_INSIDE |
( |
x, |
|
|
y, |
|
|
xx, |
|
|
yy, |
|
|
ww, |
|
|
hh |
|
) |
(((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy))) |
Tests if the position (x, y) is inside the rectangle starting at (xx, yy) and of size (ww, hh)
#define ETK_WARNING |
( |
format, |
|
|
... |
|
) |
fprintf(stderr, "[Etk-Warning] (%s:%d - %s()):\n" format "\n\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__) |
Displays a warning in the output console
Function Documentation
Etk_Bool etk_callback_set_null |
( |
void * |
data |
) |
|
A utility function to use as a swapped callback. It sets to NULL the pointer located at the adress stored in data.
For example, if you want to set "pointer" to NULL when "button" is clicked, you can do:
etk_signal_connect_swapped(ETK_OBJECT(button), "clicked", ETK_CALLBACK(etk_callback_set_null), &pointer);.
- Parameters:
-
| data | data stores the location of the pointer to set to NULL |
unsigned int etk_current_time_get |
( |
|
) |
|
Gets the current time, in milliseconds.
- Returns:
- Returns the current time, in milliseconds
|
|
|
|
|
|