aboutsummaryrefslogtreecommitdiff
path: root/include/mgl/graphics/text.h
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-24 04:52:30 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-24 04:52:30 +0200
commit115630b520668304af1ccd3eb0b13c06e17ecccc (patch)
treee3949bd4fe36ae3b43c11d4e9ecd0bf523a6e910 /include/mgl/graphics/text.h
parent898b8c95f1f904307c02e978b57301cf1cb0560f (diff)
Add function to load image from memory, initialize window from an existing window, allow creating text without font/string
Diffstat (limited to 'include/mgl/graphics/text.h')
-rw-r--r--include/mgl/graphics/text.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/mgl/graphics/text.h b/include/mgl/graphics/text.h
index 33c75d0..2c2eeaf 100644
--- a/include/mgl/graphics/text.h
+++ b/include/mgl/graphics/text.h
@@ -8,18 +8,23 @@ typedef struct mgl_font mgl_font;
typedef struct mgl_context mgl_context;
typedef struct {
- mgl_font *font;
- const char *text;
+ mgl_font *font; /* nullable */
+ const char *text; /* nullable */
mgl_color color;
mgl_vec2f position;
} mgl_text;
-/* Note: keeps a reference to |text|. |text| needs to be valid as long as |self| is used. */
+/*
+ Note: keeps a reference to |text|. |text| needs to be valid as long as |self| is used.
+ |font| and |text| may be NULL.
+*/
int mgl_text_init(mgl_text *self, mgl_font *font, const char *text, float x, float y);
void mgl_text_deinit(mgl_text *self);
-/* Note: keeps a reference to |text|. |text| needs to be valid as long as |self| is used. */
+/* 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);
+/* |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);
void mgl_text_set_color(mgl_text *self, mgl_color color);
void mgl_text_draw(mgl_context *context, mgl_text *text);