LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
|
Functions | |
void | lg_info_win_no_block (const char *text, zboolean with_frame, zboolean swap_fb) |
void | lg_info_win (const char *text, zboolean with_frame, zboolean swap_fb) |
int | lg_question_win (const char *text) |
void | lg_warning_win (const char *text) |
void | lg_error_win (const char *text) |
char * | lg_entry_win (const char *label, int x, int y) |
int | lg_win_open_centered (LG_Window *win) |
LG_Window | lg_win (const char *text, LG_Color_u text_color, zboolean with_frame, LG_Color_u bg_color, LG_Color_u border_color, TTF_Font *font) |
int | lg_win_open (LG_Window *win, int x, int y) |
int | lg_win_close (LG_Window *win) |
void | lg_win_free_tex (LG_Window *win) |
int | lg_get_win_w (LG_Window *win) |
int | lg_get_win_h (LG_Window *win) |
void | lg_set_fonts (TTF_Font *small_f, TTF_Font *medium_f, TTF_Font *large_f, TTF_Font *big_f, TTF_Font *big_papyrus_f, TTF_Font *very_big_papyrus_f, TTF_Font *large_intelone_mono_f) |
TTF_Font * | lg_get_small_font () |
TTF_Font * | lg_get_medium_font () |
TTF_Font * | lg_get_large_font () |
TTF_Font * | lg_get_big_font () |
TTF_Font * | lg_get_big_papyrus_font () |
TTF_Font * | lg_get_very_big_papyrus_font () |
TTF_Font * | lg_get_large_intelone_mono_font () |
LG_WinColors * | lg_get_win_colors () |
void | lg_set_default_win_colors () |
char * | lg_wrap_lines (const char *txt, TTF_Font *font) |
=== GUI windows implementation ===
void lg_info_win_no_block | ( | const char * | text, |
zboolean | with_frame, | ||
zboolean | swap_fb | ||
) |
Window at screen bottom, horiz. centered - Free but don't close win
text | |
with_frame | |
swap_fb |
void lg_info_win | ( | const char * | text, |
zboolean | with_frame, | ||
zboolean | swap_fb | ||
) |
Window is centered
TODO: Which font size on Android ? TODO #2: Should warn if win text is over 12 lines
text | |
with_frame | |
swap_fb |
int lg_question_win | ( | const char * | text | ) |
Window is centered
On Android: left tap = no / right tap = yes
=== WARNING: Also swap framebuffer ===
TODO: Which font size on Android ?
You should always clear or render to bg just before calling this func (with lg_clear_bg() or lg_read_and_render_screen_back() or ...)
text |
void lg_warning_win | ( | const char * | text | ) |
=== WARNING: Also swap framebuffer ===
You should always clear or render to bg just before calling this func
TODO: Which font size on Android ?
text |
void lg_error_win | ( | const char * | text | ) |
=== WARNING: Also swap framebuffer ===
You should always clear or render to bg just before calling this func
TODO: Which font size on Android ?
text |
char* lg_entry_win | ( | const char * | label, |
int | x, | ||
int | y | ||
) |
TODO: check/test/update
(-1, -1) for centered win, same colors as lg_question_win()
If not NULL (<esc> pressed), returned str must be freed
=== WARNING: Also swap framebuffer ===
You should always clear or render to bg just before calling this func
label | |
x | |
y |
LG_Window lg_win | ( | const char * | text, |
LG_Color_u | text_color, | ||
zboolean | with_frame, | ||
LG_Color_u | bg_color, | ||
LG_Color_u | border_color, | ||
TTF_Font * | font | ||
) |
Create a new LG_Window
WARNING: for frameless wins, the background/border colors are still used, so you MUST set them (ie, DO use either a fully/partially transparent color or an opaque color)
For instance, use lg_color_u(0, 0, 0, 0) for a fully transparent bg
Max lines num inside window is LG_WIN_N_LINES_MAX, defined in lg_win.h
H_PADDING, V_PADDING, and BORDER_WIDTH are also defined in lg_win.h
TODO: add text overflow check
Params are self-explanatory
text | |
text_color | |
with_frame | |
bg_color | |
border_color | |
font |
int lg_win_open | ( | LG_Window * | win, |
int | x, | ||
int | y | ||
) |
Open a LG_Window instance
Set: x = -1, y = -1 for a centered window
win | |
x | |
y |
int lg_win_close | ( | LG_Window * | win | ) |
Close a LG_Window instance
=== This func is DEPRECATED and now a NO-OP ===
win |
void lg_win_free_tex | ( | LG_Window * | win | ) |
Free resources (texture atlas actually) of a LG_Window instance
win |
int lg_get_win_w | ( | LG_Window * | win | ) |
win |
int lg_get_win_h | ( | LG_Window * | win | ) |
win |
void lg_set_fonts | ( | TTF_Font * | small_f, |
TTF_Font * | medium_f, | ||
TTF_Font * | large_f, | ||
TTF_Font * | big_f, | ||
TTF_Font * | big_papyrus_f, | ||
TTF_Font * | very_big_papyrus_f, | ||
TTF_Font * | large_intelone_mono_f | ||
) |
Set fonts
TTF_Font* lg_get_small_font | ( | ) |
Get that font
TTF_Font* lg_get_medium_font | ( | ) |
Get that font
TTF_Font* lg_get_large_font | ( | ) |
Get that font
TTF_Font* lg_get_big_font | ( | ) |
Get that font
TTF_Font* lg_get_big_papyrus_font | ( | ) |
Get that font
TTF_Font* lg_get_very_big_papyrus_font | ( | ) |
Get that font
TTF_Font* lg_get_large_intelone_mono_font | ( | ) |
Get that font
LG_WinColors* lg_get_win_colors | ( | ) |
Get win colors
void lg_set_default_win_colors | ( | ) |
Set default win colors
char* lg_wrap_lines | ( | const char * | txt, |
TTF_Font * | font | ||
) |
Line and word wrapping: Insert newline(s) if one string (ie between 2 newlines) is too long (ie > max_line_len)
max_line_len is set (very roughly) depending on font size
Returned string must be freed afterwards
txt | |
font |