diff --git a/libs/app/source/app.cpp b/libs/app/source/app.cpp index c5701322..b7baa6ac 100644 --- a/libs/app/source/app.cpp +++ b/libs/app/source/app.cpp @@ -229,15 +229,21 @@ namespace psemek::app auto handler = [this]{ return impl().get_scene(); }; - if (!impl().had_initial_resize) - { - int w, h; - SDL_GetWindowSize(impl().window, &w, &h); - impl().had_initial_resize = true; - handler()->on_resize(w, h); - } + auto send_initial_resize = [this, &handler]{ + if (!impl().had_initial_resize) + { + int w, h; + SDL_GetWindowSize(impl().window, &w, &h); + impl().had_initial_resize = true; + handler()->on_resize(w, h); + } + }; + if (!running()) break; + send_initial_resize(); handler()->update(); + // The handler might have changed during the update + send_initial_resize(); handler()->present(); SDL_GL_SwapWindow(impl().window);