From 95bbe06c7ef3aaff4f13e8aa355936690514a6ac Mon Sep 17 00:00:00 2001 From: "anthonycalosa@gmail.com" Date: Thu, 13 Jun 2013 04:34:20 +0000 Subject: [PATCH] added swipe on Story Mode. So if playing a duel on story mode, you can cancel with swipe down. --- projects/mtg/include/GameStateStory.h | 2 +- projects/mtg/src/GameStateStory.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/projects/mtg/include/GameStateStory.h b/projects/mtg/include/GameStateStory.h index 5a8121057..2105eb2b8 100644 --- a/projects/mtg/include/GameStateStory.h +++ b/projects/mtg/include/GameStateStory.h @@ -22,7 +22,7 @@ public: void Update(float dt); void Render(); void ButtonPressed(int controllerId, int controlId); - + void OnScroll(int inXVelocity, int inYVelocity); }; #endif diff --git a/projects/mtg/src/GameStateStory.cpp b/projects/mtg/src/GameStateStory.cpp index 1d1a14de6..22c9bc987 100644 --- a/projects/mtg/src/GameStateStory.cpp +++ b/projects/mtg/src/GameStateStory.cpp @@ -129,3 +129,17 @@ void GameStateStory::ButtonPressed(int controllerId, int controlId) } } + +void GameStateStory::OnScroll(int, int inYVelocity) +{ + if (abs(inYVelocity) > 300) + { + bool flickUpwards = (inYVelocity < 0); + int velocity = (inYVelocity < 0) ? (-1 * inYVelocity) : inYVelocity; + while(velocity > 0) + { + mEngine->HoldKey_NoRepeat(flickUpwards ? JGE_BTN_DOWN : JGE_BTN_UP); + velocity -= 100; + } + } +} \ No newline at end of file