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;
bool bListCards;
InteractiveButton *cycleCardsButton, *showCardListButton;
bool disablePurchase;
bool disablePurchase, clearInput;
void beginFilters();
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);
disablePurchase = false;
clearInput = false;
}
GameStateShop::~GameStateShop()
@@ -609,6 +610,9 @@ void GameStateShop::Update(float dt)
srcCards->Shuffle();
load();
disablePurchase = false;
clearInput = true;
return;
}
else if (btn == JGE_BTN_CANCEL)
options[Options::DISABLECARDS].number = !options[Options::DISABLECARDS].number;
@@ -627,19 +631,30 @@ void GameStateShop::Update(float dt)
{
bListCards = !bListCards;
disablePurchase = false;
clearInput = true;
return;
}
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;
return;
}
else if (btn == JGE_BTN_OK && disablePurchase)
{
disablePurchase = false;
}
else
#if defined (IOS) || defined (ANDROID)
if (clearInput && (btn == JGE_BTN_OK))
{
clearInput = false;
disablePurchase = false;
return;
}
else
#endif
if (shopMenu->CheckUserInput(btn))
srcCards->Touch();
}