diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index d7844cccc..6dab2c03e 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -45,7 +45,6 @@ Window::Window() , mCachedBackground(false) , mInvalidatedCachedBackground(false) , mVideoPlayerCount(0) - , mTopOpacity(0) , mTopScale(0.5) , mListScrollOpacity(0) , mChangedThemeSet(false) @@ -231,6 +230,20 @@ void Window::input(InputConfig* config, Input input) return; } + if (config->isMappedTo("a", input) && input.value != 0 && + Settings::getInstance()->getString("MenuOpeningEffect") == "scale-up" && mTopScale < 1.0f && + mGuiStack.size() == 2) { + // The user has entered a submenu when the initial menu screen has not finished scaling + // up. So scale it to full size so it won't be stuck at a smaller size when returning + // from the submenu. + mTopScale = 1.0f; + GuiComponent* menu = mGuiStack.back(); + glm::vec2 menuCenter{menu->getCenter()}; + menu->setOrigin(0.5f, 0.5f); + menu->setPosition(menuCenter.x, menuCenter.y, 0.0f); + menu->setScale(1.0f); + } + if (config->getDeviceId() == DEVICE_KEYBOARD && input.value && input.id == SDLK_g && SDL_GetModState() & KMOD_LCTRL && Settings::getInstance()->getBool("Debug")) { // Toggle debug grid with Ctrl-G. @@ -475,8 +488,8 @@ void Window::render() if (mTopScale < 1.0f) { mTopScale = glm::clamp(mTopScale + 0.07f, 0.0f, 1.0f); glm::vec2 topCenter{top->getCenter()}; - top->setOrigin({0.5f, 0.5f}); - top->setPosition({topCenter.x, topCenter.y, 0.0f}); + top->setOrigin(0.5f, 0.5f); + top->setPosition(topCenter.x, topCenter.y, 0.0f); top->setScale(mTopScale); } } @@ -486,7 +499,6 @@ void Window::render() } else { mCachedBackground = false; - mTopOpacity = 0; mTopScale = 0.5f; } } diff --git a/es-core/src/Window.h b/es-core/src/Window.h index b5d771b79..2f68f7cc2 100644 --- a/es-core/src/Window.h +++ b/es-core/src/Window.h @@ -190,7 +190,6 @@ private: int mVideoPlayerCount; std::mutex mVideoCountMutex; - unsigned char mTopOpacity; float mTopScale; bool mRenderedHelpPrompts; bool mChangedThemeSet;