From 027b9ba84af5bcddafce32c448ce5cacac1c141b Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Sat, 24 Oct 2020 15:58:58 +0200 Subject: [PATCH] changed polling for events to blocking call --- Application.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Application.cpp b/Application.cpp index 309a946..7993228 100644 --- a/Application.cpp +++ b/Application.cpp @@ -16,8 +16,11 @@ Application Application::app; void Application::run() { bool quit {false}; while (!quit) { + for (const Window& window : Window::windows()) { + window.update(); + } SDL_Event event; - if (SDL_PollEvent(&event)) { + if (SDL_WaitEvent(&event)) { switch (event.type) { case SDL_QUIT: quit = true; @@ -29,9 +32,6 @@ void Application::run() { quit = handle_event(event); } } - for (const Window& window : Window::windows()) { - window.update(); - } } }