From 08edc234f94b4cb6f3ef021420e4ef6f7bfa1000 Mon Sep 17 00:00:00 2001 From: Fierelier Date: Sun, 30 Jun 2024 23:25:02 +0200 Subject: [PATCH] Exit on keyboard event --- test/graphics.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/graphics.c b/test/graphics.c index da0c818..97cda67 100644 --- a/test/graphics.c +++ b/test/graphics.c @@ -10,6 +10,7 @@ uint32_t example_random() { int main(int argc, char *argv[]) { unigi_init(); + unigi_type_event event; unigi_type_resolution res; res.width = 640; res.height = 480; @@ -22,6 +23,11 @@ int main(int argc, char *argv[]) { unigi_graphics_init(); unigi_window_create(res,"game"); while (1) { + unigi_event_get(&event); + if (event.type == unigi_enum_event_input_keyboard) { + exit(0); + } + for (y = 0; y < res.height; y++) { for (x = 0; x < res.width; x++) { //unigi_graphics_draw((y * res.width) + x,(t + (x ^ y)) + y);