diff --git a/Runtime/ImGuiConsole.cpp b/Runtime/ImGuiConsole.cpp index 5254031e6..aece73c3a 100644 --- a/Runtime/ImGuiConsole.cpp +++ b/Runtime/ImGuiConsole.cpp @@ -1090,6 +1090,24 @@ void ImGuiConsole::ShowAppMainMenuBar(bool canInspect) { } void ImGuiConsole::PreUpdate() { + if (!m_isInitialized) { + m_isInitialized = true; + m_cvarCommons.m_debugOverlayShowFrameCounter->addListener( + [this](hecl::CVar* c) { m_frameCounter = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowFramerate->addListener([this](hecl::CVar* c) { m_frameRate = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowInGameTime->addListener([this](hecl::CVar* c) { m_inGameTime = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowRoomTimer->addListener([this](hecl::CVar* c) { m_roomTimer = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayPlayerInfo->addListener([this](hecl::CVar* c) { m_playerInfo = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayWorldInfo->addListener([this](hecl::CVar* c) { m_worldInfo = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayAreaInfo->addListener([this](hecl::CVar* c) { m_areaInfo = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayLayerInfo->addListener([this](hecl::CVar* c) { m_layerInfo = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowRandomStats->addListener([this](hecl::CVar* c) { m_randomStats = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowResourceStats->addListener( + [this](hecl::CVar* c) { m_resourceStats = c->toBoolean(); }); + m_cvarCommons.m_debugOverlayShowInput->addListener([this](hecl::CVar* c) { m_showInput = c->toBoolean(); }); + m_cvarMgr.findCVar("developer")->addListener([this](hecl::CVar* c) { m_developer = c->toBoolean(); }); + m_cvarMgr.findCVar("cheats")->addListener([this](hecl::CVar* c) { m_cheats = c->toBoolean(); }); + } // We ned to make sure we have a valid CRandom16 at all times, so lets do that here if (g_StateManager != nullptr && g_StateManager->GetActiveRandom() == nullptr) { g_StateManager->SetActiveRandomToDefault(); diff --git a/Runtime/ImGuiConsole.hpp b/Runtime/ImGuiConsole.hpp index 26975e816..c0ea3e931 100644 --- a/Runtime/ImGuiConsole.hpp +++ b/Runtime/ImGuiConsole.hpp @@ -60,6 +60,7 @@ private: bool m_inspectActiveOnly = false; bool m_inspectCurrentAreaOnly = false; + std::array m_inspectFilterText{}; std::array m_layersFilterText{}; std::array m_cvarFiltersText{}; @@ -76,8 +77,9 @@ private: bool m_randomStats = m_cvarCommons.m_debugOverlayShowRandomStats->toBoolean(); bool m_resourceStats = m_cvarCommons.m_debugOverlayShowResourceStats->toBoolean(); bool m_showInput = m_cvarCommons.m_debugOverlayShowInput->toBoolean(); - const bool m_developer = m_cvarMgr.findCVar("developer")->toBoolean(); - const bool m_cheats = m_cvarMgr.findCVar("cheats")->toBoolean(); + bool m_developer = m_cvarMgr.findCVar("developer")->toBoolean(); + bool m_cheats = m_cvarMgr.findCVar("cheats")->toBoolean(); + bool m_isInitialized = false; int m_debugOverlayCorner = 2; // bottom-left const void* m_currentRoom = nullptr;