Fixed an issue with the slide transitions if there were only two game systems.

This commit is contained in:
Leon Styhre 2021-01-01 21:45:51 +01:00
parent d13b249570
commit 287c6ea36e
2 changed files with 13 additions and 2 deletions

View file

@ -71,6 +71,7 @@ ViewController::ViewController(
mFadeOpacity(0), mFadeOpacity(0),
mCancelledTransition(false), mCancelledTransition(false),
mLockInput(false), mLockInput(false),
mNextSystem(false),
mGameToLaunch(nullptr) mGameToLaunch(nullptr)
{ {
mState.viewing = NOTHING; mState.viewing = NOTHING;
@ -266,6 +267,7 @@ void ViewController::goToNextGameList()
SystemData* system = getState().getSystem(); SystemData* system = getState().getSystem();
assert(system); assert(system);
NavigationSounds::getInstance()->playThemeNavigationSound(QUICKSYSSELECTSOUND); NavigationSounds::getInstance()->playThemeNavigationSound(QUICKSYSSELECTSOUND);
mNextSystem = true;
goToGameList(system->getNext()); goToGameList(system->getNext());
} }
@ -275,6 +277,7 @@ void ViewController::goToPrevGameList()
SystemData* system = getState().getSystem(); SystemData* system = getState().getSystem();
assert(system); assert(system);
NavigationSounds::getInstance()->playThemeNavigationSound(QUICKSYSSELECTSOUND); NavigationSounds::getInstance()->playThemeNavigationSound(QUICKSYSSELECTSOUND);
mNextSystem = false;
goToGameList(system->getPrev()); goToGameList(system->getPrev());
} }
@ -353,6 +356,10 @@ void ViewController::goToGameList(SystemData* system)
Vector3f currentPosition = mCurrentView->getPosition(); Vector3f currentPosition = mCurrentView->getPosition();
mWrapPreviousPositionX = currentPosition.x(); mWrapPreviousPositionX = currentPosition.x();
float offsetX = getGameListView(system)->getPosition().x(); float offsetX = getGameListView(system)->getPosition().x();
// 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(); offsetX += Renderer::getScreenWidth();
currentPosition.x() = offsetX; currentPosition.x() = offsetX;
mCurrentView->setPosition(currentPosition); mCurrentView->setPosition(currentPosition);
@ -363,6 +370,9 @@ void ViewController::goToGameList(SystemData* system)
Vector3f currentPosition = mCurrentView->getPosition(); Vector3f currentPosition = mCurrentView->getPosition();
mWrapPreviousPositionX = currentPosition.x(); mWrapPreviousPositionX = currentPosition.x();
float offsetX = getGameListView(system)->getPosition().x(); float offsetX = getGameListView(system)->getPosition().x();
if (SystemData::sSystemVector.size() == 2 && !mNextSystem)
offsetX += Renderer::getScreenWidth();
else
offsetX -= Renderer::getScreenWidth(); offsetX -= Renderer::getScreenWidth();
currentPosition.x() = offsetX; currentPosition.x() = offsetX;
mCurrentView->setPosition(currentPosition); mCurrentView->setPosition(currentPosition);

View file

@ -134,6 +134,7 @@ private:
float mFadeOpacity; float mFadeOpacity;
bool mCancelledTransition; // Needed only for the Fade transition style. bool mCancelledTransition; // Needed only for the Fade transition style.
bool mLockInput; bool mLockInput;
bool mNextSystem;
FileData* mGameToLaunch; FileData* mGameToLaunch;
State mState; State mState;