Skip to content

Commit

Permalink
🐛 fixed GameSettings/UI/Preset combo not working.
Browse files Browse the repository at this point in the history
  • Loading branch information
ohlidalp authored and CuriousMike56 committed Jan 23, 2025
1 parent cca5cab commit 9dda22c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion source/main/gui/GUIUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,15 @@ void RoR::DrawGTextEdit(CVar* cvar, const char* label, Str<1000>& buf)
}
}

void RoR::DrawGCombo(CVar* cvar, const char* label, const char* values)
bool RoR::DrawGCombo(CVar* cvar, const char* label, const char* values)
{
int selection = cvar->getInt();
if (ImGui::Combo(label, &selection, values))
{
cvar->setVal(selection);
return true;
}
return false;
}

Ogre::TexturePtr RoR::FetchIcon(const char* name)
Expand Down
2 changes: 1 addition & 1 deletion source/main/gui/GUIUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void DrawGFloatBox(CVar* cvar, const char* label);

void DrawGTextEdit(CVar* cvar, const char* label, Str<1000>& buf);

void DrawGCombo(CVar* cvar, const char* label, const char* values);
bool DrawGCombo(CVar* cvar, const char* label, const char* values);

Ogre::TexturePtr FetchIcon(const char* name);

Expand Down
5 changes: 2 additions & 3 deletions source/main/gui/panels/GUI_GameSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,13 +616,12 @@ void GameSettings::SetVisible(bool v)
void GameSettings::DrawUiPresetCombo()
{
ImGui::PushID("uiPreset");


DrawGCombo(App::ui_preset, _LC("TopMenubar", "UI Preset"), m_cached_uipreset_combo_string.c_str());
if (ImGui::IsItemEdited())
if (DrawGCombo(App::ui_preset, _LC("TopMenubar", "UI Preset"), m_cached_uipreset_combo_string.c_str()))
{
App::GetGuiManager()->ApplyUiPreset();
}

if (ImGui::IsItemHovered())
{
ImGui::BeginTooltip();
Expand Down

0 comments on commit 9dda22c

Please sign in to comment.