FullscreenUI: Add option to turn off animations
This commit is contained in:
parent
04c5a9f1b2
commit
3292833fb8
|
@ -729,6 +729,7 @@ bool FullscreenUI::Initialize()
|
|||
if (s_state.tried_to_initialize)
|
||||
return false;
|
||||
|
||||
ImGuiFullscreen::SetAnimations(Host::GetBaseBoolSettingValue("Main", "FullscreenUIAnimations", true));
|
||||
ImGuiFullscreen::SetSmoothScrolling(Host::GetBaseBoolSettingValue("Main", "FullscreenUISmoothScrolling", true));
|
||||
ImGuiFullscreen::UpdateLayoutScale();
|
||||
|
||||
|
@ -809,9 +810,10 @@ void FullscreenUI::BeginTransition(TransitionStartCallback func, float time)
|
|||
std::move(s_state.transition_start_callback)();
|
||||
}
|
||||
|
||||
const float real_time = UIStyle.Animations ? time : 0.0f;
|
||||
s_state.transition_state = TransitionState::Starting;
|
||||
s_state.transition_total_time = time;
|
||||
s_state.transition_remaining_time = time;
|
||||
s_state.transition_total_time = real_time;
|
||||
s_state.transition_remaining_time = real_time;
|
||||
s_state.transition_start_callback = func;
|
||||
UpdateRunIdleState();
|
||||
}
|
||||
|
@ -4177,11 +4179,18 @@ void FullscreenUI::DrawInterfaceSettingsPage()
|
|||
ImGuiFullscreen::SetFullscreenFooterTextIconMapping({});
|
||||
}
|
||||
|
||||
if (DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_WINDOW_RESTORE, "Window Animations"),
|
||||
FSUI_CSTR("Animates windows opening/closing and changes between views in the Big Picture UI."),
|
||||
"Main", "FullscreenUIAnimations", true))
|
||||
{
|
||||
ImGuiFullscreen::SetAnimations(bsi->GetBoolValue("Main", "FullscreenUIAnimations", true));
|
||||
}
|
||||
|
||||
if (DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_LIST, "Smooth Scrolling"),
|
||||
FSUI_CSTR("Enables smooth scrolling of menus in Big Picture UI."), "Main",
|
||||
FSUI_CSTR("Enables smooth scrolling of menus in the Big Picture UI."), "Main",
|
||||
"FullscreenUISmoothScrolling", true))
|
||||
{
|
||||
ImGuiFullscreen::SetSmoothScrolling(bsi->GetBoolValue("Main", "FullscreenUISmoothScrolling", false));
|
||||
ImGuiFullscreen::SetSmoothScrolling(bsi->GetBoolValue("Main", "FullscreenUISmoothScrolling", true));
|
||||
}
|
||||
|
||||
MenuHeading(FSUI_CSTR("Behavior"));
|
||||
|
@ -9023,6 +9032,7 @@ TRANSLATE_NOOP("FullscreenUI", "Alpha Blending");
|
|||
TRANSLATE_NOOP("FullscreenUI", "Always Track Uploads");
|
||||
TRANSLATE_NOOP("FullscreenUI", "An error occurred while deleting empty game settings:\n{}");
|
||||
TRANSLATE_NOOP("FullscreenUI", "An error occurred while saving game settings:\n{}");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Animates windows opening/closing and changes between views in the Big Picture UI.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Appearance");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Apply Image Patches");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Are you sure you want to clear all mappings for this controller?\n\nYou cannot undo this action.");
|
||||
|
@ -9214,7 +9224,7 @@ TRANSLATE_NOOP("FullscreenUI", "Enables depth testing for semi-transparent polyg
|
|||
TRANSLATE_NOOP("FullscreenUI", "Enables dumping of textures to image files, which can be replaced. Not compatible with all games.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Enables loading of cheats for this game from DuckStation's database.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Enables loading of replacement textures. Not compatible with all games.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Enables smooth scrolling of menus in Big Picture UI.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Enables smooth scrolling of menus in the Big Picture UI.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Enables the cheats that are selected below.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Enables the older, less accurate MDEC decoding routines. May be required for old replacement backgrounds to match/load.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Enables the replacement of background textures in supported games.");
|
||||
|
@ -9315,7 +9325,6 @@ TRANSLATE_NOOP("FullscreenUI", "Launch a game from a file, disc, or starts the c
|
|||
TRANSLATE_NOOP("FullscreenUI", "Launch a game from images scanned from your game directories.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Leaderboard Notifications");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Leaderboards");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Leaderboards are not enabled.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Light");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Line Detection");
|
||||
TRANSLATE_NOOP("FullscreenUI", "List Settings");
|
||||
|
@ -9678,6 +9687,7 @@ TRANSLATE_NOOP("FullscreenUI", "When enabled, the minimum supported output laten
|
|||
TRANSLATE_NOOP("FullscreenUI", "When playing a multi-disc game and using per-game (title) memory cards, use a single memory card for all discs.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "When this option is chosen, the clock speed set below will be used.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Widescreen Rendering");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Window Animations");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Wireframe Rendering");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Writes backgrounds that can be replaced to the dump directory.");
|
||||
TRANSLATE_NOOP("FullscreenUI", "Yes, {} now and risk memory card corruption.");
|
||||
|
|
|
@ -212,7 +212,6 @@ struct ALIGN_TO_CACHE_LINE UIState
|
|||
ImGuiDir has_pending_nav_move = ImGuiDir_None;
|
||||
FocusResetType focus_reset_queued = FocusResetType::None;
|
||||
bool initialized = false;
|
||||
bool smooth_scrolling = false;
|
||||
|
||||
LRUCache<std::string, std::shared_ptr<GPUTexture>> texture_cache{128, true};
|
||||
std::shared_ptr<GPUTexture> placeholder_texture;
|
||||
|
@ -319,9 +318,14 @@ void ImGuiFullscreen::Shutdown(bool clear_state)
|
|||
}
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::SetAnimations(bool enabled)
|
||||
{
|
||||
UIStyle.Animations = enabled;
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::SetSmoothScrolling(bool enabled)
|
||||
{
|
||||
s_state.smooth_scrolling = enabled;
|
||||
UIStyle.SmoothScrolling = enabled;
|
||||
}
|
||||
|
||||
const std::shared_ptr<GPUTexture>& ImGuiFullscreen::GetPlaceholderTexture()
|
||||
|
@ -798,7 +802,7 @@ void ImGuiFullscreen::PushResetLayout()
|
|||
ImGui::PushStyleVar(ImGuiStyleVar_ScrollbarRounding, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, LayoutScale(10.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_TabRounding, LayoutScale(4.0f));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ScrollSmooth, s_state.smooth_scrolling ? SMOOTH_SCROLLING_SPEED : 1.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ScrollSmooth, UIStyle.SmoothScrolling ? SMOOTH_SCROLLING_SPEED : 1.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, UIStyle.SecondaryTextColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_TextDisabled, UIStyle.DisabledColor);
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, UIStyle.SecondaryColor);
|
||||
|
@ -1403,7 +1407,7 @@ void ImGuiFullscreen::DrawMenuButtonFrame(const ImVec2& p_min, const ImVec2& p_m
|
|||
ImVec2 frame_max = p_max;
|
||||
|
||||
const ImGuiIO& io = ImGui::GetIO();
|
||||
if (s_state.smooth_scrolling && io.NavVisible && GImGui->CurrentWindow == GImGui->NavWindow)
|
||||
if (UIStyle.Animations && io.NavVisible && GImGui->CurrentWindow == GImGui->NavWindow)
|
||||
{
|
||||
if (!s_state.had_hovered_menu_item || io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f)
|
||||
{
|
||||
|
@ -1775,7 +1779,7 @@ bool ImGuiFullscreen::ToggleButton(const char* title, const char* summary, bool*
|
|||
float t = *v ? 1.0f : 0.0f;
|
||||
ImDrawList* dl = ImGui::GetWindowDrawList();
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.LastActiveId == g.CurrentWindow->GetID(title)) // && g.LastActiveIdTimer < ANIM_SPEED)
|
||||
if (UIStyle.Animations && g.LastActiveId == g.CurrentWindow->GetID(title)) // && g.LastActiveIdTimer < ANIM_SPEED)
|
||||
{
|
||||
static constexpr const float ANIM_SPEED = 0.08f;
|
||||
float t_anim = ImSaturate(g.LastActiveIdTimer / ANIM_SPEED);
|
||||
|
@ -2384,7 +2388,7 @@ void ImGuiFullscreen::PopupDialog::StartClose()
|
|||
return;
|
||||
|
||||
m_state = State::Closing;
|
||||
m_animation_time_remaining = CLOSE_TIME;
|
||||
m_animation_time_remaining = UIStyle.Animations ? CLOSE_TIME : 0.0f;
|
||||
}
|
||||
|
||||
void ImGuiFullscreen::PopupDialog::ClearState()
|
||||
|
@ -2397,7 +2401,7 @@ void ImGuiFullscreen::PopupDialog::SetTitleAndOpen(std::string title)
|
|||
{
|
||||
DebugAssert(!title.empty());
|
||||
m_title = std::move(title);
|
||||
m_animation_time_remaining = OPEN_TIME;
|
||||
m_animation_time_remaining = UIStyle.Animations ? OPEN_TIME : 0.0f;
|
||||
|
||||
if (m_state == State::Inactive)
|
||||
{
|
||||
|
@ -2449,6 +2453,17 @@ bool ImGuiFullscreen::PopupDialog::BeginRender(float scaled_window_padding /* =
|
|||
m_state = State::OpeningTrigger;
|
||||
}
|
||||
|
||||
if (m_state == State::OpeningTrigger)
|
||||
{
|
||||
// need to have the openpopup at the correct level
|
||||
m_state = State::Opening;
|
||||
ImGui::OpenPopup(m_title.c_str());
|
||||
QueueResetFocus(FocusResetType::PopupOpened);
|
||||
|
||||
// hackity hack to disable imgui's background fade animation
|
||||
GImGui->DimBgRatio = UIStyle.Animations ? GImGui->DimBgRatio : 1.0f;
|
||||
}
|
||||
|
||||
// check for animation completion
|
||||
ImVec2 pos_offset = ImVec2(0.0f, 0.0f);
|
||||
float alpha = 1.0f;
|
||||
|
@ -2470,14 +2485,6 @@ bool ImGuiFullscreen::PopupDialog::BeginRender(float scaled_window_padding /* =
|
|||
}
|
||||
else
|
||||
{
|
||||
if (m_state == State::OpeningTrigger)
|
||||
{
|
||||
// need to have the openpopup at the correct level
|
||||
m_state = State::Opening;
|
||||
ImGui::OpenPopup(m_title.c_str());
|
||||
QueueResetFocus(FocusResetType::PopupOpened);
|
||||
}
|
||||
|
||||
// inhibit menu animation while opening, otherwise it jitters
|
||||
ResetMenuButtonFrame();
|
||||
|
||||
|
@ -2532,6 +2539,8 @@ bool ImGuiFullscreen::PopupDialog::BeginRender(float scaled_window_padding /* =
|
|||
{
|
||||
if (popup_open)
|
||||
{
|
||||
// hackity hack to disable imgui's background fade animation
|
||||
GImGui->DimBgRatio = UIStyle.Animations ? GImGui->DimBgRatio : 0.0f;
|
||||
ImGui::CloseCurrentPopup();
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
|
|
@ -79,6 +79,9 @@ struct ALIGN_TO_CACHE_LINE UIStyles
|
|||
float RcpLayoutScale;
|
||||
float LayoutPaddingLeft;
|
||||
float LayoutPaddingTop;
|
||||
|
||||
bool Animations;
|
||||
bool SmoothScrolling;
|
||||
};
|
||||
|
||||
extern UIStyles UIStyle;
|
||||
|
@ -166,6 +169,7 @@ ImRect FitImage(const ImVec2& fit_size, const ImVec2& image_size);
|
|||
bool Initialize(const char* placeholder_image_path);
|
||||
|
||||
void SetTheme(std::string_view theme);
|
||||
void SetAnimations(bool enabled);
|
||||
void SetSmoothScrolling(bool enabled);
|
||||
void SetFonts(ImFont* medium_font, ImFont* large_font);
|
||||
bool UpdateLayoutScale();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
static constexpr ImWchar FA_ICON_RANGE[] = { 0xe06f,0xe070,0xe086,0xe086,0xf002,0xf002,0xf005,0xf005,0xf007,0xf007,0xf00c,0xf00e,0xf011,0xf013,0xf017,0xf017,0xf019,0xf019,0xf01c,0xf01c,0xf021,0xf023,0xf025,0xf026,0xf028,0xf028,0xf02e,0xf02e,0xf030,0xf030,0xf03a,0xf03a,0xf03d,0xf03e,0xf04a,0xf04c,0xf050,0xf050,0xf056,0xf056,0xf059,0xf059,0xf05e,0xf05e,0xf062,0xf063,0xf065,0xf067,0xf071,0xf071,0xf075,0xf075,0xf077,0xf078,0xf07b,0xf07c,0xf083,0xf085,0xf091,0xf091,0xf09c,0xf09c,0xf0ac,0xf0ae,0xf0b2,0xf0b2,0xf0c3,0xf0c3,0xf0c5,0xf0c5,0xf0c7,0xf0c9,0xf0cb,0xf0cb,0xf0d0,0xf0d0,0xf0dc,0xf0dc,0xf0e0,0xf0e0,0xf0e2,0xf0e2,0xf0e7,0xf0e8,0xf0eb,0xf0eb,0xf0f1,0xf0f1,0xf0f3,0xf0f3,0xf0fe,0xf0fe,0xf110,0xf110,0xf11b,0xf11c,0xf140,0xf140,0xf144,0xf144,0xf146,0xf146,0xf14a,0xf14a,0xf15b,0xf15d,0xf191,0xf192,0xf1ab,0xf1ab,0xf1c0,0xf1c0,0xf1c5,0xf1c5,0xf1de,0xf1de,0xf1e6,0xf1e6,0xf1eb,0xf1eb,0xf1f8,0xf1f8,0xf1fb,0xf1fc,0xf201,0xf201,0xf240,0xf240,0xf242,0xf242,0xf245,0xf245,0xf252,0xf252,0xf26c,0xf26c,0xf279,0xf279,0xf2c1,0xf2c1,0xf2d0,0xf2d0,0xf2db,0xf2db,0xf2f1,0xf2f2,0xf302,0xf302,0xf31e,0xf31e,0xf35d,0xf35d,0xf360,0xf360,0xf362,0xf362,0xf3c1,0xf3c1,0xf3fd,0xf3fd,0xf410,0xf410,0xf422,0xf422,0xf424,0xf424,0xf462,0xf462,0xf466,0xf466,0xf4ce,0xf4ce,0xf500,0xf500,0xf517,0xf517,0xf51f,0xf51f,0xf538,0xf538,0xf545,0xf545,0xf547,0xf548,0xf54c,0xf54c,0xf55b,0xf55b,0xf55d,0xf55d,0xf565,0xf565,0xf56e,0xf570,0xf5a2,0xf5a2,0xf5aa,0xf5aa,0xf5ae,0xf5ae,0xf5c7,0xf5c7,0xf5cb,0xf5cb,0xf5e7,0xf5e7,0xf5ee,0xf5ee,0xf61f,0xf61f,0xf65d,0xf65e,0xf6a9,0xf6a9,0xf6cf,0xf6cf,0xf70c,0xf70c,0xf70e,0xf70e,0xf78c,0xf78c,0xf794,0xf794,0xf7a0,0xf7a0,0xf7a4,0xf7a5,0xf7c2,0xf7c2,0xf807,0xf807,0xf815,0xf815,0xf818,0xf818,0xf84c,0xf84c,0xf853,0xf853,0xf87d,0xf87d,0xf8cc,0xf8cc,0x0,0x0 };
|
||||
static constexpr ImWchar FA_ICON_RANGE[] = { 0xe06f,0xe070,0xe086,0xe086,0xf002,0xf002,0xf005,0xf005,0xf007,0xf007,0xf00c,0xf00e,0xf011,0xf013,0xf017,0xf017,0xf019,0xf019,0xf01c,0xf01c,0xf021,0xf023,0xf025,0xf026,0xf028,0xf028,0xf02e,0xf02e,0xf030,0xf030,0xf03a,0xf03a,0xf03d,0xf03e,0xf04a,0xf04c,0xf050,0xf050,0xf056,0xf056,0xf059,0xf059,0xf05e,0xf05e,0xf062,0xf063,0xf065,0xf067,0xf071,0xf071,0xf075,0xf075,0xf077,0xf078,0xf07b,0xf07c,0xf083,0xf085,0xf091,0xf091,0xf09c,0xf09c,0xf0ac,0xf0ae,0xf0b2,0xf0b2,0xf0c3,0xf0c3,0xf0c5,0xf0c5,0xf0c7,0xf0c9,0xf0cb,0xf0cb,0xf0d0,0xf0d0,0xf0dc,0xf0dc,0xf0e0,0xf0e0,0xf0e2,0xf0e2,0xf0e7,0xf0e8,0xf0eb,0xf0eb,0xf0f1,0xf0f1,0xf0f3,0xf0f3,0xf0fe,0xf0fe,0xf110,0xf110,0xf11b,0xf11c,0xf140,0xf140,0xf144,0xf144,0xf146,0xf146,0xf14a,0xf14a,0xf15b,0xf15d,0xf191,0xf192,0xf1ab,0xf1ab,0xf1c0,0xf1c0,0xf1c5,0xf1c5,0xf1de,0xf1de,0xf1e6,0xf1e6,0xf1eb,0xf1eb,0xf1f8,0xf1f8,0xf1fb,0xf1fc,0xf201,0xf201,0xf240,0xf240,0xf242,0xf242,0xf245,0xf245,0xf252,0xf252,0xf26c,0xf26c,0xf279,0xf279,0xf2c1,0xf2c1,0xf2d0,0xf2d0,0xf2d2,0xf2d2,0xf2db,0xf2db,0xf2f1,0xf2f2,0xf302,0xf302,0xf31e,0xf31e,0xf35d,0xf35d,0xf360,0xf360,0xf362,0xf362,0xf3c1,0xf3c1,0xf3fd,0xf3fd,0xf410,0xf410,0xf422,0xf422,0xf424,0xf424,0xf462,0xf462,0xf466,0xf466,0xf4ce,0xf4ce,0xf500,0xf500,0xf517,0xf517,0xf51f,0xf51f,0xf538,0xf538,0xf545,0xf545,0xf547,0xf548,0xf54c,0xf54c,0xf55b,0xf55b,0xf55d,0xf55d,0xf565,0xf565,0xf56e,0xf570,0xf5a2,0xf5a2,0xf5aa,0xf5aa,0xf5ae,0xf5ae,0xf5c7,0xf5c7,0xf5cb,0xf5cb,0xf5e7,0xf5e7,0xf5ee,0xf5ee,0xf61f,0xf61f,0xf65d,0xf65e,0xf6a9,0xf6a9,0xf6cf,0xf6cf,0xf70c,0xf70c,0xf70e,0xf70e,0xf78c,0xf78c,0xf794,0xf794,0xf7a0,0xf7a0,0xf7a4,0xf7a5,0xf7c2,0xf7c2,0xf807,0xf807,0xf815,0xf815,0xf818,0xf818,0xf84c,0xf84c,0xf853,0xf853,0xf87d,0xf87d,0xf8cc,0xf8cc,0x0,0x0 };
|
||||
|
||||
static constexpr ImWchar PF_ICON_RANGE[] = { 0x2196,0x2199,0x219e,0x21a3,0x21b0,0x21b3,0x21ba,0x21c3,0x21c7,0x21ca,0x21d0,0x21d4,0x21e0,0x21e3,0x21e6,0x21e8,0x21eb,0x21eb,0x21ed,0x21ee,0x21f7,0x21f8,0x21fa,0x21fb,0x221a,0x221b,0x227a,0x227f,0x2284,0x2284,0x22bf,0x22c8,0x2349,0x2349,0x235e,0x235e,0x2360,0x2361,0x2364,0x2366,0x23b2,0x23b4,0x23cc,0x23cc,0x23ce,0x23ce,0x23f4,0x23f7,0x2427,0x243a,0x243c,0x243e,0x2446,0x2446,0x2460,0x246b,0x248f,0x248f,0x24f5,0x24fd,0x24ff,0x24ff,0x2717,0x2717,0x2753,0x2753,0x278a,0x278e,0x27fc,0x27fc,0xe000,0xe001,0xff21,0xff3a,0x1f52b,0x1f52b,0x0,0x0 };
|
||||
|
||||
|
|
Loading…
Reference in New Issue