From def6b7611674feb7f134f48eaa3f13520c3de464 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 17 Apr 2025 20:54:38 +1000 Subject: [PATCH] FullscreenUI: Make menu item borders optional --- src/core/fullscreen_ui.cpp | 10 ++++++++++ src/util/imgui_fullscreen.cpp | 9 +++++++-- src/util/imgui_fullscreen.h | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/core/fullscreen_ui.cpp b/src/core/fullscreen_ui.cpp index 4ee0565be..6c4923733 100644 --- a/src/core/fullscreen_ui.cpp +++ b/src/core/fullscreen_ui.cpp @@ -738,6 +738,7 @@ bool FullscreenUI::Initialize() ImGuiFullscreen::SetAnimations(Host::GetBaseBoolSettingValue("Main", "FullscreenUIAnimations", true)); ImGuiFullscreen::SetSmoothScrolling(Host::GetBaseBoolSettingValue("Main", "FullscreenUISmoothScrolling", true)); + ImGuiFullscreen::SetMenuBorders(Host::GetBaseBoolSettingValue("Main", "FullscreenUIMenuBorders", true)); ImGuiFullscreen::UpdateLayoutScale(); if (Host::GetBaseBoolSettingValue("Main", "FullscreenUIDisplayPSIcons", false)) @@ -4234,6 +4235,13 @@ void FullscreenUI::DrawInterfaceSettingsPage() ImGuiFullscreen::SetSmoothScrolling(bsi->GetBoolValue("Main", "FullscreenUISmoothScrolling", true)); } + if (DrawToggleSetting(bsi, FSUI_ICONVSTR(ICON_FA_BORDER_ALL, "Menu Borders"), + FSUI_VSTR("Draws a border around the currently-selected item for readability."), "Main", + "FullscreenUIMenuBorders", true)) + { + ImGuiFullscreen::SetMenuBorders(bsi->GetBoolValue("Main", "FullscreenUIMenuBorders", true)); + } + MenuHeading(FSUI_VSTR("Behavior")); DrawToggleSetting( @@ -9271,6 +9279,7 @@ TRANSLATE_NOOP("FullscreenUI", "Downloads covers from a user-specified URL templ TRANSLATE_NOOP("FullscreenUI", "Downsamples the rendered image prior to displaying it. Can improve overall image quality in mixed 2D/3D games."); TRANSLATE_NOOP("FullscreenUI", "Downsampling"); TRANSLATE_NOOP("FullscreenUI", "Downsampling Display Scale"); +TRANSLATE_NOOP("FullscreenUI", "Draws a border around the currently-selected item for readability."); TRANSLATE_NOOP("FullscreenUI", "Duck icon by icons8 (https://icons8.com/icon/74847/platforms.undefined.short-title)"); TRANSLATE_NOOP("FullscreenUI", "DuckStation is a free simulator/emulator of the Sony PlayStation(TM) console, focusing on playability, speed, and long-term maintainability."); TRANSLATE_NOOP("FullscreenUI", "Dump Replaced Textures"); @@ -9449,6 +9458,7 @@ TRANSLATE_NOOP("FullscreenUI", "Memory Card Port {}"); TRANSLATE_NOOP("FullscreenUI", "Memory Card Settings"); TRANSLATE_NOOP("FullscreenUI", "Memory Card {} Type"); TRANSLATE_NOOP("FullscreenUI", "Menu Background"); +TRANSLATE_NOOP("FullscreenUI", "Menu Borders"); TRANSLATE_NOOP("FullscreenUI", "Merge Multi-Disc Games"); TRANSLATE_NOOP("FullscreenUI", "Merges multi-disc games into one item in the game list."); TRANSLATE_NOOP("FullscreenUI", "Minimal Output Latency"); diff --git a/src/util/imgui_fullscreen.cpp b/src/util/imgui_fullscreen.cpp index 4217d8042..1ba38c1ce 100644 --- a/src/util/imgui_fullscreen.cpp +++ b/src/util/imgui_fullscreen.cpp @@ -328,6 +328,11 @@ void ImGuiFullscreen::SetSmoothScrolling(bool enabled) UIStyle.SmoothScrolling = enabled; } +void ImGuiFullscreen::SetMenuBorders(bool enabled) +{ + UIStyle.MenuBorders = enabled; +} + const std::shared_ptr& ImGuiFullscreen::GetPlaceholderTexture() { return s_state.placeholder_texture; @@ -1279,7 +1284,7 @@ void ImGuiFullscreen::BeginMenuButtons(u32 num_items /* = 0 */, float y_align /* ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(x_padding, y_padding)); ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f); - ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(UIStyle.MenuBorders ? 1.0f : 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, LayoutScale(LAYOUT_MENU_BUTTON_SPACING))); if (y_align != 0.0f) @@ -2303,7 +2308,7 @@ bool ImGuiFullscreen::BeginHorizontalMenu(const char* name, const ImVec2& positi ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(item_padding, item_padding)); ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f); - ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(1.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, LayoutScale(UIStyle.MenuBorders ? 1.0f : 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(item_spacing, 0.0f)); if (!BeginFullscreenWindow(position, size, name, bg_color, 0.0f, ImVec2())) diff --git a/src/util/imgui_fullscreen.h b/src/util/imgui_fullscreen.h index d00bf6672..498f4315a 100644 --- a/src/util/imgui_fullscreen.h +++ b/src/util/imgui_fullscreen.h @@ -88,6 +88,7 @@ struct ALIGN_TO_CACHE_LINE UIStyles bool Animations; bool SmoothScrolling; + bool MenuBorders; }; extern UIStyles UIStyle; @@ -177,6 +178,7 @@ bool Initialize(const char* placeholder_image_path); void SetTheme(std::string_view theme); void SetAnimations(bool enabled); void SetSmoothScrolling(bool enabled); +void SetMenuBorders(bool enabled); void SetFonts(ImFont* medium_font, ImFont* large_font); bool UpdateLayoutScale();