mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-24 23:25:38 +00:00
Added a 'renderDuringTransitions' property to the image element
This commit is contained in:
parent
183862d974
commit
3abd8d9035
|
@ -416,6 +416,28 @@ void GamelistView::render(const glm::mat4& parentTrans)
|
|||
const ViewController::State viewState {ViewController::getInstance()->getState()};
|
||||
bool stationaryApplicable {false};
|
||||
|
||||
auto renderChildFunc = [this, &viewState](int i, glm::mat4 trans) {
|
||||
if (getChild(i)->getRenderDuringTransitions()) {
|
||||
getChild(i)->render(trans);
|
||||
}
|
||||
else {
|
||||
bool renderChild {false};
|
||||
if (!ViewController::getInstance()->isCameraMoving())
|
||||
renderChild = true;
|
||||
else if (viewState.previouslyViewed == ViewController::ViewMode::NOTHING)
|
||||
renderChild = true;
|
||||
else if (viewState.viewing == viewState.previouslyViewed)
|
||||
renderChild = true;
|
||||
else if (static_cast<ViewTransitionAnimation>(Settings::getInstance()->getInt(
|
||||
"TransitionsGamelistToSystem")) != ViewTransitionAnimation::SLIDE &&
|
||||
viewState.viewing == ViewController::ViewMode::SYSTEM_SELECT)
|
||||
renderChild = true;
|
||||
|
||||
if (renderChild)
|
||||
getChild(i)->render(trans);
|
||||
}
|
||||
};
|
||||
|
||||
// If it's the startup animation, then don't apply stationary properties.
|
||||
if (viewState.previouslyViewed == ViewController::ViewMode::NOTHING)
|
||||
stationaryApplicable = false;
|
||||
|
@ -467,11 +489,11 @@ void GamelistView::render(const glm::mat4& parentTrans)
|
|||
if (viewState.getSystem() != mRoot->getSystem())
|
||||
continue;
|
||||
mRenderer->popClipRect();
|
||||
getChild(i)->render(mRenderer->getIdentity());
|
||||
renderChildFunc(i, mRenderer->getIdentity());
|
||||
clipRectFunc();
|
||||
}
|
||||
else {
|
||||
getChild(i)->render(trans);
|
||||
renderChildFunc(i, trans);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1476,10 +1476,33 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
|||
glm::ivec2 {static_cast<int>(mSize.x), static_cast<int>(mSize.y)});
|
||||
};
|
||||
|
||||
auto renderChildFunc = [this, &viewState](GuiComponent* child, glm::mat4 trans) {
|
||||
if (child->getRenderDuringTransitions()) {
|
||||
child->render(trans);
|
||||
}
|
||||
else {
|
||||
bool renderChild {false};
|
||||
if (!ViewController::getInstance()->isCameraMoving())
|
||||
renderChild = true;
|
||||
else if (viewState.previouslyViewed == ViewController::ViewMode::NOTHING)
|
||||
renderChild = true;
|
||||
else if (viewState.viewing == viewState.previouslyViewed)
|
||||
renderChild = true;
|
||||
else if (static_cast<ViewTransitionAnimation>(
|
||||
Settings::getInstance()->getInt("TransitionsSystemToGamelist")) !=
|
||||
ViewTransitionAnimation::SLIDE &&
|
||||
viewState.viewing == ViewController::ViewMode::GAMELIST)
|
||||
renderChild = true;
|
||||
|
||||
if (renderChild)
|
||||
child->render(trans);
|
||||
}
|
||||
};
|
||||
|
||||
clipRectFunc();
|
||||
|
||||
if (mSystemElements.size() > static_cast<size_t>(index)) {
|
||||
for (auto child : mSystemElements[index].children) {
|
||||
for (GuiComponent* child : mSystemElements[index].children) {
|
||||
bool renderChild {true};
|
||||
bool childStationary {false};
|
||||
if (stationaryApplicable) {
|
||||
|
@ -1520,11 +1543,11 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
|||
if (renderChild) {
|
||||
if (childStationary) {
|
||||
mRenderer->popClipRect();
|
||||
child->render(mRenderer->getIdentity());
|
||||
renderChildFunc(child, mRenderer->getIdentity());
|
||||
clipRectFunc();
|
||||
}
|
||||
else {
|
||||
child->render(elementTrans);
|
||||
renderChildFunc(child, elementTrans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1534,11 +1557,11 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
|||
if (renderChild) {
|
||||
if (childStationary) {
|
||||
mRenderer->popClipRect();
|
||||
child->render(mRenderer->getIdentity());
|
||||
renderChildFunc(child, mRenderer->getIdentity());
|
||||
clipRectFunc();
|
||||
}
|
||||
else {
|
||||
child->render(elementTrans);
|
||||
renderChildFunc(child, elementTrans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ GuiComponent::GuiComponent()
|
|||
, mRotationOrigin {0.5f, 0.5f}
|
||||
, mSize {0.0f, 0.0f}
|
||||
, mStationary {Stationary::NEVER}
|
||||
, mRenderDuringTransitions {true}
|
||||
, mBrightness {0.0f}
|
||||
, mOpacity {1.0f}
|
||||
, mSaturation {1.0f}
|
||||
|
|
|
@ -117,6 +117,7 @@ public:
|
|||
void setRotationOrigin(glm::vec2 origin) { setRotationOrigin(origin.x, origin.y); }
|
||||
|
||||
const Stationary getStationary() const { return mStationary; }
|
||||
const bool getRenderDuringTransitions() const { return mRenderDuringTransitions; }
|
||||
|
||||
virtual glm::vec2 getSize() const { return mSize; }
|
||||
void setSize(const glm::vec2& size) { setSize(size.x, size.y); }
|
||||
|
@ -400,6 +401,7 @@ protected:
|
|||
glm::vec2 mRotationOrigin;
|
||||
glm::vec2 mSize;
|
||||
Stationary mStationary;
|
||||
bool mRenderDuringTransitions;
|
||||
|
||||
float mBrightness;
|
||||
float mOpacity;
|
||||
|
|
|
@ -275,6 +275,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"rotation", FLOAT},
|
||||
{"rotationOrigin", NORMALIZED_PAIR},
|
||||
{"stationary", STRING},
|
||||
{"renderDuringTransitions", BOOLEAN},
|
||||
{"flipHorizontal", BOOLEAN},
|
||||
{"flipVertical", BOOLEAN},
|
||||
{"path", PATH},
|
||||
|
|
|
@ -557,6 +557,9 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
<< element.substr(6) << "\" defined as \"" << stationary << "\"";
|
||||
}
|
||||
|
||||
if (elem->has("renderDuringTransitions"))
|
||||
mRenderDuringTransitions = elem->get<bool>("renderDuringTransitions");
|
||||
|
||||
// Enable linear interpolation by default if element is arbitrarily rotated.
|
||||
if (properties & ThemeFlags::ROTATION && elem->has("rotation")) {
|
||||
const float rotation {std::abs(elem->get<float>("rotation"))};
|
||||
|
|
Loading…
Reference in a new issue