From 9a2a7faecfa783f154937cfd1d6cbd8e59b86b1f Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 8 May 2023 23:53:08 +0100 Subject: Process all the events --- tr8vm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tr8vm.c') diff --git a/tr8vm.c b/tr8vm.c index 41ce6eb..aa15ecc 100644 --- a/tr8vm.c +++ b/tr8vm.c @@ -284,12 +284,14 @@ int main(int argc, char *argv[]) SDL_UnlockTexture(fb); SDL_Event ev; - while (1) + uint8_t quit = 0; + + while (!quit) { - if (SDL_PollEvent(&ev)) + while (SDL_PollEvent(&ev)) { if (ev.type == SDL_QUIT) - break; + quit = 1; if (ev.type == SDL_KEYDOWN) { @@ -297,13 +299,12 @@ int main(int argc, char *argv[]) { if (fullscreen) resize_full_screen(screen, renderer, 0, &dst); - break; + quit = 1; } if (ev.key.keysym.sym == SDLK_RETURN && (SDL_GetModState() & KMOD_LALT)) { fullscreen ^= 1; resize_full_screen(screen, renderer, fullscreen, &dst); - continue; } } } -- cgit v1.2.3