From 2a4d9d334d9b6fa65b3be2701d72115affb89467 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 9 Sep 2022 17:52:20 +0200 Subject: [PATCH] Gamelist fade animations are now cancelled on certain navigation actions. --- es-app/src/views/GamelistBase.cpp | 9 +++++++- es-app/src/views/GamelistView.h | 34 +++++++++++++++++++++-------- es-app/src/views/ViewController.cpp | 2 +- es-core/src/GuiComponent.h | 2 +- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/es-app/src/views/GamelistBase.cpp b/es-app/src/views/GamelistBase.cpp index 12a1ed831..9c30f14a0 100644 --- a/es-app/src/views/GamelistBase.cpp +++ b/es-app/src/views/GamelistBase.cpp @@ -72,6 +72,7 @@ bool GamelistBase::input(InputConfig* config, Input input) pauseViewVideos(); ViewController::getInstance()->cancelViewTransitions(); stopListScrolling(); + stopGamelistFadeAnimations(); launch(cursor); } else { @@ -93,6 +94,7 @@ bool GamelistBase::input(InputConfig* config, Input input) pauseViewVideos(); ViewController::getInstance()->cancelViewTransitions(); stopListScrolling(); + stopGamelistFadeAnimations(); launch(child); return true; } @@ -142,6 +144,7 @@ bool GamelistBase::input(InputConfig* config, Input input) mCursorStack.top()->getParent()); setCursor(mCursorStack.top()); stopListScrolling(); + stopGamelistFadeAnimations(); if (mCursorStack.size() > 0) mCursorStack.pop(); if (mRoot->getSystem()->getThemeFolder() == "custom-collections") @@ -152,6 +155,7 @@ bool GamelistBase::input(InputConfig* config, Input input) muteViewVideos(); onFocusLost(); stopListScrolling(); + stopGamelistFadeAnimations(); SystemData* systemToView = getCursor()->getSystem(); if (systemToView->isCustomCollection() && systemToView->getRootFolder()->getParent()) @@ -184,6 +188,7 @@ bool GamelistBase::input(InputConfig* config, Input input) } else if (mRoot->getSystem()->isGameSystem()) { stopListScrolling(); + stopGamelistFadeAnimations(); ViewController::getInstance()->cancelViewTransitions(); NavigationSounds::getInstance().playThemeNavigationSound(SCROLLSOUND); mWindow->startMediaViewer(getCursor()); @@ -196,6 +201,7 @@ bool GamelistBase::input(InputConfig* config, Input input) muteViewVideos(); onFocusLost(); stopListScrolling(); + stopGamelistFadeAnimations(); ViewController::getInstance()->goToNextGamelist(); return true; } @@ -206,6 +212,7 @@ bool GamelistBase::input(InputConfig* config, Input input) muteViewVideos(); onFocusLost(); stopListScrolling(); + stopGamelistFadeAnimations(); ViewController::getInstance()->goToPrevGamelist(); return true; } @@ -476,7 +483,7 @@ bool GamelistBase::input(InputConfig* config, Input input) ViewController::getInstance()->cancelViewTransitions(); stopListScrolling(); pauseViewVideos(); - stopScrollFadeIn(); + stopGamelistFadeAnimations(); mWindow->pushGui(new GuiGamelistOptions(this->mRoot->getSystem())); return true; } diff --git a/es-app/src/views/GamelistView.h b/es-app/src/views/GamelistView.h index a9c1c6acd..0da692e55 100644 --- a/es-app/src/views/GamelistView.h +++ b/es-app/src/views/GamelistView.h @@ -69,16 +69,32 @@ public: video->muteVideoPlayer(); } - void stopScrollFadeIn() override + void stopGamelistFadeAnimations() override { - for (auto& image : mImageComponents) { - if (image->getScrollFadeIn()) - image->finishAnimation(0); - } - for (auto& video : mVideoComponents) { - if (video->getScrollFadeIn()) - video->finishAnimation(0); - } + for (auto& comp : mTextComponents) + comp->finishAnimation(0); + for (auto& comp : mDateTimeComponents) + comp->finishAnimation(0); + for (auto& comp : mImageComponents) + comp->finishAnimation(0); + for (auto& comp : mStaticVideoComponents) + comp->finishAnimation(0); + for (auto& comp : mVideoComponents) + comp->finishAnimation(0); + for (auto& comp : mLottieAnimComponents) + comp->finishAnimation(0); + for (auto& comp : mGIFAnimComponents) + comp->finishAnimation(0); + for (auto& comp : mBadgeComponents) + comp->finishAnimation(0); + for (auto& comp : mRatingComponents) + comp->finishAnimation(0); + for (auto& comp : mContainerComponents) + comp->finishAnimation(0); + for (auto& comp : mContainerTextComponents) + comp->finishAnimation(0); + for (auto& comp : mGamelistInfoComponents) + comp->finishAnimation(0); } const std::shared_ptr getTheme() const { return mTheme; } diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index e29c5fd7e..a80dd5e9b 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -855,7 +855,7 @@ bool ViewController::input(InputConfig* config, Input input) mCurrentView->stopListScrolling(); // Pause all videos as they would otherwise continue to play beneath the menu. mCurrentView->pauseViewVideos(); - mCurrentView->stopScrollFadeIn(); + mCurrentView->stopGamelistFadeAnimations(); // Finally, if the camera is currently moving, reset its position. cancelViewTransitions(); diff --git a/es-core/src/GuiComponent.h b/es-core/src/GuiComponent.h index 109496a08..03dc787f9 100644 --- a/es-core/src/GuiComponent.h +++ b/es-core/src/GuiComponent.h @@ -210,7 +210,7 @@ public: void stopAllAnimations(); void cancelAllAnimations(); - virtual void stopScrollFadeIn() {} + virtual void stopGamelistFadeAnimations() {} virtual bool isListScrolling() { return false; } virtual void stopListScrolling() {} virtual const float getOpacity() const { return mOpacity; }