Fix scene resize if scene changed when processing events

This commit is contained in:
Nikita Lisitsa 2020-08-31 09:47:04 +03:00
parent eb67ee846d
commit 695da47ade

View file

@ -189,17 +189,18 @@ namespace psemek::app
impl().running = true; impl().running = true;
while (running()) while (running())
{ {
poll_events();
scene * handler = this; scene * handler = this;
if (impl().current_scene) if (impl().current_scene)
handler = impl().current_scene; handler = impl().current_scene;
poll_events();
if (!impl().had_initial_resize) if (!impl().had_initial_resize)
{ {
int w, h; int w, h;
SDL_GetWindowSize(impl().window, &w, &h); SDL_GetWindowSize(impl().window, &w, &h);
impl().had_initial_resize = true; impl().had_initial_resize = true;
on_resize(w, h); handler->on_resize(w, h);
} }
if (!running()) break; if (!running()) break;
handler->update(); handler->update();