From 695da47adea1f641a58b8c143ab72d1a4fd9c5b6 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Mon, 31 Aug 2020 09:47:04 +0300 Subject: [PATCH] Fix scene resize if scene changed when processing events --- libs/app/source/app.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/app/source/app.cpp b/libs/app/source/app.cpp index 48c028ea..be3eacba 100644 --- a/libs/app/source/app.cpp +++ b/libs/app/source/app.cpp @@ -189,17 +189,18 @@ namespace psemek::app impl().running = true; while (running()) { + poll_events(); + scene * handler = this; if (impl().current_scene) handler = impl().current_scene; - poll_events(); if (!impl().had_initial_resize) { int w, h; SDL_GetWindowSize(impl().window, &w, &h); impl().had_initial_resize = true; - on_resize(w, h); + handler->on_resize(w, h); } if (!running()) break; handler->update();