From 9faf2ffc7203845f2b5870f4ecbe8fc3cc3a1700 Mon Sep 17 00:00:00 2001 From: "techdragon.nguyen@gmail.com" Date: Fri, 27 Jan 2012 23:47:02 +0000 Subject: [PATCH] reverted changes to the Scroll/OnScroll method signatures. --- JGE/include/JApp.h | 2 +- JGE/include/JGE.h | 2 +- JGE/src/JGE.cpp | 4 ++-- JGE/src/iOS/EAGLView.m | 3 +-- projects/mtg/Android/default.properties | 2 +- projects/mtg/include/GameApp.h | 2 +- projects/mtg/include/GameState.h | 2 +- projects/mtg/include/GameStateAwards.h | 2 +- projects/mtg/include/GameStateDeckViewer.h | 2 +- projects/mtg/include/GameStateDuel.h | 2 +- projects/mtg/include/GameStateShop.h | 2 +- projects/mtg/src/GameApp.cpp | 4 ++-- projects/mtg/src/GameStateAwards.cpp | 2 +- projects/mtg/src/GameStateDeckViewer.cpp | 4 +++- projects/mtg/src/GameStateDuel.cpp | 2 +- projects/mtg/src/GameStateShop.cpp | 2 +- 16 files changed, 20 insertions(+), 19 deletions(-) diff --git a/JGE/include/JApp.h b/JGE/include/JApp.h index 29129fb1a..47cc08803 100644 --- a/JGE/include/JApp.h +++ b/JGE/include/JApp.h @@ -83,7 +83,7 @@ public: ////////////////////////////////////////////////////////////////////////// virtual void Resume() = 0; - virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0) = 0; + virtual void OnScroll(int inXVelocity, int inYVelocity) = 0; }; diff --git a/JGE/include/JGE.h b/JGE/include/JGE.h index bf48c08dd..d723d350e 100644 --- a/JGE/include/JGE.h +++ b/JGE/include/JGE.h @@ -331,7 +331,7 @@ class JGE // Scroll events - currently triggered by SDL JOYBALL events - void Scroll(int inXVelocity, int inYVelocity, int magnitude); + void Scroll(int inXVelocity, int inYVelocity); ////////////////////////////////////////////////////////////////////////// /// Get if the system is ended/paused or not. diff --git a/JGE/src/JGE.cpp b/JGE/src/JGE.cpp index 8846a17df..62e13aced 100644 --- a/JGE/src/JGE.cpp +++ b/JGE/src/JGE.cpp @@ -577,11 +577,11 @@ void JGE::Assert(const char *filename, long lineNumber) mCriticalAssert = true; } -void JGE::Scroll(int inXVelocity, int inYVelocity, int magnitude) +void JGE::Scroll(int inXVelocity, int inYVelocity) { if (mApp != NULL) { - mApp->OnScroll(inXVelocity, inYVelocity, magnitude); + mApp->OnScroll(inXVelocity, inYVelocity); } } diff --git a/JGE/src/iOS/EAGLView.m b/JGE/src/iOS/EAGLView.m index 30ec4e3d5..7600c3544 100755 --- a/JGE/src/iOS/EAGLView.m +++ b/JGE/src/iOS/EAGLView.m @@ -419,8 +419,7 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170 else { CGPoint v2 = [panGesture velocityInView: self]; - int magnitude = [self distanceBetweenPointA: currentLocation andPointB: v2]; - g_engine->Scroll( 0 - static_cast(v2.x), 0 - static_cast(v2.y), static_cast(magnitude)); + g_engine->Scroll( 0 - static_cast(v2.x), 0 - static_cast(v2.y)); [self performSelector: @selector(resetInput) withObject: nil afterDelay: 0.5]; } diff --git a/projects/mtg/Android/default.properties b/projects/mtg/Android/default.properties index 9a2c9f6c8..8010039f3 100644 --- a/projects/mtg/Android/default.properties +++ b/projects/mtg/Android/default.properties @@ -8,4 +8,4 @@ # project structure. # Project target. -target=android-9 +target=android-10 diff --git a/projects/mtg/include/GameApp.h b/projects/mtg/include/GameApp.h index 3e98c0ba9..5d7ac82a2 100644 --- a/projects/mtg/include/GameApp.h +++ b/projects/mtg/include/GameApp.h @@ -80,7 +80,7 @@ public: virtual void Pause(); virtual void Resume(); - virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0); + virtual void OnScroll(int inXVelocity, int inYVelocity); void LoadGameStates(); void SetNextState(int state); diff --git a/projects/mtg/include/GameState.h b/projects/mtg/include/GameState.h index 7f654c949..e080109ea 100644 --- a/projects/mtg/include/GameState.h +++ b/projects/mtg/include/GameState.h @@ -56,7 +56,7 @@ public: virtual void Start(){} virtual void End(){} - virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0) + virtual void OnScroll(int inXVelocity, int inYVelocity) { } diff --git a/projects/mtg/include/GameStateAwards.h b/projects/mtg/include/GameStateAwards.h index 777355cd2..cb614895c 100644 --- a/projects/mtg/include/GameStateAwards.h +++ b/projects/mtg/include/GameStateAwards.h @@ -35,7 +35,7 @@ public: virtual void Update(float dt); virtual void Render(); virtual void ButtonPressed(int controllerId, int controlId); - virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0); + virtual void OnScroll(int inXVelocity, int inYVelocity); }; #endif diff --git a/projects/mtg/include/GameStateDeckViewer.h b/projects/mtg/include/GameStateDeckViewer.h index af0bf2158..275d1638d 100644 --- a/projects/mtg/include/GameStateDeckViewer.h +++ b/projects/mtg/include/GameStateDeckViewer.h @@ -150,7 +150,7 @@ public: int loadDeck(int deckid); void LoadDeckStatistics(int deckId); - void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0); + void OnScroll(int inXVelocity, int inYVelocity); void buildEditorMenu(); virtual void ButtonPressed(int controllerId, int controlId); diff --git a/projects/mtg/include/GameStateDuel.h b/projects/mtg/include/GameStateDuel.h index 913f35e16..5526ac39a 100644 --- a/projects/mtg/include/GameStateDuel.h +++ b/projects/mtg/include/GameStateDuel.h @@ -80,7 +80,7 @@ public: virtual void Render(); void initRand(unsigned seed = 0); - void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0); + void OnScroll(int inXVelocity, int inYVelocity); enum ENUM_DUEL_STATE_MENU_ITEM { diff --git a/projects/mtg/include/GameStateShop.h b/projects/mtg/include/GameStateShop.h index db80bc091..e320ac388 100644 --- a/projects/mtg/include/GameStateShop.h +++ b/projects/mtg/include/GameStateShop.h @@ -115,7 +115,7 @@ public: virtual void Update(float dt); virtual void Render(); virtual void ButtonPressed(int controllerId, int controlId); - virtual void OnScroll(int inXVelocity, int inYVelocity, int magnitude = 0); + virtual void OnScroll(int inXVelocity, int inYVelocity); static float _x1[], _y1[], _x2[], _y2[], _x3[], _y3[], _x4[], _y4[]; }; diff --git a/projects/mtg/src/GameApp.cpp b/projects/mtg/src/GameApp.cpp index 0ee750736..232341d96 100644 --- a/projects/mtg/src/GameApp.cpp +++ b/projects/mtg/src/GameApp.cpp @@ -445,11 +445,11 @@ void GameApp::Render() } -void GameApp::OnScroll(int inXVelocity, int inYVelocity, int magnitude) +void GameApp::OnScroll(int inXVelocity, int inYVelocity) { if (mCurrentState != NULL) { - mCurrentState->OnScroll(inXVelocity, inYVelocity, magnitude); + mCurrentState->OnScroll(inXVelocity, inYVelocity); } } diff --git a/projects/mtg/src/GameStateAwards.cpp b/projects/mtg/src/GameStateAwards.cpp index 4a12461c4..b10f70a25 100644 --- a/projects/mtg/src/GameStateAwards.cpp +++ b/projects/mtg/src/GameStateAwards.cpp @@ -389,7 +389,7 @@ void GameStateAwards::ButtonPressed(int controllerId, int controlId) } } -void GameStateAwards::OnScroll(int inXVelocity, int inYVelocity, int magnitude) +void GameStateAwards::OnScroll(int inXVelocity, int inYVelocity) { if (abs(inYVelocity) > 300) { diff --git a/projects/mtg/src/GameStateDeckViewer.cpp b/projects/mtg/src/GameStateDeckViewer.cpp index 43e25bf6e..280cd22c9 100644 --- a/projects/mtg/src/GameStateDeckViewer.cpp +++ b/projects/mtg/src/GameStateDeckViewer.cpp @@ -1734,8 +1734,10 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId) } } -void GameStateDeckViewer::OnScroll(int inXVelocity, int inYVelocity, int magnitude) +void GameStateDeckViewer::OnScroll(int inXVelocity, int inYVelocity) { + int magnitude = static_cast( sqrtf( (float )( (inXVelocity * inXVelocity) + (inXVelocity * inXVelocity)))); + bool flickHorizontal = (abs(inXVelocity) > abs(inYVelocity)); bool flickUp = !flickHorizontal && (inYVelocity < 0) ? true : false; bool flickRight = flickHorizontal && (inXVelocity > 0) ? true : false; diff --git a/projects/mtg/src/GameStateDuel.cpp b/projects/mtg/src/GameStateDuel.cpp index 095e25e8a..03d2ec700 100644 --- a/projects/mtg/src/GameStateDuel.cpp +++ b/projects/mtg/src/GameStateDuel.cpp @@ -931,7 +931,7 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId) } } -void GameStateDuel::OnScroll(int inXVelocity, int inYVelocity, int magnitude) +void GameStateDuel::OnScroll(int inXVelocity, int inYVelocity) { // ignore magnitude for now, since no action requires scrolling if (abs(inYVelocity) > 300) diff --git a/projects/mtg/src/GameStateShop.cpp b/projects/mtg/src/GameStateShop.cpp index 8b4874f4f..9587ddcc1 100644 --- a/projects/mtg/src/GameStateShop.cpp +++ b/projects/mtg/src/GameStateShop.cpp @@ -808,7 +808,7 @@ void GameStateShop::ButtonPressed(int controllerId, int controlId) menu->Close(); } -void GameStateShop::OnScroll(int inXVelocity, int inYVelocity, int magnitude) +void GameStateShop::OnScroll(int inXVelocity, int inYVelocity) { // we ignore magnitude since there isn't any scrolling in the shop if (abs(inXVelocity) > 200)