mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 17:45:38 +00:00
Added Instant Transition
This commit is contained in:
parent
fb93a4d2b6
commit
2ec037de2f
|
@ -127,6 +127,7 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
|
||||||
std::vector<std::string> transitions;
|
std::vector<std::string> transitions;
|
||||||
transitions.push_back("fade");
|
transitions.push_back("fade");
|
||||||
transitions.push_back("slide");
|
transitions.push_back("slide");
|
||||||
|
transitions.push_back("instant");
|
||||||
transitions.push_back("none");
|
transitions.push_back("none");
|
||||||
for(auto it = transitions.begin(); it != transitions.end(); it++)
|
for(auto it = transitions.begin(); it != transitions.end(); it++)
|
||||||
transition_style->add(*it, *it, Settings::getInstance()->getString("TransitionStyle") == *it);
|
transition_style->add(*it, *it, Settings::getInstance()->getString("TransitionStyle") == *it);
|
||||||
|
|
|
@ -237,7 +237,8 @@ void SystemView::onCursorChanged(const CursorState& state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Animation* anim;
|
Animation* anim;
|
||||||
if(Settings::getInstance()->getString("TransitionStyle") == "fade")
|
std::string transition_style = Settings::getInstance()->getString("TransitionStyle");
|
||||||
|
if(transition_style == "fade")
|
||||||
{
|
{
|
||||||
float startExtrasFade = mExtrasFadeOpacity;
|
float startExtrasFade = mExtrasFadeOpacity;
|
||||||
anim = new LambdaAnimation(
|
anim = new LambdaAnimation(
|
||||||
|
@ -264,7 +265,7 @@ void SystemView::onCursorChanged(const CursorState& state)
|
||||||
this->mExtrasCamOffset = endPos;
|
this->mExtrasCamOffset = endPos;
|
||||||
|
|
||||||
}, 500);
|
}, 500);
|
||||||
} else if (Settings::getInstance()->getString("TransitionStyle") == "slide") {
|
} else if (transition_style == "slide") {
|
||||||
// slide
|
// slide
|
||||||
anim = new LambdaAnimation(
|
anim = new LambdaAnimation(
|
||||||
[this, startPos, endPos, posMax](float t)
|
[this, startPos, endPos, posMax](float t)
|
||||||
|
@ -279,6 +280,21 @@ void SystemView::onCursorChanged(const CursorState& state)
|
||||||
this->mCamOffset = f;
|
this->mCamOffset = f;
|
||||||
this->mExtrasCamOffset = f;
|
this->mExtrasCamOffset = f;
|
||||||
}, 500);
|
}, 500);
|
||||||
|
} else if (transition_style == "instant") {
|
||||||
|
// instant
|
||||||
|
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 {
|
} else {
|
||||||
// None
|
// None
|
||||||
anim = new LambdaAnimation(
|
anim = new LambdaAnimation(
|
||||||
|
|
|
@ -160,7 +160,8 @@ void ViewController::playViewTransition()
|
||||||
if(target == -mCamera.translation() && !isAnimationPlaying(0))
|
if(target == -mCamera.translation() && !isAnimationPlaying(0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(Settings::getInstance()->getString("TransitionStyle") == "fade")
|
std::string transition_style = Settings::getInstance()->getString("TransitionStyle");
|
||||||
|
if(transition_style == "fade")
|
||||||
{
|
{
|
||||||
// fade
|
// fade
|
||||||
// stop whatever's currently playing, leaving mFadeOpacity wherever it is
|
// stop whatever's currently playing, leaving mFadeOpacity wherever it is
|
||||||
|
@ -188,7 +189,7 @@ void ViewController::playViewTransition()
|
||||||
}else{
|
}else{
|
||||||
advanceAnimation(0, (int)(mFadeOpacity * FADE_DURATION));
|
advanceAnimation(0, (int)(mFadeOpacity * FADE_DURATION));
|
||||||
}
|
}
|
||||||
} else if (Settings::getInstance()->getString("TransitionStyle") == "slide"){
|
} else if (transition_style == "slide" || transition_style == "instant"){
|
||||||
// slide
|
// slide
|
||||||
setAnimation(new MoveCameraAnimation(mCamera, target));
|
setAnimation(new MoveCameraAnimation(mCamera, target));
|
||||||
updateHelpPrompts(); // update help prompts immediately
|
updateHelpPrompts(); // update help prompts immediately
|
||||||
|
@ -229,7 +230,8 @@ void ViewController::launch(FileData* game, Eigen::Vector3f center)
|
||||||
stopAnimation(1); // make sure the fade in isn't still playing
|
stopAnimation(1); // make sure the fade in isn't still playing
|
||||||
mLockInput = true;
|
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
|
// fade out, launch game, fade back in
|
||||||
auto fadeFunc = [this](float t) {
|
auto fadeFunc = [this](float t) {
|
||||||
|
@ -244,7 +246,7 @@ void ViewController::launch(FileData* game, Eigen::Vector3f center)
|
||||||
setAnimation(new LambdaAnimation(fadeFunc, 800), 0, nullptr, true);
|
setAnimation(new LambdaAnimation(fadeFunc, 800), 0, nullptr, true);
|
||||||
this->onFileChanged(game, FILE_METADATA_CHANGED);
|
this->onFileChanged(game, FILE_METADATA_CHANGED);
|
||||||
});
|
});
|
||||||
} else if (Settings::getInstance()->getString("TransitionStyle") == "slide"){
|
} else if (transition_style == "slide" || transition_style == "instant"){
|
||||||
// move camera to zoom in on center + fade out, launch game, come back in
|
// 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]
|
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 1500), 0, [this, origCamera, center, game]
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue