From cb679636f77fe2a03e8dab3a511e28e1ab898316 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 6 Nov 2021 15:55:42 +0100 Subject: Fix exit being called when closing window, respond to wm ping, add is_open function to window --- include/mgl/graphics/text.h | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'include/mgl/graphics') diff --git a/include/mgl/graphics/text.h b/include/mgl/graphics/text.h index f832605..aca0650 100644 --- a/include/mgl/graphics/text.h +++ b/include/mgl/graphics/text.h @@ -15,14 +15,6 @@ typedef struct mgl_font mgl_font; typedef struct mgl_context mgl_context; -typedef struct { - /* Optional */ - void (*before_syntax_highlight)(void *userdata); - /* Return true if the text format should be changed. Optional */ - bool (*syntax_highlight)(void *userdata, const char *str, size_t size, mgl_color *color); - void *userdata; -} mgl_text_options; - typedef struct { mgl_font *font; /* nullable */ const char *text; /* nullable */ @@ -30,19 +22,21 @@ typedef struct { mgl_color color; mgl_vec2f position; mgl_vec2f bounds; - mgl_text_options options; } mgl_text; /* Note: keeps a reference to |text|. |text| needs to be valid as long as |self| is used. |font| and |text| may be NULL. - |load_options| can be NULL, in which case the default options are used. */ -int mgl_text_init(mgl_text *self, mgl_font *font, const char *str, size_t str_size, mgl_text_options *options); +int mgl_text_init(mgl_text *self, mgl_font *font, const char *str, size_t str_size); void mgl_text_deinit(mgl_text *self); -/* Note: keeps a reference to |text|. |text| needs to be valid as long as |self| is used. |text| may be NULL. */ -void mgl_text_set_string(mgl_text *self, const char *str, size_t str_size); +/* + Note: keeps a reference to |text|. |text| needs to be valid as long as |self| is used. + |text| may be NULL. + |str| will be checked if its a valid utf8 string. +*/ +int mgl_text_set_string(mgl_text *self, const char *str, size_t str_size); /* |font| may be NULL */ void mgl_text_set_font(mgl_text *self, mgl_font *font); void mgl_text_set_position(mgl_text *self, mgl_vec2f position); -- cgit v1.2.3