Send initial scene resize after the update and before the rendering
This commit is contained in:
parent
1241fdff9c
commit
dd38061d1c
1 changed files with 13 additions and 7 deletions
|
|
@ -229,15 +229,21 @@ namespace psemek::app
|
||||||
|
|
||||||
auto handler = [this]{ return impl().get_scene(); };
|
auto handler = [this]{ return impl().get_scene(); };
|
||||||
|
|
||||||
if (!impl().had_initial_resize)
|
auto send_initial_resize = [this, &handler]{
|
||||||
{
|
if (!impl().had_initial_resize)
|
||||||
int w, h;
|
{
|
||||||
SDL_GetWindowSize(impl().window, &w, &h);
|
int w, h;
|
||||||
impl().had_initial_resize = true;
|
SDL_GetWindowSize(impl().window, &w, &h);
|
||||||
handler()->on_resize(w, h);
|
impl().had_initial_resize = true;
|
||||||
}
|
handler()->on_resize(w, h);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (!running()) break;
|
if (!running()) break;
|
||||||
|
send_initial_resize();
|
||||||
handler()->update();
|
handler()->update();
|
||||||
|
// The handler might have changed during the update
|
||||||
|
send_initial_resize();
|
||||||
handler()->present();
|
handler()->present();
|
||||||
|
|
||||||
SDL_GL_SwapWindow(impl().window);
|
SDL_GL_SwapWindow(impl().window);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue