Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fixed GameSettings/UI/Preset combo not working. #3218

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading