diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/main.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/main.c b/tests/main.c index 38a0931..e7dc656 100644 --- a/tests/main.c +++ b/tests/main.c @@ -1,6 +1,7 @@ #include <stdio.h> #include <mgl/mgl.h> #include <mgl/window/window.h> +#include <mgl/window/event.h> #include <mgl/graphics/texture.h> #include <mgl/graphics/rectangle.h> #include <mgl/graphics/sprite.h> @@ -45,12 +46,8 @@ int main(int argc, char **argv) { userdata.texture = &texture; userdata.font = &font; - mgl_window_callback window_callback; - window_callback.userdata = &userdata; - window_callback.draw = draw; - mgl_window window; - if(mgl_window_create(&window, "mgl", 1280, 720, &window_callback) != 0) + if(mgl_window_create(&window, "mgl", 1280, 720) != 0) return 1; if(mgl_texture_load_from_file(&texture, "tests/X11.png", NULL) != 0) @@ -59,9 +56,15 @@ int main(int argc, char **argv) { if(mgl_font_load_from_file(&font, "/usr/share/fonts/noto/NotoSans-Regular.ttf", 32) != 0) return 1; + mgl_event event; for(;;) { - mgl_window_events_poll(&window); - mgl_window_draw(&window); + while(mgl_window_events_poll(&window, &event)) { + + } + + mgl_window_clear(&window, (mgl_color){0, 0, 0, 255}); + draw(&window, &userdata); + mgl_window_display(&window); } mgl_font_unload(&font); |