mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Fixed an issue when entering a submenu before the parent menu was scaled up.
This commit is contained in:
parent
655340a94c
commit
9d4deefdf4
|
@ -45,7 +45,6 @@ Window::Window()
|
||||||
, mCachedBackground(false)
|
, mCachedBackground(false)
|
||||||
, mInvalidatedCachedBackground(false)
|
, mInvalidatedCachedBackground(false)
|
||||||
, mVideoPlayerCount(0)
|
, mVideoPlayerCount(0)
|
||||||
, mTopOpacity(0)
|
|
||||||
, mTopScale(0.5)
|
, mTopScale(0.5)
|
||||||
, mListScrollOpacity(0)
|
, mListScrollOpacity(0)
|
||||||
, mChangedThemeSet(false)
|
, mChangedThemeSet(false)
|
||||||
|
@ -231,6 +230,20 @@ void Window::input(InputConfig* config, Input input)
|
||||||
return;
|
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 &&
|
if (config->getDeviceId() == DEVICE_KEYBOARD && input.value && input.id == SDLK_g &&
|
||||||
SDL_GetModState() & KMOD_LCTRL && Settings::getInstance()->getBool("Debug")) {
|
SDL_GetModState() & KMOD_LCTRL && Settings::getInstance()->getBool("Debug")) {
|
||||||
// Toggle debug grid with Ctrl-G.
|
// Toggle debug grid with Ctrl-G.
|
||||||
|
@ -475,8 +488,8 @@ void Window::render()
|
||||||
if (mTopScale < 1.0f) {
|
if (mTopScale < 1.0f) {
|
||||||
mTopScale = glm::clamp(mTopScale + 0.07f, 0.0f, 1.0f);
|
mTopScale = glm::clamp(mTopScale + 0.07f, 0.0f, 1.0f);
|
||||||
glm::vec2 topCenter{top->getCenter()};
|
glm::vec2 topCenter{top->getCenter()};
|
||||||
top->setOrigin({0.5f, 0.5f});
|
top->setOrigin(0.5f, 0.5f);
|
||||||
top->setPosition({topCenter.x, topCenter.y, 0.0f});
|
top->setPosition(topCenter.x, topCenter.y, 0.0f);
|
||||||
top->setScale(mTopScale);
|
top->setScale(mTopScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,7 +499,6 @@ void Window::render()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mCachedBackground = false;
|
mCachedBackground = false;
|
||||||
mTopOpacity = 0;
|
|
||||||
mTopScale = 0.5f;
|
mTopScale = 0.5f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,6 @@ private:
|
||||||
int mVideoPlayerCount;
|
int mVideoPlayerCount;
|
||||||
std::mutex mVideoCountMutex;
|
std::mutex mVideoCountMutex;
|
||||||
|
|
||||||
unsigned char mTopOpacity;
|
|
||||||
float mTopScale;
|
float mTopScale;
|
||||||
bool mRenderedHelpPrompts;
|
bool mRenderedHelpPrompts;
|
||||||
bool mChangedThemeSet;
|
bool mChangedThemeSet;
|
||||||
|
|
Loading…
Reference in a new issue