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/src
# bgfx.cmake/*
bgfx.cmake/*
tinygltf/*
imgui/*
iconfontheaders/*
tracy/*

View File

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

View File

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