From 3b9e8c219060d2517b6a10e604f258d8b9696903 Mon Sep 17 00:00:00 2001 From: George Fotopoulos Date: Thu, 25 Jan 2024 14:28:41 +0200 Subject: [PATCH] Update Application::Run() --- src/Application.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index 4b3af16..5d99173 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -84,7 +84,8 @@ void Application::Run() { } const sf::Time deltaTime = deltaClock.restart(); - accumulator += timeScale * deltaTime; + const sf::Time scaledDeltaTime = timeScale * deltaTime; + accumulator += scaledDeltaTime; while (accumulator > fixedDeltaTime) { FixedUpdate(fixedDeltaTime); accumulator -= fixedDeltaTime; @@ -116,8 +117,10 @@ void Application::Run() { } ImGui::Begin("Statistics"); - ImGui::Text("deltaTime : %.5lf", deltaTime.asSeconds()); - ImGui::Text("fixedDeltaTime : %.5lf", fixedDeltaTime.asSeconds()); + ImGui::Text("timeScale : %.5f", timeScale); + ImGui::Text("deltaTime : %.5f", deltaTime.asSeconds()); + ImGui::Text("scaledDeltaTime : %.5f", scaledDeltaTime.asSeconds()); + ImGui::Text("fixedDeltaTime : %.5f", fixedDeltaTime.asSeconds()); ImGui::End(); ImGui::SFML::Render(window);