aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/main.c b/tests/main.c
index 0001288..bffbf96 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -9,12 +9,14 @@
#include <mgl/graphics/text.h>
#include <mgl/graphics/vertex_buffer.h>
#include <mgl/graphics/shader.h>
+#include <mgl/system/clock.h>
typedef struct {
mgl_texture *texture;
mgl_font *font;
mgl_vertex_buffer *vertex_buffer;
mgl_shader_program *shader_program;
+ mgl_clock clock;
} Userdata;
static void draw(mgl_window *window, void *userdata) {
@@ -37,8 +39,11 @@ static void draw(mgl_window *window, void *userdata) {
mgl_sprite_draw(context, &sprite);
mgl_shader_program_use(NULL);
+ char str[255];
+ 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, "hello world!\nGood bye world!", 0.0f, 0.0f);
+ mgl_text_init(&text, u->font, str, 0.0f, 0.0f);
mgl_text_draw(context, &text);
mgl_text_deinit(&text);
@@ -60,6 +65,7 @@ int main(int argc, char **argv) {
userdata.font = &font;
userdata.vertex_buffer = &vertex_buffer;
userdata.shader_program = &shader_program;
+ mgl_clock_init(&userdata.clock);
mgl_window window;
if(mgl_window_create(&window, "mgl", 1280, 720) != 0)