From 287c6ea36e18433cdb6dc17d2b53fc367115ce0a Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 1 Jan 2021 21:45:51 +0100 Subject: [PATCH] Fixed an issue with the slide transitions if there were only two game systems. --- es-app/src/views/ViewController.cpp | 14 ++++++++++++-- es-app/src/views/ViewController.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 6f81c0bc9..1888aa008 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -71,6 +71,7 @@ ViewController::ViewController( mFadeOpacity(0), mCancelledTransition(false), mLockInput(false), + mNextSystem(false), mGameToLaunch(nullptr) { mState.viewing = NOTHING; @@ -266,6 +267,7 @@ void ViewController::goToNextGameList() SystemData* system = getState().getSystem(); assert(system); NavigationSounds::getInstance()->playThemeNavigationSound(QUICKSYSSELECTSOUND); + mNextSystem = true; goToGameList(system->getNext()); } @@ -275,6 +277,7 @@ void ViewController::goToPrevGameList() SystemData* system = getState().getSystem(); assert(system); NavigationSounds::getInstance()->playThemeNavigationSound(QUICKSYSSELECTSOUND); + mNextSystem = false; goToGameList(system->getPrev()); } @@ -353,7 +356,11 @@ void ViewController::goToGameList(SystemData* system) Vector3f currentPosition = mCurrentView->getPosition(); mWrapPreviousPositionX = currentPosition.x(); float offsetX = getGameListView(system)->getPosition().x(); - offsetX += Renderer::getScreenWidth(); + // This is needed to move the camera in the correct direction if there are only two systems. + if (SystemData::sSystemVector.size() == 2 && mNextSystem) + offsetX -= Renderer::getScreenWidth(); + else + offsetX += Renderer::getScreenWidth(); currentPosition.x() = offsetX; mCurrentView->setPosition(currentPosition); mCamera.translation().x() -= offsetX; @@ -363,7 +370,10 @@ void ViewController::goToGameList(SystemData* system) Vector3f currentPosition = mCurrentView->getPosition(); mWrapPreviousPositionX = currentPosition.x(); float offsetX = getGameListView(system)->getPosition().x(); - offsetX -= Renderer::getScreenWidth(); + if (SystemData::sSystemVector.size() == 2 && !mNextSystem) + offsetX += Renderer::getScreenWidth(); + else + offsetX -= Renderer::getScreenWidth(); currentPosition.x() = offsetX; mCurrentView->setPosition(currentPosition); mCamera.translation().x() = -offsetX; diff --git a/es-app/src/views/ViewController.h b/es-app/src/views/ViewController.h index 362b8e1a9..e6a6a1d8d 100644 --- a/es-app/src/views/ViewController.h +++ b/es-app/src/views/ViewController.h @@ -134,6 +134,7 @@ private: float mFadeOpacity; bool mCancelledTransition; // Needed only for the Fade transition style. bool mLockInput; + bool mNextSystem; FileData* mGameToLaunch; State mState;