moved window updating and runloop actions after event polling
This commit is contained in:
parent
deddc2bbea
commit
05cf3ba0e2
@ -17,12 +17,6 @@ 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();
|
|
||||||
}
|
|
||||||
for (RunLoopAction action : _actions) {
|
|
||||||
action();
|
|
||||||
}
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
if (SDL_PollEvent(&event)) {
|
if (SDL_PollEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
@ -36,6 +30,12 @@ void Application::run() {
|
|||||||
quit = handle_event(event);
|
quit = handle_event(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (const Window& window : Window::windows()) {
|
||||||
|
window.update();
|
||||||
|
}
|
||||||
|
for (RunLoopAction action : _actions) {
|
||||||
|
action();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user