mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Added Lottie animation support to SystemView.
This commit is contained in:
parent
c06dea5d2d
commit
992c39d3a3
|
@ -46,6 +46,8 @@ SystemView::SystemView()
|
|||
mCarousel->setCancelTransitionsCallback([&] {
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
mNavigated = true;
|
||||
for (auto& anim : mSystemElements[mCarousel->getCursor()].lottieAnimComponents)
|
||||
anim->setPauseAnimation(true);
|
||||
});
|
||||
|
||||
populate();
|
||||
|
@ -63,6 +65,12 @@ SystemView::~SystemView()
|
|||
}
|
||||
}
|
||||
|
||||
void SystemView::onTransition()
|
||||
{
|
||||
for (auto& anim : mSystemElements[mCarousel->getCursor()].lottieAnimComponents)
|
||||
anim->setPauseAnimation(true);
|
||||
}
|
||||
|
||||
void SystemView::goToSystem(SystemData* system, bool animate)
|
||||
{
|
||||
mCarousel->setCursor(system);
|
||||
|
@ -75,6 +83,9 @@ void SystemView::goToSystem(SystemData* system, bool animate)
|
|||
for (auto& video : mSystemElements[mCarousel->getCursor()].videoComponents)
|
||||
video->setStaticVideo();
|
||||
|
||||
for (auto& anim : mSystemElements[mCarousel->getCursor()].lottieAnimComponents)
|
||||
anim->resetFileAnimation();
|
||||
|
||||
updateGameSelectors();
|
||||
updateGameCount();
|
||||
startViewVideos();
|
||||
|
@ -138,6 +149,9 @@ void SystemView::update(int deltaTime)
|
|||
for (auto& video : mSystemElements[mCarousel->getCursor()].videoComponents)
|
||||
video->update(deltaTime);
|
||||
|
||||
for (auto& anim : mSystemElements[mCarousel->getCursor()].lottieAnimComponents)
|
||||
anim->update(deltaTime);
|
||||
|
||||
GuiComponent::update(deltaTime);
|
||||
}
|
||||
|
||||
|
@ -217,6 +231,9 @@ void SystemView::onCursorChanged(const CursorState& /*state*/)
|
|||
for (auto& video : mSystemElements[cursor].videoComponents)
|
||||
video->setStaticVideo();
|
||||
|
||||
for (auto& anim : mSystemElements[mCarousel->getCursor()].lottieAnimComponents)
|
||||
anim->resetFileAnimation();
|
||||
|
||||
updateGameSelectors();
|
||||
startViewVideos();
|
||||
updateHelpPrompts();
|
||||
|
@ -410,6 +427,14 @@ void SystemView::populate()
|
|||
ThemeFlags::ALL);
|
||||
elements.children.emplace_back(elements.videoComponents.back().get());
|
||||
}
|
||||
else if (element.second.type == "animation") {
|
||||
elements.lottieAnimComponents.emplace_back(
|
||||
std::make_unique<LottieComponent>());
|
||||
elements.lottieAnimComponents.back()->setDefaultZIndex(35.0f);
|
||||
elements.lottieAnimComponents.back()->applyTheme(
|
||||
theme, "system", element.first, ThemeFlags::ALL);
|
||||
elements.children.emplace_back(elements.lottieAnimComponents.back().get());
|
||||
}
|
||||
else if (element.second.type == "text") {
|
||||
if (element.second.has("systemdata") &&
|
||||
element.second.get<std::string>("systemdata").substr(0, 9) ==
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
SystemView();
|
||||
~SystemView();
|
||||
|
||||
void onTransition() override;
|
||||
void goToSystem(SystemData* system, bool animate);
|
||||
|
||||
bool input(InputConfig* config, Input input) override;
|
||||
|
|
Loading…
Reference in a new issue