Skip to content

Commit

Permalink
New cvar ui_hide_gui tracking the U hotkey
Browse files Browse the repository at this point in the history
This is for scripts to monitor and reflect.
Note that currently only the dashboard overlay and top state-notification boxes respect this setting, not windows in general.
  • Loading branch information
ohlidalp committed Oct 1, 2023
1 parent ca95d12 commit 91a1e14
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions source/main/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ CVar* flexbody_defrag_invert_lookup;
// GUI
CVar* ui_show_live_repair_controls;
CVar* ui_preset;
CVar* ui_hide_gui;

// Instance management
void SetCacheSystem (CacheSystem* obj) { g_cache_system = obj; }
Expand Down
1 change: 1 addition & 0 deletions source/main/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ extern CVar* flexbody_defrag_invert_lookup;
// GUI
extern CVar* ui_show_live_repair_controls; //!< bool
extern CVar* ui_preset; //!< enum `RoR::UiPreset`
extern CVar* ui_hide_gui; //!< bool; The 'hide GUI' hotkey state

// ------------------------------------------------------------------------------------------------
// Global objects
Expand Down
6 changes: 3 additions & 3 deletions source/main/gui/GUIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void GUIManager::DrawSimGuiBuffered(GfxActor* player_gfx_actor)

if (!this->ConsoleWindow.IsVisible())
{
if (!m_hide_gui)
if (!App::ui_hide_gui->getBool())
{
this->ChatBox.Draw(); // Messages must be always visible
}
Expand Down Expand Up @@ -287,7 +287,7 @@ void GUIManager::SetSceneManagerForGuiRendering(Ogre::SceneManager* scene_manage

void GUIManager::SetGuiHidden(bool hidden)
{
m_hide_gui = hidden;
App::ui_hide_gui->setVal(hidden);
App::GetOverlayWrapper()->showDashboardOverlays(!hidden, App::GetGameContext()->GetPlayerActor());
if (hidden)
{
Expand Down Expand Up @@ -399,7 +399,7 @@ void GUIManager::SetupImGui()

void GUIManager::DrawCommonGui()
{
if (App::mp_state->getEnum<MpState>() == MpState::CONNECTED && !m_hide_gui)
if (App::mp_state->getEnum<MpState>() == MpState::CONNECTED && !App::ui_hide_gui->getBool())
{
this->MpClientList.Draw();
}
Expand Down
3 changes: 1 addition & 2 deletions source/main/gui/GUIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class GUIManager
void DrawCommonGui();

void SetGuiHidden(bool visible);
bool IsGuiHidden() const { return m_hide_gui; }
bool IsGuiHidden() const { return App::ui_hide_gui->getBool(); }

void SetSceneManagerForGuiRendering(Ogre::SceneManager* scene_manager);

Expand All @@ -180,7 +180,6 @@ class GUIManager

MyGUI::Gui* m_mygui = nullptr;
MyGUI::OgrePlatform* m_mygui_platform = nullptr;
bool m_hide_gui = false;
OgreImGui m_imgui;
GuiTheme m_theme;
bool m_gui_kb_capture_queued = false; //!< Resets and accumulates every frame
Expand Down
1 change: 1 addition & 0 deletions source/main/system/CVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ void Console::cVarSetupBuiltins()

App::ui_show_live_repair_controls = this->cVarCreate("ui_show_live_repair_controls", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true");
App::ui_preset = this->cVarCreate("ui_preset", "", CVAR_ARCHIVE | CVAR_TYPE_INT, "0"/*(int)UiPreset::NOVICE*/);
App::ui_hide_gui = this->cVarCreate("ui_hide_gui", "", CVAR_TYPE_BOOL, "false");
}

CVar* Console::cVarCreate(std::string const& name, std::string const& long_name,
Expand Down

0 comments on commit 91a1e14

Please sign in to comment.