diff --git a/JGE/src/JGui.cpp b/JGE/src/JGui.cpp index be6c2c455..6c570dbec 100644 --- a/JGE/src/JGui.cpp +++ b/JGE/src/JGui.cpp @@ -150,7 +150,7 @@ bool JGuiController::CheckUserInput(JButton key) } else { // a dude may have clicked somewhere, we're gonna select the closest object from where he clicked - int x, y; + int x = -1, y = -1; unsigned int distance2; unsigned int minDistance2 = -1; int n = mCurr; @@ -175,6 +175,11 @@ bool JGuiController::CheckUserInput(JButton key) mCurr = n; mObjects[mCurr]->Entering(); } + // if the same object was selected process click + else if (n == mCurr && mObjects[mCurr] != NULL && mObjects[mCurr]->Leaving(JGE_BTN_OK)) + { + mObjects[mCurr]->Entering(); + } mEngine->LeftClickedProcessed(); return true; } diff --git a/JGE/src/iOS/EAGLView.m b/JGE/src/iOS/EAGLView.m index 1a162b32b..254e72d47 100755 --- a/JGE/src/iOS/EAGLView.m +++ b/JGE/src/iOS/EAGLView.m @@ -405,6 +405,7 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170 // we want to differentiate between a pan motion vs a flick gesture. if (!(( ((int)abs( (int) velocity.x)) > 300) || ((int) (abs( (int) velocity.y)) > 300))) { + g_engine->LeftClicked(newLocation.x, newLocation.y); g_engine->HoldKey_NoRepeat( JGE_BTN_OK ); } else @@ -433,7 +434,6 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170 int actualWidth = (int) JRenderer::GetInstance()->GetActualWidth(); CGPoint newCoordinates = [self normalizeClickCoordinatesWithPoint: currentLocation]; - g_engine->LeftClicked( newCoordinates.x, newCoordinates.y); g_engine->HoldKey_NoRepeat(JGE_BTN_NONE); @@ -444,7 +444,8 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170 if (clickedWithinGameArea) { // we want some delay for the left click to take place before clicking on OK. - [self performSelector: @selector(handleOK:) withObject: nil afterDelay: 0.25]; + g_engine->LeftClicked( newCoordinates.x, newCoordinates.y); + [self performSelector: @selector(handleOK:) withObject: recognizer afterDelay: 0.25]; } else if(currentLocation.y < es2renderer.viewPort.top) { diff --git a/projects/mtg/src/DeckMenuItem.cpp b/projects/mtg/src/DeckMenuItem.cpp index a19e94b45..e4c5907bd 100644 --- a/projects/mtg/src/DeckMenuItem.cpp +++ b/projects/mtg/src/DeckMenuItem.cpp @@ -1,4 +1,4 @@ -#include "PrecompiledHeader.h" + #include "PrecompiledHeader.h" #include "DeckMenuItem.h" #include "Translate.h" @@ -7,7 +7,7 @@ #define ITEM_PX_WIDTH 190.0f #define kItemXOffset 22 -#define kItemYHeight 20 +#define kItemYHeight 30 const int kHorizontalScrollSpeed = 30; // higher numbers mean faster scrolling @@ -43,8 +43,11 @@ DeckMenuItem::DeckMenuItem(DeckMenu* _parent, int id, int fontId, string text, f mScrollerOffset = 0.0f; if (hasFocus) + { + mIsValidSelection = true; Entering(); - + } + if (meta && meta->getAvatarFilename().size() > 0) this->imageFilename = meta->getAvatarFilename(); else @@ -120,19 +123,17 @@ void DeckMenuItem::Render() void DeckMenuItem::checkUserClick() { #ifdef IOS - int x1 = 0, y1 = 0; - if ( mEngine->GetLeftClickCoordinates(x1, y1)) + int x1 = -1, y1 = -1; + if (mEngine->GetLeftClickCoordinates(x1, y1)) { mIsValidSelection = false; int x2 = kItemXOffset, y2 = static_cast(mY + mYOffset); if ( (x1 >= x2) && (x1 <= (x2 + ITEM_PX_WIDTH)) && (y1 >= y2) && (y1 < (y2 + kItemYHeight))) mIsValidSelection = true; } - else +#else + mIsValidSelection = true; #endif - { - mIsValidSelection = true; - } } @@ -158,7 +159,6 @@ bool DeckMenuItem::ButtonPressed() void DeckMenuItem::Relocate(float x, float y) { - checkUserClick(); mX = x; mY = y; } diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index f6acc711a..bfaa99135 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -1774,9 +1774,6 @@ void GameObserver::loadPlayer(int playerId, Player* player) void GameObserver::loadPlayer(int playerId, PlayerType playerType, int decknb, bool premadeDeck) { - - - if (decknb) { if (playerType == PLAYER_TYPE_HUMAN)