diff --git a/JGE/src/Qtmain.cpp b/JGE/src/Qtmain.cpp index 173866af9..8a9ace440 100644 --- a/JGE/src/Qtmain.cpp +++ b/JGE/src/Qtmain.cpp @@ -386,6 +386,7 @@ void JGEQtRenderer::timerEvent( QTimerEvent* ) { if(this->isVisible() #if (defined Q_WS_MAEMO_5) || (defined MEEGO_EDITION_HARMATTAN) + // This one is funny, this gives us 0% CPU when the app is in background for 1 line of code =) && this->isActiveWindow() #endif ) @@ -482,18 +483,8 @@ void JGEQtRenderer::mouseReleaseEvent(QMouseEvent *event) } } else if (g_startTimer.elapsed() - mLastFingerDownTime >= kSwipeEventMinDuration) - { // Swipe down is cancel or interrupt - if(abs(mMouseDownX - lastPos.x()) < kHitzonePliancy) - { - if(lastPos.y() - mMouseDownY >= kSwipeMinDistance) - { - g_engine->HoldKey_NoRepeat(JGE_BTN_SEC); - } - else if(mMouseDownY - lastPos.y()>= kSwipeMinDistance) - { - g_engine->HoldKey_NoRepeat(JGE_BTN_PREV); - } - } + { // Let's swipe + g_engine->Scroll(lastPos.x()-mMouseDownX, lastPos.y()-mMouseDownY); } #else //#if (!defined Q_WS_MAEMO_5) && (!defined MEEGO_EDITION_HARMATTAN) diff --git a/projects/mtg/include/GameStateShop.h b/projects/mtg/include/GameStateShop.h index b953b458d..aab2bee0c 100644 --- a/projects/mtg/include/GameStateShop.h +++ b/projects/mtg/include/GameStateShop.h @@ -116,6 +116,7 @@ public: virtual void Update(float dt); virtual void Render(); virtual void ButtonPressed(int controllerId, int controlId); + virtual void OnScroll(int inXVelocity, int inYVelocity); static float _x1[], _y1[], _x2[], _y2[], _x3[], _y3[], _x4[], _y4[]; }; diff --git a/projects/mtg/src/GameStateShop.cpp b/projects/mtg/src/GameStateShop.cpp index 16e46b789..4e1da3592 100644 --- a/projects/mtg/src/GameStateShop.cpp +++ b/projects/mtg/src/GameStateShop.cpp @@ -827,6 +827,16 @@ void GameStateShop::ButtonPressed(int controllerId, int controlId) menu->Close(); } +void GameStateShop::OnScroll(int inXVelocity, int inYVelocity) +{ + if (abs(inXVelocity) > 200) + { + bool flickLeft = (inXVelocity < 0); + if(!flickLeft) + mEngine->HoldKey_NoRepeat(JGE_BTN_PRI); + } +} + //ShopBooster ShopBooster::ShopBooster() {