diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-29 15:45:49 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-29 15:45:58 -0500 |
commit | 5230cb1533d9e30e9870975cba2cd7e7e86bc22a (patch) | |
tree | 260c4bac7a1624eb5cc4cbba492d7822aee260d7 /text.c | |
parent | 31b5649b131695300f39563640c4af8f0d3032cb (diff) |
started tab bar
Diffstat (limited to 'text.c')
-rw-r--r-- | text.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -25,6 +25,14 @@ struct Font { int curr_page; }; +TextRenderState const text_render_state_default = { + .render = true, + .wrap = false, + .x = 0, .y = 0, + .min_x = -FLT_MAX, .max_x = +FLT_MAX, + .min_y = -FLT_MAX, .max_y = +FLT_MAX +}; + static char text_err[200]; void text_clear_err(void) { text_err[0] = '\0'; @@ -270,7 +278,8 @@ void text_render_with_state(Font *font, TextRenderState *render_state, char cons } static void text_render_internal(Font *font, char const *text, float *x, float *y, bool render) { - TextRenderState render_state = {.x = 0, .y = 0, .min_x = -FLT_MAX, .max_x = FLT_MAX, .min_y = -FLT_MAX, .max_y = FLT_MAX, .render = render}; + TextRenderState render_state = text_render_state_default; + render_state.render = render; text_render_with_state(font, &render_state, text, *x, *y); *x = render_state.x; *y = render_state.y; @@ -306,7 +315,8 @@ void text_get_size(Font *font, char const *text, float *width, float *height) { } void text_get_size32(Font *font, char32_t const *text, u64 len, float *width, float *height) { - TextRenderState render_state = {.x = 0, .y = 0, .min_x = -FLT_MAX, .max_x = FLT_MAX, .min_y = -FLT_MAX, .max_y = FLT_MAX, .render = false}; + TextRenderState render_state = text_render_state_default; + render_state.render = false; for (u64 i = 0; i < len; ++i) { text_render_char(font, &render_state, text[i]); } |