aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/text.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-23 01:39:57 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-23 01:39:57 +0200
commit898b8c95f1f904307c02e978b57301cf1cb0560f (patch)
treed0bf51298967533ffb3ca6565ee309948820cf3f /src/graphics/text.c
parentdf2e6771c5bf6f09e62f9d6b86d83a2631ea365f (diff)
Allow rendering vertices directly
Diffstat (limited to 'src/graphics/text.c')
-rw-r--r--src/graphics/text.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/graphics/text.c b/src/graphics/text.c
index 7f90216..e7b31a0 100644
--- a/src/graphics/text.c
+++ b/src/graphics/text.c
@@ -14,6 +14,10 @@ void mgl_text_deinit(mgl_text *self) {
}
+void mgl_text_set_string(mgl_text *self, const char *str) {
+ self->text = str;
+}
+
void mgl_text_set_position(mgl_text *self, mgl_vec2f position) {
self->position = position;
}
@@ -40,6 +44,9 @@ static void mgl_text_draw_glyph(mgl_context *context, mgl_font_glyph *glyph, mgl
/* TODO: Cache texture bind to not bind texture if its already bound and do not bind texture 0 */
void mgl_text_draw(mgl_context *context, mgl_text *text) {
const char *str = text->text;
+ if(!str)
+ return;
+
mgl_font_glyph glyph;
mgl_vec2f position = text->position;
position.y += text->font->character_size;