Reimplement ImGui Scaling option. (#5124)

This commit is contained in:
Malkierian 2025-03-16 15:00:30 -07:00 committed by GitHub
parent 112fab503f
commit 05ab17d3a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 20 deletions

View file

@ -68,8 +68,6 @@ static std::unordered_map<Ship::WindowBackend, const char*> windowBackendNames =
{ Ship::WindowBackend::FAST3D_SDL_METAL, "Metal" }, { Ship::WindowBackend::FAST3D_SDL_METAL, "Metal" },
}; };
static const char* imguiScaleOptions[4] = { "Small", "Normal", "Large", "X-Large" };
static const char* filters[3] = { static const char* filters[3] = {
#ifdef __WIIU__ #ifdef __WIIU__
"", "",
@ -89,24 +87,6 @@ Ship::WindowBackend configWindowBackend;
extern std::shared_ptr<Ship::GuiWindow> mGfxDebuggerWindow; extern std::shared_ptr<Ship::GuiWindow> mGfxDebuggerWindow;
void DrawSettingsMenu() { void DrawSettingsMenu() {
//if (ImGui::BeginMenu("Settings"))
//{
// if (ImGui::BeginMenu("Graphics")) {
// ImGui::Text("ImGui Menu Scale");
// ImGui::SameLine();
// ImGui::TextColored({ 0.85f, 0.35f, 0.0f, 1.0f }, "(Experimental)");
// if (UIWidgets::EnhancementCombobox(CVAR_SETTING("ImGuiScale"), imguiScaleOptions, 1)) {
// OTRGlobals::Instance->ScaleImGui();
// }
// UIWidgets::Tooltip("Changes the scaling of the ImGui menu elements.");
// // Draw LUS settings menu (such as Overlays Text Font)
// Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings();
// ImGui::EndMenu();
// }
// ImGui::EndMenu();
//}
} }
void SohMenuBar::InitElement() { void SohMenuBar::InitElement() {

View file

@ -15,6 +15,7 @@ namespace SohGui {
extern std::shared_ptr<SohMenu> mSohMenu; extern std::shared_ptr<SohMenu> mSohMenu;
using namespace UIWidgets; using namespace UIWidgets;
static std::unordered_map<int32_t, const char*> languages = {{ LANGUAGE_ENG, "English" }, { LANGUAGE_GER, "German" }, { LANGUAGE_FRA, "French" }}; static std::unordered_map<int32_t, const char*> languages = {{ LANGUAGE_ENG, "English" }, { LANGUAGE_GER, "German" }, { LANGUAGE_FRA, "French" }};
static std::unordered_map<int32_t, const char*> imguiScaleOptions = {{ 0, "Small" }, { 1, "Normal" }, { 2, "Large" }, { 3, "X-Large" }};
const char* GetGameVersionString(uint32_t index) { const char* GetGameVersionString(uint32_t index) {
uint32_t gameVersion = ResourceMgr_GetGameVersion(index); uint32_t gameVersion = ResourceMgr_GetGameVersion(index);
@ -115,6 +116,15 @@ void SohMenu::AddMenuSettings() {
AddWidget(path, "Disable Idle Camera Re-Centering", WIDGET_CVAR_CHECKBOX) AddWidget(path, "Disable Idle Camera Re-Centering", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_SETTING("A11yDisableIdleCam")) .CVar(CVAR_SETTING("A11yDisableIdleCam"))
.Options(CheckboxOptions().Tooltip("Disables the automatic re-centering of the camera when idle.")); .Options(CheckboxOptions().Tooltip("Disables the automatic re-centering of the camera when idle."));
AddWidget(path, "EXPERIMENTAL", WIDGET_SEPARATOR_TEXT)
.Options(WidgetOptions().Color(Colors::Orange));
AddWidget(path, "ImGui Menu Scaling", WIDGET_CVAR_COMBOBOX)
.CVar(CVAR_SETTING("ImGuiScale"))
.Options(ComboboxOptions().ComboMap(imguiScaleOptions).Tooltip("Changes the scaling of the ImGui menu elements.").DefaultIndex(1)
.ComponentAlignment(ComponentAlignment::Right).LabelPosition(LabelPosition::Far))
.Callback([](WidgetInfo& info) {
OTRGlobals::Instance->ScaleImGui();
});
// General - About // General - About
path.column = SECTION_COLUMN_2; path.column = SECTION_COLUMN_2;