From faacdca424188434048ee648859297f480bda3ad Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 10 Aug 2024 21:49:39 +0200 Subject: [PATCH] App: Print average frame-time on exit --- assets/settings.json | 2 +- src/inferno/application.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/settings.json b/assets/settings.json index 6b3e32c..3f3bbf8 100644 --- a/assets/settings.json +++ b/assets/settings.json @@ -3,7 +3,7 @@ "fullscreen": "windowed", "height": 720, "title": "Inferno", - "vsync": true, + "vsync": false, "width": 1280 } } diff --git a/src/inferno/application.cpp b/src/inferno/application.cpp index d569b57..7d1e47f 100644 --- a/src/inferno/application.cpp +++ b/src/inferno/application.cpp @@ -171,7 +171,9 @@ int Application::run() constexpr glm::mat4 matIdentity { 1.0f }; constexpr TransformComponent transformIdentity; - // m_window->setVSync(false); + double gametime = 0; + uint64_t frames = 0; + while (!m_window->shouldClose()) { float time = Time::time(); @@ -179,6 +181,9 @@ int Application::run() m_lastFrameTime = time; // ruc::debug("Frametime {}ms", deltaTime * 1000); + gametime += deltaTime; + frames++; + // --------------------------------- // Update @@ -224,6 +229,8 @@ int Application::run() ruc::debug("Application shutdown"); + ruc::debug("Average frametime: {:.2f}ms", (gametime / frames) * 1000); + return m_status; }