Removed the fade-in menu opening effect and enabled the scale-up effect when using OpenGL ES.

This commit is contained in:
Leon Styhre 2021-06-22 17:52:57 +02:00
parent c8af5816a3
commit a9617686b6
2 changed files with 10 additions and 21 deletions

View file

@ -331,17 +331,16 @@ void GuiMenu::openUIOptions()
}
});
#if defined(USE_OPENGL_21)
// Open menu effect.
auto menu_opening_effect = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "MENU OPENING EFFECT", false);
std::vector<std::string> menu_effects;
menu_effects.push_back("scale-up");
menu_effects.push_back("fade-in");
menu_effects.push_back("none");
for (auto it = menu_effects.cbegin(); it != menu_effects.cend(); it++)
menu_opening_effect->add(*it, *it, Settings::getInstance()->
getString("MenuOpeningEffect") == *it);
std::string selectedMenuEffect = Settings::getInstance()->getString("MenuOpeningEffect");
menu_opening_effect->add("SCALE-UP", "scale-up", selectedMenuEffect == "scale-up");
menu_opening_effect->add("NONE", "none", selectedMenuEffect == "none");
// If there are no objects returned, then there must be a manually modified entry in the
// configuration file. Simply set the opening effect to "scale-up" in this case.
if (menu_opening_effect->getSelectedObjects().size() == 0)
menu_opening_effect->selectEntry(0);
s->addWithLabel("MENU OPENING EFFECT", menu_opening_effect);
s->addSaveFunc([menu_opening_effect, s] {
if (menu_opening_effect->getSelected() !=
@ -351,7 +350,6 @@ void GuiMenu::openUIOptions()
s->setNeedsSaving();
}
});
#endif
// Launch screen duration.
auto launch_screen_duration = std::make_shared<OptionListComponent<std::string>>

View file

@ -445,8 +445,8 @@ void Window::render()
// std::chrono::duration_cast<std::chrono::milliseconds>
// (backgroundEndTime - backgroundStartTime).count() << " ms";
}
// Fade in the cached background, unless the menu is set to open without any animation.
if (Settings::getInstance()->getString("MenuOpeningEffect") != "none") {
// Fade in the cached background if the menu opening effect has been set to scale-up.
if (Settings::getInstance()->getString("MenuOpeningEffect") == "scale-up") {
mBackgroundOverlay->setOpacity(mBackgroundOverlayOpacity);
if (mBackgroundOverlayOpacity < 255)
mBackgroundOverlayOpacity = Math::clamp(mBackgroundOverlayOpacity + 30, 0, 255);
@ -455,8 +455,7 @@ void Window::render()
mBackgroundOverlay->render(transform);
#if defined(USE_OPENGL_21)
// Menu opening effects (scale-up and fade-in).
// Scale-up menu opening effect.
if (Settings::getInstance()->getString("MenuOpeningEffect") == "scale-up") {
if (mTopScale < 1.0f) {
mTopScale = Math::clamp(mTopScale + 0.07f, 0.0f, 1.0f);
@ -466,14 +465,6 @@ void Window::render()
top->setScale(mTopScale);
}
}
if (Settings::getInstance()->getString("MenuOpeningEffect") == "fade-in") {
// Fade-in menu.
if (mTopOpacity < 255) {
mTopOpacity = Math::clamp(mTopOpacity + 15, 0, 255);
top->setOpacity(mTopOpacity);
}
}
#endif
if (!mRenderLaunchScreen)
top->render(transform);