diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 103d46c28..0d826ccb1 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -127,6 +127,8 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN std::vector transitions; transitions.push_back("fade"); transitions.push_back("slide"); + transitions.push_back("simple slide"); + transitions.push_back("instant"); for(auto it = transitions.begin(); it != transitions.end(); it++) transition_style->add(*it, *it, Settings::getInstance()->getString("TransitionStyle") == *it); s->addWithLabel("TRANSITION STYLE", transition_style); diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index c7ec55e63..d31df73ef 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -237,7 +237,8 @@ void SystemView::onCursorChanged(const CursorState& state) return; Animation* anim; - if(Settings::getInstance()->getString("TransitionStyle") == "fade") + std::string transition_style = Settings::getInstance()->getString("TransitionStyle"); + if(transition_style == "fade") { float startExtrasFade = mExtrasFadeOpacity; anim = new LambdaAnimation( @@ -264,10 +265,10 @@ void SystemView::onCursorChanged(const CursorState& state) this->mExtrasCamOffset = endPos; }, 500); - } - else{ // slide + } else if (transition_style == "slide") { + // slide anim = new LambdaAnimation( - [startPos, endPos, posMax, this](float t) + [this, startPos, endPos, posMax](float t) { t -= 1; float f = lerp(startPos, endPos, t*t*t + 1); @@ -279,8 +280,32 @@ void SystemView::onCursorChanged(const CursorState& state) this->mCamOffset = f; this->mExtrasCamOffset = f; }, 500); + } else if (transition_style == "simple slide") { + // simple slide + anim = new LambdaAnimation( + [this, startPos, endPos, posMax](float t) + { + t -= 1; + float f = lerp(startPos, endPos, t*t*t + 1); + if(f < 0) + f += posMax; + if(f >= posMax) + f -= posMax; + + this->mCamOffset = f; + this->mExtrasCamOffset = endPos; + }, 500); + } else { + // instant + anim = new LambdaAnimation( + [this, endPos](float t) + { + this->mCamOffset = endPos; + this->mExtrasCamOffset = endPos; + }, 1); } + setAnimation(anim, 0, nullptr, false, 0); } diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index fffed0a4f..7e3c242b6 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -160,7 +160,8 @@ void ViewController::playViewTransition() if(target == -mCamera.translation() && !isAnimationPlaying(0)) return; - if(Settings::getInstance()->getString("TransitionStyle") == "fade") + std::string transition_style = Settings::getInstance()->getString("TransitionStyle"); + if(transition_style == "fade") { // fade // stop whatever's currently playing, leaving mFadeOpacity wherever it is @@ -188,10 +189,18 @@ void ViewController::playViewTransition() }else{ advanceAnimation(0, (int)(mFadeOpacity * FADE_DURATION)); } - }else{ - // slide + } else if (transition_style == "slide" || transition_style == "simple slide"){ + // slide or simple slide setAnimation(new MoveCameraAnimation(mCamera, target)); updateHelpPrompts(); // update help prompts immediately + } else { + // instant + setAnimation(new LambdaAnimation( + [this, target](float t) + { + this->mCamera.translation() = -target; + }, 1)); + updateHelpPrompts(); } } @@ -221,7 +230,8 @@ void ViewController::launch(FileData* game, Eigen::Vector3f center) stopAnimation(1); // make sure the fade in isn't still playing mLockInput = true; - if(Settings::getInstance()->getString("TransitionStyle") == "fade") + std::string transition_style = Settings::getInstance()->getString("TransitionStyle"); + if(transition_style == "fade") { // fade out, launch game, fade back in auto fadeFunc = [this](float t) { @@ -236,7 +246,7 @@ void ViewController::launch(FileData* game, Eigen::Vector3f center) setAnimation(new LambdaAnimation(fadeFunc, 800), 0, nullptr, true); this->onFileChanged(game, FILE_METADATA_CHANGED); }); - }else{ + } else if (transition_style == "slide" || transition_style == "simple slide"){ // 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] { @@ -246,6 +256,15 @@ void ViewController::launch(FileData* game, Eigen::Vector3f center) setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 600), 0, nullptr, true); this->onFileChanged(game, FILE_METADATA_CHANGED); }); + } else { + setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 10), 0, [this, origCamera, center, game] + { + game->getSystem()->launchGame(mWindow, game); + mCamera = origCamera; + mLockInput = false; + setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 10), 0, nullptr, true); + this->onFileChanged(game, FILE_METADATA_CHANGED); + }); } }