toggle stats

This commit is contained in:
Asuro
2025-03-29 16:20:45 +01:00
parent cdf6a83af6
commit dbc65fec9a
3 changed files with 51 additions and 45 deletions

View File

@@ -1,4 +1,6 @@
SDL/* SDL/*
# !SDL/src bgfx.cmake/*
# bgfx.cmake/*
tinygltf/* tinygltf/*
imgui/*
iconfontheaders/*
tracy/*

View File

@@ -50,6 +50,7 @@ namespace Game
bool ShowImguiDemo = false; bool ShowImguiDemo = false;
uint8_t DebugCardRotation = 0; uint8_t DebugCardRotation = 0;
bool ShortenLogFileNames = true; bool ShortenLogFileNames = true;
bool ShowStats = true;
}; };
struct GameInstance struct GameInstance

View File

@@ -72,14 +72,13 @@ namespace Tools
void RenderDebugUI(Game::GameRendering& rendering) void RenderDebugUI(Game::GameRendering& rendering)
{ {
auto& time = Game::GetInstance().Time; auto& time = Game::GetInstance().Time;
if (rendering.UIVisible == Game::UIVisibilityState::Debug)
{
ZoneScopedN("DebugUI");
auto& shared = Game::GetShared(); auto& shared = Game::GetShared();
auto& debug = Game::GetInstance().DebugData; auto& debug = Game::GetInstance().DebugData;
auto& level = Game::GetInstance().GameLevel; auto& level = Game::GetInstance().GameLevel;
if (rendering.UIVisible == Game::UIVisibilityState::Debug)
{
ZoneScopedN("DebugUI");
if (ImGui::IsMouseClicked(ImGuiMouseButton_Right)) if (ImGui::IsMouseClicked(ImGuiMouseButton_Right))
{ {
debug.DebugCardRotation++; debug.DebugCardRotation++;
@@ -150,6 +149,7 @@ namespace Tools
level.Setup(shared.Game); level.Setup(shared.Game);
} }
ImGui::Checkbox("Show ImGui Demo", &debug.ShowImguiDemo); ImGui::Checkbox("Show ImGui Demo", &debug.ShowImguiDemo);
ImGui::Checkbox("Show Stats", &debug.ShowStats);
if (debug.ShowImguiDemo) ImGui::ShowDemoWindow(&debug.ShowImguiDemo); if (debug.ShowImguiDemo) ImGui::ShowDemoWindow(&debug.ShowImguiDemo);
ImGui::Separator(); ImGui::Separator();
@@ -325,6 +325,8 @@ namespace Tools
} }
ImGui::End(); ImGui::End();
} }
if (debug.ShowStats)
{
ImGui::SetNextWindowPos({0, 0}); ImGui::SetNextWindowPos({0, 0});
if (ImGui::Begin("Stats", if (ImGui::Begin("Stats",
nullptr, nullptr,
@@ -370,6 +372,7 @@ namespace Tools
} }
ImGui::End(); ImGui::End();
} }
}
void MeasureFrameEnd() void MeasureFrameEnd()
{ {
FrameTimes[FrameTimeIdx] = bx::getHPCounter(); FrameTimes[FrameTimeIdx] = bx::getHPCounter();