deltatime window

This commit is contained in:
2026-03-16 11:41:25 +01:00
parent 681f53bd95
commit 3a22a3746f
3 changed files with 6 additions and 1 deletions

View File

@@ -30,6 +30,8 @@ namespace Game {
ERROR("Exception in GameManager thread: " << e.what());
}
mLastDelta = seconds;
mLastUpdate = now;
const auto elapsed = std::chrono::steady_clock::now() - frameStart;

View File

@@ -98,7 +98,8 @@ namespace Game::Window {
auto elapsed = std::chrono::duration_cast<std::chrono::seconds>(now - mLastFPSTime).count();
if (elapsed >= 1) {
int fps = static_cast<int>(mFrameCount / elapsed);
SDL_SetWindowTitle(mWindow, ("Game Window - FPS: " + std::to_string(fps)).c_str());
std::string title = "Game Window - FPS: " + std::to_string(fps) + " : Update Time: " + std::to_string(mGameManager.getLastDelta());
SDL_SetWindowTitle(mWindow, title.c_str());
mFrameCount = 0;
mLastFPSTime = now;
}