diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-08 23:53:08 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-08 23:53:08 +0100 |
commit | 9a2a7faecfa783f154937cfd1d6cbd8e59b86b1f (patch) | |
tree | 1e88d89f0e2a182f3bc0e7b3ce0fcb65d26eea5c | |
parent | 53dcec8caa5943c7fa5d4a55072289c62b62b545 (diff) | |
download | tr8vm-9a2a7faecfa783f154937cfd1d6cbd8e59b86b1f.tar.gz tr8vm-9a2a7faecfa783f154937cfd1d6cbd8e59b86b1f.zip |
Process all the events
-rw-r--r-- | tr8vm.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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; } } } |