Disabled non-blurred backgrounds when rotating screen 90 or 270 degrees.

This commit is contained in:
Leon Styhre 2023-02-21 18:39:56 +01:00
parent c2790f5c2f
commit b335901ee6
3 changed files with 28 additions and 11 deletions

View file

@ -728,16 +728,29 @@ void GuiMenu::openUIOptions()
// Blur background when the menu is open. // Blur background when the menu is open.
auto menuBlurBackground = std::make_shared<SwitchComponent>(); auto menuBlurBackground = std::make_shared<SwitchComponent>();
menuBlurBackground->setState(Settings::getInstance()->getBool("MenuBlurBackground")); if (mRenderer->getScreenRotation() == 90 || mRenderer->getScreenRotation() == 270) {
s->addWithLabel("BLUR BACKGROUND WHEN MENU IS OPEN", menuBlurBackground); // TODO: Add support for non-blurred background when rotating screen 90 or 270 degrees.
s->addSaveFunc([menuBlurBackground, s] { menuBlurBackground->setState(true);
if (menuBlurBackground->getState() != s->addWithLabel("BLUR BACKGROUND WHEN MENU IS OPEN", menuBlurBackground);
Settings::getInstance()->getBool("MenuBlurBackground")) { menuBlurBackground->setEnabled(false);
Settings::getInstance()->setBool("MenuBlurBackground", menuBlurBackground->getState()); menuBlurBackground->setOpacity(DISABLED_OPACITY);
s->setNeedsSaving(); menuBlurBackground->getParent()
s->setInvalidateCachedBackground(); ->getChild(menuBlurBackground->getChildIndex() - 1)
} ->setOpacity(DISABLED_OPACITY);
}); }
else {
menuBlurBackground->setState(Settings::getInstance()->getBool("MenuBlurBackground"));
s->addWithLabel("BLUR BACKGROUND WHEN MENU IS OPEN", menuBlurBackground);
s->addSaveFunc([menuBlurBackground, s] {
if (menuBlurBackground->getState() !=
Settings::getInstance()->getBool("MenuBlurBackground")) {
Settings::getInstance()->setBool("MenuBlurBackground",
menuBlurBackground->getState());
s->setNeedsSaving();
s->setInvalidateCachedBackground();
}
});
}
// Display pillarboxes (and letterboxes) for videos in the gamelists. // Display pillarboxes (and letterboxes) for videos in the gamelists.
auto gamelistVideoPillarbox = std::make_shared<SwitchComponent>(); auto gamelistVideoPillarbox = std::make_shared<SwitchComponent>();

View file

@ -46,6 +46,7 @@ private:
void openOtherOptions(); void openOtherOptions();
void openQuitMenu(); void openQuitMenu();
Renderer* mRenderer;
MenuComponent mMenu; MenuComponent mMenu;
TextComponent mVersion; TextComponent mVersion;
}; };

View file

@ -505,7 +505,10 @@ void Window::render()
// of iterations relative to the screen resolution. // of iterations relative to the screen resolution.
Renderer::postProcessingParams backgroundParameters; Renderer::postProcessingParams backgroundParameters;
if (Settings::getInstance()->getBool("MenuBlurBackground")) { // TODO: Add support for non-blurred background when rotating screen 90 or 270
// degrees.
if (Settings::getInstance()->getBool("MenuBlurBackground") ||
mRenderer->getScreenRotation() == 90 || mRenderer->getScreenRotation() == 270) {
const float resolutionModifier {mRenderer->getScreenResolutionModifier()}; const float resolutionModifier {mRenderer->getScreenResolutionModifier()};
// clang-format off // clang-format off
if (resolutionModifier < 1) if (resolutionModifier < 1)