aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/graphics/text.c6
-rw-r--r--tests/main.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/graphics/text.c b/src/graphics/text.c
index 9a849a9..723b37a 100644
--- a/src/graphics/text.c
+++ b/src/graphics/text.c
@@ -26,10 +26,12 @@ int mgl_text_init(mgl_text *self, mgl_font *font, const char *str, size_t str_si
self->color = (mgl_color){ 255, 255, 255, 255 };
self->position = (mgl_vec2f){ 0.0f, 0.0f };
- if(options)
+ if(options) {
self->options = *options;
- else
+ } else {
self->options.userdata = NULL;
+ self->options.before_syntax_highlight = NULL;
+ }
if(!options || !options->syntax_highlight)
self->options.syntax_highlight = default_syntax_highlight;
diff --git a/tests/main.c b/tests/main.c
index 4f29a55..6a69866 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <string.h>
#include <mgl/mgl.h>
#include <mgl/window/window.h>
#include <mgl/window/event.h>
@@ -44,7 +45,7 @@ static void draw(mgl_window *window, void *userdata) {
snprintf(str, sizeof(str), "Hello world!\nelapsed time: %f", mgl_clock_get_elapsed_time_seconds(&u->clock));
mgl_text text;
- mgl_text_init(&text, u->font, str, 0.0f, 0.0f);
+ mgl_text_init(&text, u->font, str, strlen(str), NULL);
mgl_text_draw(context, &text);
mgl_text_deinit(&text);