Added None Transition

This commit is contained in:
hex007 2017-05-23 17:41:14 -07:00
parent bc68e0abb0
commit fb93a4d2b6
3 changed files with 32 additions and 5 deletions

View file

@ -127,6 +127,7 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
std::vector<std::string> transitions;
transitions.push_back("fade");
transitions.push_back("slide");
transitions.push_back("none");
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);

View file

@ -264,10 +264,10 @@ void SystemView::onCursorChanged(const CursorState& state)
this->mExtrasCamOffset = endPos;
}, 500);
}
else{ // slide
} else if (Settings::getInstance()->getString("TransitionStyle") == "slide") {
// slide
anim = new LambdaAnimation(
[startPos, endPos, posMax, this](float t)
[this, startPos, endPos, posMax](float t)
{
t -= 1;
float f = lerp<float>(startPos, endPos, t*t*t + 1);
@ -279,8 +279,17 @@ void SystemView::onCursorChanged(const CursorState& state)
this->mCamOffset = f;
this->mExtrasCamOffset = f;
}, 500);
} else {
// None
anim = new LambdaAnimation(
[this, endPos](float t)
{
this->mCamOffset = endPos;
this->mExtrasCamOffset = endPos;
}, 1);
}
setAnimation(anim, 0, nullptr, false, 0);
}

View file

@ -188,10 +188,18 @@ void ViewController::playViewTransition()
}else{
advanceAnimation(0, (int)(mFadeOpacity * FADE_DURATION));
}
}else{
} else if (Settings::getInstance()->getString("TransitionStyle") == "slide"){
// slide
setAnimation(new MoveCameraAnimation(mCamera, target));
updateHelpPrompts(); // update help prompts immediately
} else {
// none
setAnimation(new LambdaAnimation(
[this, target](float t)
{
this->mCamera.translation() = -target;
}, 1));
updateHelpPrompts();
}
}
@ -236,7 +244,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 (Settings::getInstance()->getString("TransitionStyle") == "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 +254,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);
});
}
}