LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
|
Functions | |
LG_TouchZoneWindow * | lg_tzwin_new (const char *str, LG_Color_u text_color, int x_loc, int y_loc) |
void | lg_tzwin_show (LG_TouchZoneWindow *tzwin, lg_tzw_type type) |
void | lg_tzwin_free (LG_TouchZoneWindow *tzwin) |
Rec2Di | lg_tzwin_get_rect (LG_TouchZoneWindow *tzwin) |
void | lg_draw_rect_corners (Rec2Di r, LG_Color_u c, int len) |
void | lg_draw_arrow (Rec2Di r, LG_Color_u c, lg_tzw_type type) |
void | lg_rectangle_to_arrow (Rec2Di r, lg_tzw_type arrow_type, Point2Di *p[]) |
void | lg_set_func_keys_repeat_delay (uint32_t delay) |
uint32_t | lg_get_user_input (LG_InputState *in, Rec2Di **r) |
=== User Interface things === Get all user input from keyboard, mouse, touchscreen Then try to make something coherent out of all that
LG_TouchZoneWindow* lg_tzwin_new | ( | const char * | str, |
LG_Color_u | text_color, | ||
int | x_loc, | ||
int | y_loc | ||
) |
Create a new LG_TouchZoneWindow
=== Set touch_zone area ===
str | A string |
text_color | A LG_Color_u |
x | One of TZ_LEFT, TZ_RIGHT |
y | One of TZ_BOTTOM, TZ_TOP |
void lg_tzwin_show | ( | LG_TouchZoneWindow * | tzwin, |
lg_tzw_type | type | ||
) |
Show a LG_TouchZoneWindow
tzwin | A pointer to a LG_TouchZoneWindow |
type | A lg_tzw_type value |
void lg_tzwin_free | ( | LG_TouchZoneWindow * | tzwin | ) |
Free a LG_TouchZoneWindow
tzwin | A pointer to a LG_TouchZoneWindow |
Rec2Di lg_tzwin_get_rect | ( | LG_TouchZoneWindow * | tzwin | ) |
Get the Rec2Di from a LG_TouchZoneWindow
tzwin | A pointer to a LG_TouchZoneWindow |
void lg_draw_rect_corners | ( | Rec2Di | r, |
LG_Color_u | c, | ||
int | len | ||
) |
Draw corners of a rect
r | A Rec2Di |
c | A LG_Color_u |
len | Length of corner lines |
void lg_draw_arrow | ( | Rec2Di | r, |
LG_Color_u | c, | ||
lg_tzw_type | type | ||
) |
Draw an arrow
r | A Rec2Di |
c | A LG_Color_u |
type | A lg_tzw_type value |
Determine the points to draw a lg_tzw_type arrow (with TZW_ARROW_POINTS_NUM points) inside a rectangle
-> up/down/left/right_arrow
void lg_set_func_keys_repeat_delay | ( | uint32_t | delay | ) |
Set func keys repeat delay
delay | Delay in ms |
uint32_t lg_get_user_input | ( | LG_InputState * | in, |
Rec2Di ** | r | ||
) |
Get user input (from keyboard, mouse, touchscreen) in LG_InputState and return in->last_pressed_key (SDLK_*)
Use lg_enable_mouse() / lg_disable_mouse() to read/ignore mouse inputs
Delay for func keys (<F1> -> <F12>) is set to FUNC_KEYS_REPEAT_DELAY, can be overridden with lg_set_func_keys_repeat_delay()
On Android, returned value > 0 means requiring action associated with index + 1 of LG_TouchZoneWindow.area array
=== VARO: order of area matters, ie it goes from left to right ===
Reset last_pressed_key if finger up is detected
in | A pointer to a LG_InputState |
r | A pointer to an array of pointers to Rec2Di |