last fix for buttons only fixed the PC/SDL mouse impl. This fixes the iOS/Android platforms. iOS/Android platforms both issue a JGE_BTN_OK keypress on single tap in which the mouse version does not. that version issues the OK keypress in sync with the mouse click.

This commit is contained in:
techdragon.nguyen@gmail.com
2012-02-01 00:38:02 +00:00
parent 9127ddaca2
commit 2f408664ad
2 changed files with 21 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ private:
MTGDeck * booster; MTGDeck * booster;
bool bListCards; bool bListCards;
InteractiveButton *cycleCardsButton, *showCardListButton; InteractiveButton *cycleCardsButton, *showCardListButton;
bool disablePurchase; bool disablePurchase, clearInput;
void beginFilters(); void beginFilters();
void deleteDisplay(); void deleteDisplay();

View File

@@ -79,6 +79,7 @@ GameStateShop::GameStateShop(GameApp* parent) :
showCardListButton = NEW InteractiveButton(NULL, kShowCardListButtonId, Fonts::MAIN_FONT, "Show List", SCREEN_WIDTH_F - 150, SCREEN_HEIGHT_F - 15, JGE_BTN_SEC); showCardListButton = NEW InteractiveButton(NULL, kShowCardListButtonId, Fonts::MAIN_FONT, "Show List", SCREEN_WIDTH_F - 150, SCREEN_HEIGHT_F - 15, JGE_BTN_SEC);
disablePurchase = false; disablePurchase = false;
clearInput = false;
} }
GameStateShop::~GameStateShop() GameStateShop::~GameStateShop()
@@ -609,6 +610,9 @@ void GameStateShop::Update(float dt)
srcCards->Shuffle(); srcCards->Shuffle();
load(); load();
disablePurchase = false; disablePurchase = false;
clearInput = true;
return;
} }
else if (btn == JGE_BTN_CANCEL) else if (btn == JGE_BTN_CANCEL)
options[Options::DISABLECARDS].number = !options[Options::DISABLECARDS].number; options[Options::DISABLECARDS].number = !options[Options::DISABLECARDS].number;
@@ -627,19 +631,30 @@ void GameStateShop::Update(float dt)
{ {
bListCards = !bListCards; bListCards = !bListCards;
disablePurchase = false; disablePurchase = false;
clearInput = true;
return;
} }
else if (shopMenu) else if (shopMenu)
{ {
if (btn == JGE_BTN_OK && (cycleCardsButton->ButtonPressed() || showCardListButton->ButtonPressed())) #if defined (IOS) || defined (ANDROID)
if ((cycleCardsButton->ButtonPressed() || showCardListButton->ButtonPressed()))
#else
if ( (btn == JGE_BTN_OK) && (cycleCardsButton->ButtonPressed() || showCardListButton->ButtonPressed()))
#endif
{ {
disablePurchase = true; disablePurchase = true;
return; return;
} }
else if (btn == JGE_BTN_OK && disablePurchase) else
{ #if defined (IOS) || defined (ANDROID)
disablePurchase = false; if (clearInput && (btn == JGE_BTN_OK))
} {
clearInput = false;
disablePurchase = false;
return;
}
else else
#endif
if (shopMenu->CheckUserInput(btn)) if (shopMenu->CheckUserInput(btn))
srcCards->Touch(); srcCards->Touch();
} }