Skip to content

Commit

Permalink
Update Stats Window to get frame time from ImGui delta time (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepytina authored and Kenix3 committed Nov 28, 2023
1 parent f0f30c6 commit 5388a12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/window/gui/StatsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void StatsWindow::InitElement() {

void StatsWindow::DrawElement() {
const float framerate = ImGui::GetIO().Framerate;
const float deltatime = ImGui::GetIO().DeltaTime;
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
ImGui::Begin("Debug Stats", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing);

Expand All @@ -29,7 +30,7 @@ void StatsWindow::DrawElement() {
#else
ImGui::Text("Platform: Unknown");
#endif
ImGui::Text("Status: %.3f ms/frame (%.1f FPS)", 1000.0f / framerate, framerate);
ImGui::Text("Status: %.3f ms/frame (%.1f FPS)", deltatime * 1000.0f, framerate);
ImGui::End();
ImGui::PopStyleColor();
}
Expand Down

0 comments on commit 5388a12

Please sign in to comment.