diff --git a/include/td/display/state/DebugWorldState.h b/include/td/display/state/DebugWorldState.h index a8aae95..cce2c4d 100644 --- a/include/td/display/state/DebugWorldState.h +++ b/include/td/display/state/DebugWorldState.h @@ -21,6 +21,8 @@ class DebugWorldState : public DisplayState { std::vector> m_FakeClients; std::shared_ptr m_ServerSocket; + unsigned int m_PlaySpeed = 1; + public: DebugWorldState(Display& a_Display); ~DebugWorldState(); diff --git a/src/td/display/state/DebugWorldState.cpp b/src/td/display/state/DebugWorldState.cpp index 3e5ee5f..6e29c8f 100644 --- a/src/td/display/state/DebugWorldState.cpp +++ b/src/td/display/state/DebugWorldState.cpp @@ -75,8 +75,8 @@ DebugWorldState::DebugWorldState(Display& a_Display) : DisplayState(a_Display) { } void DebugWorldState::Update(float a_Delta) { - m_Server->Update(a_Delta); - m_Client->Update(a_Delta); + m_Server->Update(a_Delta * m_PlaySpeed); + m_Client->Update(a_Delta * m_PlaySpeed); if (m_ClientState) m_Renderer.Render(m_ClientState->GetCurrentLerp()); } @@ -102,6 +102,10 @@ void DebugWorldState::OnKeyDown(SDL_Keycode a_Key) { m_Client->Update(SECONDS); break; + case SDLK_P: + m_PlaySpeed = 1 - m_PlaySpeed; + break; + default: break; }