changed polling for events to blocking call
This commit is contained in:
@ -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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user