From 64effcc69c9ff1e08d8e4edc281b047b1335c286 Mon Sep 17 00:00:00 2001 From: hex007 Date: Wed, 28 Jun 2017 09:50:37 -0700 Subject: [PATCH] Move Carousel transition to separate switch - Removed Simple Slide - Added Switch to control Carousel transition --- es-app/src/guis/GuiMenu.cpp | 7 +++++- es-app/src/views/SystemView.cpp | 37 ++++++++++++----------------- es-app/src/views/ViewController.cpp | 4 ++-- es-core/src/Settings.cpp | 1 + 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 43ced8330..d15ce1897 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -170,12 +170,17 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN s->addWithLabel("QUICK SYSTEM SELECT", quick_sys_select); s->addSaveFunc([quick_sys_select] { Settings::getInstance()->setBool("QuickSystemSelect", quick_sys_select->getState()); }); + // carousel transition option + auto move_carousel = std::make_shared(mWindow); + move_carousel->setState(Settings::getInstance()->getBool("MoveCarousel")); + s->addWithLabel("CAROUSEL TRANSITIONS", move_carousel); + s->addSaveFunc([move_carousel] { Settings::getInstance()->setBool("MoveCarousel", move_carousel->getState()); }); + // transition style auto transition_style = std::make_shared< OptionListComponent >(mWindow, "TRANSITION STYLE", false); 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); diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index 3252c8a5f..df50fd1ef 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -243,12 +243,13 @@ void SystemView::onCursorChanged(const CursorState& state) return; Animation* anim; + bool move_carousel = Settings::getInstance()->getBool("MoveCarousel"); std::string transition_style = Settings::getInstance()->getString("TransitionStyle"); if(transition_style == "fade") { float startExtrasFade = mExtrasFadeOpacity; anim = new LambdaAnimation( - [startExtrasFade, startPos, endPos, posMax, this](float t) + [this, startExtrasFade, startPos, endPos, posMax, move_carousel](float t) { t -= 1; float f = lerp(startPos, endPos, t*t*t + 1); @@ -257,7 +258,7 @@ void SystemView::onCursorChanged(const CursorState& state) if(f >= posMax) f -= posMax; - this->mCamOffset = f; + this->mCamOffset = move_carousel ? f : endPos; t += 1; if(t < 0.3f) @@ -274,7 +275,7 @@ void SystemView::onCursorChanged(const CursorState& state) } else if (transition_style == "slide") { // slide anim = new LambdaAnimation( - [this, startPos, endPos, posMax](float t) + [this, startPos, endPos, posMax, move_carousel](float t) { t -= 1; float f = lerp(startPos, endPos, t*t*t + 1); @@ -283,32 +284,24 @@ void SystemView::onCursorChanged(const CursorState& state) if(f >= posMax) f -= posMax; - this->mCamOffset = f; + this->mCamOffset = move_carousel ? f : endPos; 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, startPos, endPos, posMax, move_carousel ](float t) { - this->mCamOffset = endPos; + t -= 1; + float f = lerp(startPos, endPos, t*t*t + 1); + if(f < 0) + f += posMax; + if(f >= posMax) + f -= posMax; + + this->mCamOffset = move_carousel ? f : endPos; this->mExtrasCamOffset = endPos; - }, 1); + }, move_carousel ? 500 : 1); } diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 7e3c242b6..46f7d02ea 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -189,7 +189,7 @@ void ViewController::playViewTransition() }else{ advanceAnimation(0, (int)(mFadeOpacity * FADE_DURATION)); } - } else if (transition_style == "slide" || transition_style == "simple slide"){ + } else if (transition_style == "slide"){ // slide or simple slide setAnimation(new MoveCameraAnimation(mCamera, target)); updateHelpPrompts(); // update help prompts immediately @@ -246,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 if (transition_style == "slide" || transition_style == "simple slide"){ + } else if (transition_style == "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] { diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index 3f88c8758..4063a9775 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -60,6 +60,7 @@ void Settings::setDefaults() mBoolMap["IgnoreGamelist"] = false; mBoolMap["HideConsole"] = true; mBoolMap["QuickSystemSelect"] = true; + mBoolMap["MoveCarousel"] = true; mBoolMap["SaveGamelistsOnExit"] = true; mBoolMap["Debug"] = false;