Added an option to disable the blurring of the background when opening menus.

This commit is contained in:
Leon Styhre 2021-03-18 19:46:45 +01:00
parent 06f88093c6
commit a46222030c
3 changed files with 43 additions and 20 deletions

View file

@ -331,6 +331,19 @@ void GuiMenu::openUISettings()
s->setNeedsSaving(); s->setNeedsSaving();
} }
}); });
// Blur background when the menu is open.
auto menu_blur_background = std::make_shared<SwitchComponent>(mWindow);
menu_blur_background->setState(Settings::getInstance()->getBool("MenuBlurBackground"));
s->addWithLabel("BLUR BACKGROUND WHEN MENU IS OPEN", menu_blur_background);
s->addSaveFunc([menu_blur_background, s] {
if (menu_blur_background->getState() !=
Settings::getInstance()->getBool("MenuBlurBackground")) {
Settings::getInstance()->setBool("MenuBlurBackground",
menu_blur_background->getState());
s->setNeedsSaving();
}
});
#endif #endif
// Display pillarboxes (and letterboxes) for videos in the gamelists. // Display pillarboxes (and letterboxes) for videos in the gamelists.

View file

@ -116,6 +116,7 @@ void Settings::setDefaults()
mStringMap["UIMode"] = { "full", "full" }; mStringMap["UIMode"] = { "full", "full" };
mStringMap["DefaultSortOrder"] = { "filename, ascending", "filename, ascending" }; mStringMap["DefaultSortOrder"] = { "filename, ascending", "filename, ascending" };
mStringMap["MenuOpeningEffect"] = { "scale-up", "scale-up" }; mStringMap["MenuOpeningEffect"] = { "scale-up", "scale-up" };
mBoolMap["MenuBlurBackground"] = { true, true };
mBoolMap["GamelistVideoPillarbox"] = { true, true }; mBoolMap["GamelistVideoPillarbox"] = { true, true };
mBoolMap["GamelistVideoScanlines"] = { true, true }; mBoolMap["GamelistVideoScanlines"] = { true, true };
mBoolMap["FoldersOnTop"] = { true, true }; mBoolMap["FoldersOnTop"] = { true, true };

View file

@ -333,6 +333,8 @@ void Window::render()
// Defocus the background using multiple passes of gaussian blur, with the number // Defocus the background using multiple passes of gaussian blur, with the number
// of iterations relative to the screen resolution. // of iterations relative to the screen resolution.
Renderer::shaderParameters backgroundParameters; Renderer::shaderParameters backgroundParameters;
if (Settings::getInstance()->getBool("MenuBlurBackground")) {
float heightModifier = Renderer::getScreenHeightModifier(); float heightModifier = Renderer::getScreenHeightModifier();
if (heightModifier < 1) if (heightModifier < 1)
@ -356,6 +358,13 @@ void Window::render()
Renderer::shaderPostprocessing(Renderer::SHADER_BLUR_HORIZONTAL | Renderer::shaderPostprocessing(Renderer::SHADER_BLUR_HORIZONTAL |
Renderer::SHADER_BLUR_VERTICAL | Renderer::SHADER_DIM, Renderer::SHADER_BLUR_VERTICAL | Renderer::SHADER_DIM,
backgroundParameters, processedTexture); backgroundParameters, processedTexture);
}
else {
// Dim the background slightly.
backgroundParameters.fragmentDimValue = 0.60f;
Renderer::shaderPostprocessing(
Renderer::SHADER_DIM, backgroundParameters, processedTexture);
}
mPostprocessedBackground->initFromPixels(processedTexture, mPostprocessedBackground->initFromPixels(processedTexture,
Renderer::getScreenWidth(), Renderer::getScreenHeight()); Renderer::getScreenWidth(), Renderer::getScreenHeight());