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