X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FApplication.cpp;h=4ff75d8ed10c1104f9abf38142b4ffe46c9d3a5a;hb=11f21c99f562231785660da3afc4d0590ad83e90;hp=c1e4f15311526ec5f767078d5faf30d5d9a72eb5;hpb=dafa7913073e730f352db1c2a76f55bbff39475c;p=l2e.git diff --git a/src/app/Application.cpp b/src/app/Application.cpp index c1e4f15..4ff75d8 100644 --- a/src/app/Application.cpp +++ b/src/app/Application.cpp @@ -106,7 +106,10 @@ void Application::Quit() { void Application::PopAllStates() { while (!states.empty()) { - RealPopState(); + states.top()->PauseState(*this, screen->Screen()); + states.top()->ExitState(*this, screen->Screen()); + delete states.top(); + states.pop(); } } @@ -121,7 +124,7 @@ void Application::Loop() { Uint32 now(SDL_GetTicks()); Uint32 deltaT(now - last); GlobalTimers().Update(deltaT); - if (deltaT > 34) deltaT = 34; + if (deltaT > 30) deltaT = 30; if (CurrentState()) { CurrentState()->GraphicsTimers().Update(deltaT); @@ -159,12 +162,12 @@ void Application::HandleEvents() { break; } } - CurrentState()->HandleEvents(input); + if (CurrentState()) CurrentState()->HandleEvents(input); } void Application::UpdateWorld(Uint32 deltaT) { if (!CurrentState()) return; - for (Uint32 i(0); i < deltaT; ++i) { + for (Uint32 i(0); i < deltaT && !StateChangePending(); ++i) { CurrentState()->PhysicsTimers().Update(0.001f); CurrentState()->UpdateWorld(0.001f); }