Skip to content

Commit

Permalink
Lock input during launch animation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aloshi committed Dec 13, 2013
1 parent 7e9b20f commit 1398785
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/views/ViewController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "../animations/LambdaAnimation.h"

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
setAnimation(new LambdaAnimation([&] (float t) { mFadeOpacity = lerp<float>(1.0f, 0.0f, t); }, 900), nullptr, false, 1);
Expand Down Expand Up @@ -105,10 +105,12 @@ void ViewController::launch(FileData* game, Eigen::Vector3f center)

center += mCurrentView->getPosition();
stopAnimation(1); // make sure the fade in isn't still playing
mLockInput = true;
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 1500), [this, origCamera, center, game]
{
game->getSystem()->launchGame(mWindow, game);
mCamera = origCamera;
mLockInput = false;
setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 600), nullptr, true);
});
}
Expand Down Expand Up @@ -171,6 +173,9 @@ std::shared_ptr<SystemListView> ViewController::getSystemListView()

bool ViewController::input(InputConfig* config, Input input)
{
if(mLockInput)
return true;

if(mCurrentView)
return mCurrentView->input(config, input);

Expand Down
1 change: 1 addition & 0 deletions src/views/ViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class ViewController : public GuiComponent

Eigen::Affine3f mCamera;
float mFadeOpacity;
bool mLockInput;

State mState;
};

0 comments on commit 1398785

Please sign in to comment.