mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added a fadeAbovePrimary property to control whether elements above the system view carousel and textlist should be rendered during fade transitions.
This commit is contained in:
parent
577ed366b4
commit
06fd76abc3
|
@ -169,12 +169,12 @@ void SystemView::render(const glm::mat4& parentTrans)
|
||||||
if (mPrimary == nullptr)
|
if (mPrimary == nullptr)
|
||||||
return; // Nothing to render.
|
return; // Nothing to render.
|
||||||
|
|
||||||
bool fade {false};
|
bool transitionFade {false};
|
||||||
|
|
||||||
if (mNavigated && mMaxFade)
|
if (mNavigated && mMaxFade)
|
||||||
fade = true;
|
transitionFade = true;
|
||||||
|
|
||||||
if (!fade)
|
if (!transitionFade)
|
||||||
renderElements(parentTrans, false);
|
renderElements(parentTrans, false);
|
||||||
glm::mat4 trans {getTransform() * parentTrans};
|
glm::mat4 trans {getTransform() * parentTrans};
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ void SystemView::render(const glm::mat4& parentTrans)
|
||||||
mPrimary->render(trans);
|
mPrimary->render(trans);
|
||||||
mRenderer->popClipRect();
|
mRenderer->popClipRect();
|
||||||
|
|
||||||
if (!fade || mLegacyMode)
|
if (!mPrimary->getFadeAbovePrimary() || !transitionFade)
|
||||||
renderElements(parentTrans, true);
|
renderElements(parentTrans, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1258,22 +1258,29 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
||||||
if ((mFadeTransitions || element->getDimming() != 1.0f) &&
|
if ((mFadeTransitions || element->getDimming() != 1.0f) &&
|
||||||
element->getZIndex() < primaryZIndex)
|
element->getZIndex() < primaryZIndex)
|
||||||
element->setDimming(1.0f - mFadeOpacity);
|
element->setDimming(1.0f - mFadeOpacity);
|
||||||
if (mFadeTransitions && isAnimationPlaying(0))
|
if (mFadeTransitions && mPrimary->getFadeAbovePrimary()) {
|
||||||
element->setOpacity(1.0f - mFadeOpacity);
|
if (mFadeTransitions && isAnimationPlaying(0))
|
||||||
else
|
element->setOpacity(1.0f - mFadeOpacity);
|
||||||
element->setOpacity(1.0f);
|
else
|
||||||
if (mFadeTransitions && mNavigated && mMaxFade)
|
element->setOpacity(1.0f);
|
||||||
continue;
|
}
|
||||||
|
|
||||||
element->render(elementTrans);
|
element->render(elementTrans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!mLegacyMode && mSystemElements.size() > static_cast<size_t>(index)) {
|
else if (!mLegacyMode && mSystemElements.size() > static_cast<size_t>(index)) {
|
||||||
for (auto child : mSystemElements[index].children) {
|
for (auto child : mSystemElements[index].children) {
|
||||||
if (abovePrimary && child->getZIndex() > primaryZIndex) {
|
if (abovePrimary && (child->getZIndex() > primaryZIndex)) {
|
||||||
if (mFadeTransitions || child->getOpacity() != 1.0f)
|
if (mFadeTransitions && mPrimary->getFadeAbovePrimary()) {
|
||||||
child->setOpacity(1.0f - mFadeOpacity);
|
if (mFadeTransitions || child->getOpacity() != 1.0f)
|
||||||
|
child->setOpacity(1.0f - mFadeOpacity);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
child->setOpacity(1.0f);
|
||||||
|
}
|
||||||
child->render(elementTrans);
|
child->render(elementTrans);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!abovePrimary && child->getZIndex() <= primaryZIndex) {
|
else if (!abovePrimary && child->getZIndex() <= primaryZIndex) {
|
||||||
if (mFadeTransitions || child->getDimming() != 1.0f)
|
if (mFadeTransitions || child->getDimming() != 1.0f)
|
||||||
child->setDimming(1.0f - mFadeOpacity);
|
child->setDimming(1.0f - mFadeOpacity);
|
||||||
|
|
|
@ -299,6 +299,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"fontSize", FLOAT},
|
{"fontSize", FLOAT},
|
||||||
{"letterCase", STRING},
|
{"letterCase", STRING},
|
||||||
{"lineSpacing", FLOAT},
|
{"lineSpacing", FLOAT},
|
||||||
|
{"fadeAbovePrimary", BOOLEAN},
|
||||||
{"zIndex", FLOAT},
|
{"zIndex", FLOAT},
|
||||||
{"legacyZIndexMode", STRING}}}, // For backward compatibility with legacy themes.
|
{"legacyZIndexMode", STRING}}}, // For backward compatibility with legacy themes.
|
||||||
{"textlist",
|
{"textlist",
|
||||||
|
@ -326,6 +327,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"lineSpacing", FLOAT},
|
{"lineSpacing", FLOAT},
|
||||||
{"indicators", STRING},
|
{"indicators", STRING},
|
||||||
{"collectionIndicators", STRING},
|
{"collectionIndicators", STRING},
|
||||||
|
{"fadeAbovePrimary", BOOLEAN},
|
||||||
{"zIndex", FLOAT}}},
|
{"zIndex", FLOAT}}},
|
||||||
{"gameselector",
|
{"gameselector",
|
||||||
{{"selection", STRING},
|
{{"selection", STRING},
|
||||||
|
|
|
@ -104,6 +104,7 @@ private:
|
||||||
|
|
||||||
int getCursor() override { return mCursor; }
|
int getCursor() override { return mCursor; }
|
||||||
const size_t getNumEntries() override { return mEntries.size(); }
|
const size_t getNumEntries() override { return mEntries.size(); }
|
||||||
|
const bool getFadeAbovePrimary() const override { return mFadeAbovePrimary; }
|
||||||
|
|
||||||
Renderer* mRenderer;
|
Renderer* mRenderer;
|
||||||
std::function<void(CursorState state)> mCursorChangedCallback;
|
std::function<void(CursorState state)> mCursorChangedCallback;
|
||||||
|
@ -139,6 +140,7 @@ private:
|
||||||
bool mLinearInterpolation;
|
bool mLinearInterpolation;
|
||||||
bool mInstantItemTransitions;
|
bool mInstantItemTransitions;
|
||||||
bool mItemAxisHorizontal;
|
bool mItemAxisHorizontal;
|
||||||
|
bool mFadeAbovePrimary;
|
||||||
float mItemScale;
|
float mItemScale;
|
||||||
float mItemRotation;
|
float mItemRotation;
|
||||||
glm::vec2 mItemRotationOrigin;
|
glm::vec2 mItemRotationOrigin;
|
||||||
|
@ -185,6 +187,7 @@ CarouselComponent<T>::CarouselComponent()
|
||||||
, mLinearInterpolation {false}
|
, mLinearInterpolation {false}
|
||||||
, mInstantItemTransitions {false}
|
, mInstantItemTransitions {false}
|
||||||
, mItemAxisHorizontal {false}
|
, mItemAxisHorizontal {false}
|
||||||
|
, mFadeAbovePrimary {false}
|
||||||
, mItemScale {1.2f}
|
, mItemScale {1.2f}
|
||||||
, mItemRotation {7.5f}
|
, mItemRotation {7.5f}
|
||||||
, mItemRotationOrigin {-3.0f, 0.5f}
|
, mItemRotationOrigin {-3.0f, 0.5f}
|
||||||
|
@ -1244,6 +1247,9 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (elem->has("fadeAbovePrimary"))
|
||||||
|
mFadeAbovePrimary = elem->get<bool>("fadeAbovePrimary");
|
||||||
|
|
||||||
GuiComponent::applyTheme(theme, view, element, ALL);
|
GuiComponent::applyTheme(theme, view, element, ALL);
|
||||||
|
|
||||||
mSize.x = glm::clamp(mSize.x, mRenderer->getScreenWidth() * 0.05f,
|
mSize.x = glm::clamp(mSize.x, mRenderer->getScreenWidth() * 0.05f,
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
virtual void setCursorChangedCallback(const std::function<void(CursorState state)>& func) = 0;
|
virtual void setCursorChangedCallback(const std::function<void(CursorState state)>& func) = 0;
|
||||||
virtual int getCursor() = 0;
|
virtual int getCursor() = 0;
|
||||||
virtual const size_t getNumEntries() = 0;
|
virtual const size_t getNumEntries() = 0;
|
||||||
|
virtual const bool getFadeAbovePrimary() const = 0;
|
||||||
|
|
||||||
// Functions used by some primary components.
|
// Functions used by some primary components.
|
||||||
virtual void onDemandTextureLoad() {}
|
virtual void onDemandTextureLoad() {}
|
||||||
|
|
|
@ -146,6 +146,7 @@ private:
|
||||||
|
|
||||||
int getCursor() override { return mCursor; }
|
int getCursor() override { return mCursor; }
|
||||||
const size_t getNumEntries() override { return mEntries.size(); }
|
const size_t getNumEntries() override { return mEntries.size(); }
|
||||||
|
const bool getFadeAbovePrimary() const override { return mFadeAbovePrimary; }
|
||||||
|
|
||||||
Renderer* mRenderer;
|
Renderer* mRenderer;
|
||||||
std::function<void()> mCancelTransitionsCallback;
|
std::function<void()> mCancelTransitionsCallback;
|
||||||
|
@ -167,6 +168,7 @@ private:
|
||||||
std::string mIndicators;
|
std::string mIndicators;
|
||||||
std::string mCollectionIndicators;
|
std::string mCollectionIndicators;
|
||||||
bool mLegacyMode;
|
bool mLegacyMode;
|
||||||
|
bool mFadeAbovePrimary;
|
||||||
bool mUppercase;
|
bool mUppercase;
|
||||||
bool mLowercase;
|
bool mLowercase;
|
||||||
bool mCapitalize;
|
bool mCapitalize;
|
||||||
|
@ -199,6 +201,7 @@ TextListComponent<T>::TextListComponent()
|
||||||
, mIndicators {"symbols"}
|
, mIndicators {"symbols"}
|
||||||
, mCollectionIndicators {"symbols"}
|
, mCollectionIndicators {"symbols"}
|
||||||
, mLegacyMode {false}
|
, mLegacyMode {false}
|
||||||
|
, mFadeAbovePrimary {false}
|
||||||
, mUppercase {false}
|
, mUppercase {false}
|
||||||
, mLowercase {false}
|
, mLowercase {false}
|
||||||
, mCapitalize {false}
|
, mCapitalize {false}
|
||||||
|
@ -657,7 +660,7 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
|
|
||||||
if (elem->has("selectorImagePath")) {
|
if (elem->has("selectorImagePath")) {
|
||||||
std::string path {elem->get<std::string>("selectorImagePath")};
|
std::string path {elem->get<std::string>("selectorImagePath")};
|
||||||
bool tile = elem->has("selectorImageTile") && elem->get<bool>("selectorImageTile");
|
bool tile {elem->has("selectorImageTile") && elem->get<bool>("selectorImageTile")};
|
||||||
mSelectorImage.setImage(path, tile);
|
mSelectorImage.setImage(path, tile);
|
||||||
mSelectorImage.setSize(mSize.x, mSelectorHeight);
|
mSelectorImage.setSize(mSize.x, mSelectorHeight);
|
||||||
mSelectorImage.setResize(mSize.x, mSelectorHeight);
|
mSelectorImage.setResize(mSize.x, mSelectorHeight);
|
||||||
|
@ -667,6 +670,9 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
else {
|
else {
|
||||||
mSelectorImage.setImage("");
|
mSelectorImage.setImage("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (elem->has("fadeAbovePrimary"))
|
||||||
|
mFadeAbovePrimary = elem->get<bool>("fadeAbovePrimary");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> void TextListComponent<T>::onCursorChanged(const CursorState& state)
|
template <typename T> void TextListComponent<T>::onCursorChanged(const CursorState& state)
|
||||||
|
|
Loading…
Reference in a new issue