add pause shortcut

This commit is contained in:
2026-01-03 23:32:02 +01:00
parent d9baf7c5ef
commit 0d84cc7470
2 changed files with 8 additions and 2 deletions

View File

@@ -21,6 +21,8 @@ class DebugWorldState : public DisplayState {
std::vector<std::unique_ptr<client::Client>> m_FakeClients;
std::shared_ptr<server::FakeSocket> m_ServerSocket;
unsigned int m_PlaySpeed = 1;
public:
DebugWorldState(Display& a_Display);
~DebugWorldState();

View File

@@ -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;
}