From adc3e4b689819b68eaedd09e0431de39daed4dc8 Mon Sep 17 00:00:00 2001 From: "techdragon.nguyen@gmail.com" Date: Tue, 10 Jan 2012 19:53:10 +0000 Subject: [PATCH] final change for 0.17 to sync up with other platforms. focused targeted touch of ui objects to deck menus. --- JGE/src/iOS/EAGLView.m | 3 ++- JGE/src/iOS/EAGLViewController.m | 2 +- projects/mtg/include/DeckMenuItem.h | 3 +++ projects/mtg/include/SimpleMenuItem.h | 2 +- projects/mtg/src/DeckMenuItem.cpp | 16 ++++++++++++++++ projects/mtg/src/SimpleMenuItem.cpp | 11 +---------- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/JGE/src/iOS/EAGLView.m b/JGE/src/iOS/EAGLView.m index 6ec56e52e..61640ba7b 100755 --- a/JGE/src/iOS/EAGLView.m +++ b/JGE/src/iOS/EAGLView.m @@ -444,7 +444,8 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170 { // we want some delay for the left click to take place before clicking on OK. g_engine->LeftClicked( newCoordinates.x, newCoordinates.y); - [self performSelector: @selector(handleOK:) withObject: recognizer afterDelay: 0.25]; + if (recognizer.state == UIGestureRecognizerStateEnded) + [self performSelector: @selector(handleOK:) withObject: recognizer afterDelay: 0.25]; } else if(currentLocation.y < es2renderer.viewPort.top) { diff --git a/JGE/src/iOS/EAGLViewController.m b/JGE/src/iOS/EAGLViewController.m index ae51c6e20..9a77ca56c 100755 --- a/JGE/src/iOS/EAGLViewController.m +++ b/JGE/src/iOS/EAGLViewController.m @@ -195,13 +195,13 @@ - (BOOL)textFieldShouldEndEditing:(UITextField *)textField { - [eaglView updateKeyboard: @"SAVE"]; return YES; } - (BOOL) textFieldShouldReturn:(UITextField *)textField { + [eaglView updateKeyboard: @"SAVE"]; [textField resignFirstResponder]; return YES; } diff --git a/projects/mtg/include/DeckMenuItem.h b/projects/mtg/include/DeckMenuItem.h index dce5941b1..b4a786e8c 100644 --- a/projects/mtg/include/DeckMenuItem.h +++ b/projects/mtg/include/DeckMenuItem.h @@ -17,6 +17,9 @@ private: DeckMenu* parent; float mTitleResetWidth; + +protected: + virtual void checkUserClick(); public: string imageFilename; diff --git a/projects/mtg/include/SimpleMenuItem.h b/projects/mtg/include/SimpleMenuItem.h index 7bdfe8cd9..302e426bf 100644 --- a/projects/mtg/include/SimpleMenuItem.h +++ b/projects/mtg/include/SimpleMenuItem.h @@ -27,7 +27,7 @@ protected: float mXOffset; bool mIsValidSelection; - void checkUserClick(); + virtual void checkUserClick(); public: diff --git a/projects/mtg/src/DeckMenuItem.cpp b/projects/mtg/src/DeckMenuItem.cpp index 75b08af56..8ba344b23 100644 --- a/projects/mtg/src/DeckMenuItem.cpp +++ b/projects/mtg/src/DeckMenuItem.cpp @@ -145,6 +145,22 @@ bool DeckMenuItem::ButtonPressed() return SimpleMenuItem::ButtonPressed(); } + +void DeckMenuItem::checkUserClick() +{ + int x1 = -1, y1 = -1; + if (mEngine->GetLeftClickCoordinates(x1, y1)) + { + mIsValidSelection = false; + int x2 = static_cast(mXOffset), y2 = static_cast(mY + mYOffset); + if ( (x1 >= x2) && (x1 <= (x2 + 200)) && (y1 >= y2) && (y1 < (y2 + 30))) + mIsValidSelection = true; + } + else + mIsValidSelection = true; +} + +// Accessors float DeckMenuItem::GetWidth() { WFont * mFont = WResourceManager::Instance()->GetWFont(fontId); diff --git a/projects/mtg/src/SimpleMenuItem.cpp b/projects/mtg/src/SimpleMenuItem.cpp index c2883c2cd..b74fbcfa9 100644 --- a/projects/mtg/src/SimpleMenuItem.cpp +++ b/projects/mtg/src/SimpleMenuItem.cpp @@ -60,16 +60,7 @@ void SimpleMenuItem::Update(float dt) void SimpleMenuItem::checkUserClick() { - int x1 = -1, y1 = -1; - if (mEngine->GetLeftClickCoordinates(x1, y1)) - { - mIsValidSelection = false; - int x2 = static_cast(mXOffset), y2 = static_cast(mY + mYOffset); - if ( (x1 >= x2) && (x1 <= (x2 + 200)) && (y1 >= y2) && (y1 < (y2 + 30))) - mIsValidSelection = true; - } - else - mIsValidSelection = true; + mIsValidSelection = true; } void SimpleMenuItem::Entering()