mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Merge pull request #170 from hex007/separate-carousel-transition
Move Carousel transition to separate switch
This commit is contained in:
commit
acf4223f96
|
@ -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<SwitchComponent>(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<std::string> >(mWindow, "TRANSITION STYLE", false);
|
||||
std::vector<std::string> 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);
|
||||
|
|
|
@ -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<float>(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<float>(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<float>(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<float>(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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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]
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue