Use scene for draw & update calls instead of app

This commit is contained in:
Nikita Lisitsa 2020-08-30 21:22:12 +03:00
parent 3dd8f3db61
commit ac505229ae

View file

@ -189,6 +189,10 @@ namespace psemek::app
impl().running = true; impl().running = true;
while (running()) while (running())
{ {
scene * handler = this;
if (impl().current_scene)
handler = impl().current_scene;
poll_events(); poll_events();
if (!impl().had_initial_resize) if (!impl().had_initial_resize)
{ {
@ -198,8 +202,8 @@ namespace psemek::app
on_resize(w, h); on_resize(w, h);
} }
if (!running()) break; if (!running()) break;
update(); handler->update();
draw(); handler->draw();
SDL_GL_SwapWindow(impl().window); SDL_GL_SwapWindow(impl().window);
} }