mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-24 23:25:38 +00:00
Lock input during launch animation.
This commit is contained in:
parent
7e9b20fac5
commit
1398785468
|
@ -10,7 +10,7 @@
|
||||||
#include "../animations/LambdaAnimation.h"
|
#include "../animations/LambdaAnimation.h"
|
||||||
|
|
||||||
ViewController::ViewController(Window* window)
|
ViewController::ViewController(Window* window)
|
||||||
: GuiComponent(window), mCurrentView(nullptr), mCamera(Eigen::Affine3f::Identity()), mFadeOpacity(1)
|
: GuiComponent(window), mCurrentView(nullptr), mCamera(Eigen::Affine3f::Identity()), mFadeOpacity(1), mLockInput(false)
|
||||||
{
|
{
|
||||||
// slot 1 so the fade carries over
|
// slot 1 so the fade carries over
|
||||||
setAnimation(new LambdaAnimation([&] (float t) { mFadeOpacity = lerp<float>(1.0f, 0.0f, t); }, 900), nullptr, false, 1);
|
setAnimation(new LambdaAnimation([&] (float t) { mFadeOpacity = lerp<float>(1.0f, 0.0f, t); }, 900), nullptr, false, 1);
|
||||||
|
@ -105,10 +105,12 @@ void ViewController::launch(FileData* game, Eigen::Vector3f center)
|
||||||
|
|
||||||
center += mCurrentView->getPosition();
|
center += mCurrentView->getPosition();
|
||||||
stopAnimation(1); // make sure the fade in isn't still playing
|
stopAnimation(1); // make sure the fade in isn't still playing
|
||||||
|
mLockInput = true;
|
||||||
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 1500), [this, origCamera, center, game]
|
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 1500), [this, origCamera, center, game]
|
||||||
{
|
{
|
||||||
game->getSystem()->launchGame(mWindow, game);
|
game->getSystem()->launchGame(mWindow, game);
|
||||||
mCamera = origCamera;
|
mCamera = origCamera;
|
||||||
|
mLockInput = false;
|
||||||
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 600), nullptr, true);
|
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 600), nullptr, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -171,6 +173,9 @@ std::shared_ptr<SystemListView> ViewController::getSystemListView()
|
||||||
|
|
||||||
bool ViewController::input(InputConfig* config, Input input)
|
bool ViewController::input(InputConfig* config, Input input)
|
||||||
{
|
{
|
||||||
|
if(mLockInput)
|
||||||
|
return true;
|
||||||
|
|
||||||
if(mCurrentView)
|
if(mCurrentView)
|
||||||
return mCurrentView->input(config, input);
|
return mCurrentView->input(config, input);
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,7 @@ private:
|
||||||
|
|
||||||
Eigen::Affine3f mCamera;
|
Eigen::Affine3f mCamera;
|
||||||
float mFadeOpacity;
|
float mFadeOpacity;
|
||||||
|
bool mLockInput;
|
||||||
|
|
||||||
State mState;
|
State mState;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue