Exit on keyboard event

This commit is contained in:
Fierelier 2024-06-30 23:25:02 +02:00
parent 018a808bda
commit 08edc234f9

View File

@ -10,6 +10,7 @@ uint32_t example_random() {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
unigi_init(); unigi_init();
unigi_type_event event;
unigi_type_resolution res; unigi_type_resolution res;
res.width = 640; res.width = 640;
res.height = 480; res.height = 480;
@ -22,6 +23,11 @@ int main(int argc, char *argv[]) {
unigi_graphics_init(); unigi_graphics_init();
unigi_window_create(res,"game"); unigi_window_create(res,"game");
while (1) { while (1) {
unigi_event_get(&event);
if (event.type == unigi_enum_event_input_keyboard) {
exit(0);
}
for (y = 0; y < res.height; y++) { for (y = 0; y < res.height; y++) {
for (x = 0; x < res.width; x++) { for (x = 0; x < res.width; x++) {
//unigi_graphics_draw((y * res.width) + x,(t + (x ^ y)) + y); //unigi_graphics_draw((y * res.width) + x,(t + (x ^ y)) + y);