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 Jan 21, 2025
1 parent a851fb9 commit cca5cab
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 @@ -262,6 +262,7 @@ CVar* flexbody_defrag_invert_lookup;
CVar* ui_show_live_repair_controls;
CVar* ui_show_vehicle_buttons;
CVar* ui_preset;
CVar* ui_hide_gui;

// Instance access
AppContext* GetAppContext () { return &g_app_context; };
Expand Down
1 change: 1 addition & 0 deletions source/main/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ extern CVar* flexbody_defrag_invert_lookup;
extern CVar* ui_show_live_repair_controls; //!< bool
extern CVar* ui_show_vehicle_buttons;
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 @@ -195,7 +195,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 @@ -278,7 +278,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 @@ -390,7 +390,7 @@ void GUIManager::SetupImGui()

void GUIManager::DrawCommonGui()
{
if (App::mp_state->getEnum<MpState>() == MpState::CONNECTED && !m_hide_gui && !this->SurveyMap.IsVisible())
if (App::mp_state->getEnum<MpState>() == MpState::CONNECTED && !App::ui_hide_gui->getBool() && !this->SurveyMap.IsVisible())
{
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 @@ -151,7 +151,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 @@ -176,7 +176,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 @@ -202,6 +202,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_show_vehicle_buttons = this->cVarCreate("ui_show_vehicle_buttons", "Show vehicle buttons menu", 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 cca5cab

Please sign in to comment.