FullscreenUI: Make menu item borders optional

This commit is contained in:
Stenzek 2025-04-17 20:54:38 +10:00
parent 5b5eef61d7
commit def6b76116
No known key found for this signature in database
3 changed files with 19 additions and 2 deletions

View File

@ -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");

View File

@ -328,6 +328,11 @@ void ImGuiFullscreen::SetSmoothScrolling(bool enabled)
UIStyle.SmoothScrolling = enabled;
}
void ImGuiFullscreen::SetMenuBorders(bool enabled)
{
UIStyle.MenuBorders = enabled;
}
const std::shared_ptr<GPUTexture>& 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()))

View File

@ -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();