changed polling for events to blocking call

This commit is contained in:
Bob Polis
2020-10-24 15:58:58 +02:00
parent b67f68cd6c
commit 027b9ba84a

View File

@ -16,8 +16,11 @@ Application Application::app;
void Application::run() { void Application::run() {
bool quit {false}; bool quit {false};
while (!quit) { while (!quit) {
for (const Window& window : Window::windows()) {
window.update();
}
SDL_Event event; SDL_Event event;
if (SDL_PollEvent(&event)) { if (SDL_WaitEvent(&event)) {
switch (event.type) { switch (event.type) {
case SDL_QUIT: case SDL_QUIT:
quit = true; quit = true;
@ -29,9 +32,6 @@ void Application::run() {
quit = handle_event(event); quit = handle_event(event);
} }
} }
for (const Window& window : Window::windows()) {
window.update();
}
} }
} }