From 107c7473740cecb27ddde30d6f34b1eaa4cd3c36 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 27 Sep 2020 14:41:59 +0200 Subject: [PATCH] Fixed a regression where the graying-out of menu entries didn't work. --- es-core/src/Window.cpp | 5 +++-- es-core/src/components/ComponentList.cpp | 1 - es-core/src/components/NinePatchComponent.cpp | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/es-core/src/Window.cpp b/es-core/src/Window.cpp index 45c07f2a4..ed39d2004 100644 --- a/es-core/src/Window.cpp +++ b/es-core/src/Window.cpp @@ -336,9 +336,10 @@ void Window::render() } if (Settings::getInstance()->getString("MenuOpeningEffect") == "fade-in") { // Fade-in menu. - if (mTopOpacity < 255) + if (mTopOpacity < 255) { mTopOpacity = Math::clamp(mTopOpacity+15, 0, 255); - top->setOpacity(mTopOpacity); + top->setOpacity(mTopOpacity); + } } #endif diff --git a/es-core/src/components/ComponentList.cpp b/es-core/src/components/ComponentList.cpp index 3dd76fa2d..37d118430 100644 --- a/es-core/src/components/ComponentList.cpp +++ b/es-core/src/components/ComponentList.cpp @@ -229,7 +229,6 @@ void ComponentList::render(const Transform4x4f& parentTrans) } } else { - it->component->setOpacity(mOpacity); it->component->render(trans); } } diff --git a/es-core/src/components/NinePatchComponent.cpp b/es-core/src/components/NinePatchComponent.cpp index 5322ab38b..a288e6dc7 100644 --- a/es-core/src/components/NinePatchComponent.cpp +++ b/es-core/src/components/NinePatchComponent.cpp @@ -118,6 +118,12 @@ void NinePatchComponent::render(const Transform4x4f& parentTrans) mVertices[0].shaders = Renderer::SHADER_OPACITY; mVertices[0].opacity = mOpacity / 255.0; } + else if (mVertices[0].shaders & Renderer::SHADER_OPACITY) { + // We have reached full opacity, so disable the opacity shader and set + // the vertex opacity to 1.0. + mVertices[0].shaders ^= Renderer::SHADER_OPACITY; + mVertices[0].opacity = 1.0; + } mTexture->bind(); Renderer::drawTriangleStrips(&mVertices[0], 6*9, trans); }