diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index 45268d4f5..e1f3eb31a 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -169,12 +169,12 @@ void SystemView::render(const glm::mat4& parentTrans) if (mPrimary == nullptr) return; // Nothing to render. - bool fade {false}; + bool transitionFade {false}; if (mNavigated && mMaxFade) - fade = true; + transitionFade = true; - if (!fade) + if (!transitionFade) renderElements(parentTrans, false); glm::mat4 trans {getTransform() * parentTrans}; @@ -187,7 +187,7 @@ void SystemView::render(const glm::mat4& parentTrans) mPrimary->render(trans); mRenderer->popClipRect(); - if (!fade || mLegacyMode) + if (!mPrimary->getFadeAbovePrimary() || !transitionFade) renderElements(parentTrans, true); } @@ -1258,22 +1258,29 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary) if ((mFadeTransitions || element->getDimming() != 1.0f) && element->getZIndex() < primaryZIndex) element->setDimming(1.0f - mFadeOpacity); - if (mFadeTransitions && isAnimationPlaying(0)) - element->setOpacity(1.0f - mFadeOpacity); - else - element->setOpacity(1.0f); - if (mFadeTransitions && mNavigated && mMaxFade) - continue; + if (mFadeTransitions && mPrimary->getFadeAbovePrimary()) { + if (mFadeTransitions && isAnimationPlaying(0)) + element->setOpacity(1.0f - mFadeOpacity); + else + element->setOpacity(1.0f); + } + element->render(elementTrans); } } else if (!mLegacyMode && mSystemElements.size() > static_cast(index)) { for (auto child : mSystemElements[index].children) { - if (abovePrimary && child->getZIndex() > primaryZIndex) { - if (mFadeTransitions || child->getOpacity() != 1.0f) - child->setOpacity(1.0f - mFadeOpacity); + if (abovePrimary && (child->getZIndex() > primaryZIndex)) { + if (mFadeTransitions && mPrimary->getFadeAbovePrimary()) { + if (mFadeTransitions || child->getOpacity() != 1.0f) + child->setOpacity(1.0f - mFadeOpacity); + } + else { + child->setOpacity(1.0f); + } child->render(elementTrans); } + else if (!abovePrimary && child->getZIndex() <= primaryZIndex) { if (mFadeTransitions || child->getDimming() != 1.0f) child->setDimming(1.0f - mFadeOpacity); diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index fffc41aae..2a1c9c48c 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -299,6 +299,7 @@ std::map> {"fontSize", FLOAT}, {"letterCase", STRING}, {"lineSpacing", FLOAT}, + {"fadeAbovePrimary", BOOLEAN}, {"zIndex", FLOAT}, {"legacyZIndexMode", STRING}}}, // For backward compatibility with legacy themes. {"textlist", @@ -326,6 +327,7 @@ std::map> {"lineSpacing", FLOAT}, {"indicators", STRING}, {"collectionIndicators", STRING}, + {"fadeAbovePrimary", BOOLEAN}, {"zIndex", FLOAT}}}, {"gameselector", {{"selection", STRING}, diff --git a/es-core/src/components/primary/CarouselComponent.h b/es-core/src/components/primary/CarouselComponent.h index 974110e6d..d6ae0d15b 100644 --- a/es-core/src/components/primary/CarouselComponent.h +++ b/es-core/src/components/primary/CarouselComponent.h @@ -104,6 +104,7 @@ private: int getCursor() override { return mCursor; } const size_t getNumEntries() override { return mEntries.size(); } + const bool getFadeAbovePrimary() const override { return mFadeAbovePrimary; } Renderer* mRenderer; std::function mCursorChangedCallback; @@ -139,6 +140,7 @@ private: bool mLinearInterpolation; bool mInstantItemTransitions; bool mItemAxisHorizontal; + bool mFadeAbovePrimary; float mItemScale; float mItemRotation; glm::vec2 mItemRotationOrigin; @@ -185,6 +187,7 @@ CarouselComponent::CarouselComponent() , mLinearInterpolation {false} , mInstantItemTransitions {false} , mItemAxisHorizontal {false} + , mFadeAbovePrimary {false} , mItemScale {1.2f} , mItemRotation {7.5f} , mItemRotationOrigin {-3.0f, 0.5f} @@ -1244,6 +1247,9 @@ void CarouselComponent::applyTheme(const std::shared_ptr& theme, } } + if (elem->has("fadeAbovePrimary")) + mFadeAbovePrimary = elem->get("fadeAbovePrimary"); + GuiComponent::applyTheme(theme, view, element, ALL); mSize.x = glm::clamp(mSize.x, mRenderer->getScreenWidth() * 0.05f, diff --git a/es-core/src/components/primary/PrimaryComponent.h b/es-core/src/components/primary/PrimaryComponent.h index 55d8ca4e5..1a399785d 100644 --- a/es-core/src/components/primary/PrimaryComponent.h +++ b/es-core/src/components/primary/PrimaryComponent.h @@ -42,6 +42,7 @@ public: virtual void setCursorChangedCallback(const std::function& func) = 0; virtual int getCursor() = 0; virtual const size_t getNumEntries() = 0; + virtual const bool getFadeAbovePrimary() const = 0; // Functions used by some primary components. virtual void onDemandTextureLoad() {} diff --git a/es-core/src/components/primary/TextListComponent.h b/es-core/src/components/primary/TextListComponent.h index 910dcef56..ad6e5b046 100644 --- a/es-core/src/components/primary/TextListComponent.h +++ b/es-core/src/components/primary/TextListComponent.h @@ -146,6 +146,7 @@ private: int getCursor() override { return mCursor; } const size_t getNumEntries() override { return mEntries.size(); } + const bool getFadeAbovePrimary() const override { return mFadeAbovePrimary; } Renderer* mRenderer; std::function mCancelTransitionsCallback; @@ -167,6 +168,7 @@ private: std::string mIndicators; std::string mCollectionIndicators; bool mLegacyMode; + bool mFadeAbovePrimary; bool mUppercase; bool mLowercase; bool mCapitalize; @@ -199,6 +201,7 @@ TextListComponent::TextListComponent() , mIndicators {"symbols"} , mCollectionIndicators {"symbols"} , mLegacyMode {false} + , mFadeAbovePrimary {false} , mUppercase {false} , mLowercase {false} , mCapitalize {false} @@ -657,7 +660,7 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, if (elem->has("selectorImagePath")) { std::string path {elem->get("selectorImagePath")}; - bool tile = elem->has("selectorImageTile") && elem->get("selectorImageTile"); + bool tile {elem->has("selectorImageTile") && elem->get("selectorImageTile")}; mSelectorImage.setImage(path, tile); mSelectorImage.setSize(mSize.x, mSelectorHeight); mSelectorImage.setResize(mSize.x, mSelectorHeight); @@ -667,6 +670,9 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, else { mSelectorImage.setImage(""); } + + if (elem->has("fadeAbovePrimary")) + mFadeAbovePrimary = elem->get("fadeAbovePrimary"); } template void TextListComponent::onCursorChanged(const CursorState& state)