From b33a03fe83136bf6348d896cecd7ad852d22281f Mon Sep 17 00:00:00 2001 From: Aloshi Date: Wed, 30 Apr 2014 12:40:25 -0500 Subject: [PATCH] Transition style now also affects launch transition. "Fade" only does a fade. "Slide" does the old move camera + fade effect. --- src/views/ViewController.cpp | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/views/ViewController.cpp b/src/views/ViewController.cpp index caf420b31..11b4f87ed 100644 --- a/src/views/ViewController.cpp +++ b/src/views/ViewController.cpp @@ -112,14 +112,32 @@ void ViewController::launch(FileData* game, Eigen::Vector3f center) center += mCurrentView->getPosition(); stopAnimation(1); // make sure the fade in isn't still playing mLockInput = true; - setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 1500), 0, [this, origCamera, center, game] + + if(Settings::getInstance()->getString("TransitionStyle") == "fade") { - game->getSystem()->launchGame(mWindow, game); - mCamera = origCamera; - mLockInput = false; - setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 600), 0, nullptr, true); - this->onFileChanged(game, FILE_METADATA_CHANGED); - }); + // fade out, launch game, fade back in + auto fadeFunc = [this](float t) { + t -= 1; + mFadeOpacity = lerp(0.0f, 1.0f, t*t*t + 1); + }; + setAnimation(new LambdaAnimation(fadeFunc, 1500), 0, [this, game, fadeFunc] + { + game->getSystem()->launchGame(mWindow, game); + mLockInput = false; + setAnimation(new LambdaAnimation(fadeFunc, 1500), 0, nullptr, true); + this->onFileChanged(game, FILE_METADATA_CHANGED); + }); + }else{ + // move camera to zoom in on center + fade out, launch game, come back in + setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 1500), 0, [this, origCamera, center, game] + { + game->getSystem()->launchGame(mWindow, game); + mCamera = origCamera; + mLockInput = false; + setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 600), 0, nullptr, true); + this->onFileChanged(game, FILE_METADATA_CHANGED); + }); + } } std::shared_ptr ViewController::getGameListView(SystemData* system)