Browse Source

App: Print average frame-time on exit

master
Riyyi 4 months ago
parent
commit
faacdca424
  1. 2
      assets/settings.json
  2. 9
      src/inferno/application.cpp

2
assets/settings.json

@ -3,7 +3,7 @@
"fullscreen": "windowed",
"height": 720,
"title": "Inferno",
"vsync": true,
"vsync": false,
"width": 1280
}
}

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

Loading…
Cancel
Save