added new buttons for shop for New Cards and displaying the card list.
This commit is contained in:
@@ -435,7 +435,6 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170
|
|||||||
|
|
||||||
CGPoint newCoordinates = [self normalizeClickCoordinatesWithPoint: currentLocation];
|
CGPoint newCoordinates = [self normalizeClickCoordinatesWithPoint: currentLocation];
|
||||||
g_engine->LeftClicked( newCoordinates.x, newCoordinates.y);
|
g_engine->LeftClicked( newCoordinates.x, newCoordinates.y);
|
||||||
g_engine->HoldKey_NoRepeat(JGE_BTN_NONE);
|
|
||||||
|
|
||||||
BOOL clickedWithinGameArea = (currentLocation.y > es2renderer.viewPort.top &&
|
BOOL clickedWithinGameArea = (currentLocation.y > es2renderer.viewPort.top &&
|
||||||
currentLocation.y < es2renderer.viewPort.bottom &&
|
currentLocation.y < es2renderer.viewPort.bottom &&
|
||||||
@@ -467,7 +466,6 @@ static NSString *_MY_AD_WHIRL_APPLICATION_KEY_IPAD = @"2e70e3f3da40408588b9a3170
|
|||||||
}
|
}
|
||||||
|
|
||||||
oldCoordinates = newCoordinates;
|
oldCoordinates = newCoordinates;
|
||||||
g_engine->ReleaseKey( JGE_BTN_NONE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "CardDisplay.h"
|
#include "CardDisplay.h"
|
||||||
#include "DeckDataWrapper.h"
|
#include "DeckDataWrapper.h"
|
||||||
#include "Tasks.h"
|
#include "Tasks.h"
|
||||||
|
#include "InteractiveButton.h"
|
||||||
|
|
||||||
#define STATE_BUY 1
|
#define STATE_BUY 1
|
||||||
#define STATE_SELL 2
|
#define STATE_SELL 2
|
||||||
@@ -72,10 +73,14 @@ private:
|
|||||||
vector<MTGCardInstance*> subBooster;
|
vector<MTGCardInstance*> subBooster;
|
||||||
MTGDeck * booster;
|
MTGDeck * booster;
|
||||||
bool bListCards;
|
bool bListCards;
|
||||||
|
InteractiveButton *cycleCardsButton, *showCardListButton;
|
||||||
|
bool disablePurchase;
|
||||||
|
|
||||||
void beginFilters();
|
void beginFilters();
|
||||||
void deleteDisplay();
|
void deleteDisplay();
|
||||||
|
void enableButtons();
|
||||||
|
void renderButtons();
|
||||||
|
|
||||||
WSyncable bigSync;
|
WSyncable bigSync;
|
||||||
SimpleMenu * menu;
|
SimpleMenu * menu;
|
||||||
PriceList * pricelist;
|
PriceList * pricelist;
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ const int kMenuButtonId = 10003;
|
|||||||
const int kFilterButtonId = 10004;
|
const int kFilterButtonId = 10004;
|
||||||
const int kNextStatsButtonId = 10005;
|
const int kNextStatsButtonId = 10005;
|
||||||
const int kPrevStatsButtonId = 10006;
|
const int kPrevStatsButtonId = 10006;
|
||||||
|
const int kCycleCardsButtonId = 10007;
|
||||||
|
const int kShowCardListButtonId = 10008;
|
||||||
|
|
||||||
class InteractiveButton: public SimpleButton
|
class InteractiveButton: public SimpleButton
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "TestSuiteAI.h"
|
#include "TestSuiteAI.h"
|
||||||
|
|
||||||
#include <hge/hgedistort.h>
|
#include <hge/hgedistort.h>
|
||||||
|
#include "WFont.h"
|
||||||
|
|
||||||
float GameStateShop::_x1[] = { 79, 19, 27, 103, 154, 187, 102, 144, 198, 133, 183 };
|
float GameStateShop::_x1[] = { 79, 19, 27, 103, 154, 187, 102, 144, 198, 133, 183 };
|
||||||
float GameStateShop::_y1[] = { 150, 194, 222, 167, 164, 156, 195, 190, 175, 220, 220 };
|
float GameStateShop::_y1[] = { 150, 194, 222, 167, 164, 156, 195, 190, 175, 220, 220 };
|
||||||
@@ -74,10 +75,17 @@ GameStateShop::GameStateShop(GameApp* parent) :
|
|||||||
|
|
||||||
kOtherCardsString = _(kOtherCardsString);
|
kOtherCardsString = _(kOtherCardsString);
|
||||||
kCreditsString = _(kCreditsString);
|
kCreditsString = _(kCreditsString);
|
||||||
|
|
||||||
|
cycleCardsButton = NEW InteractiveButton(NULL, kCycleCardsButtonId, Fonts::MAIN_FONT, "New Cards", SCREEN_WIDTH_F - 80, SCREEN_HEIGHT_F - 15, JGE_BTN_PRI);
|
||||||
|
|
||||||
|
showCardListButton = NEW InteractiveButton(NULL, kShowCardListButtonId, Fonts::MAIN_FONT, "Show List", SCREEN_WIDTH_F - 150, SCREEN_HEIGHT_F - 15, JGE_BTN_SEC);
|
||||||
|
disablePurchase = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameStateShop::~GameStateShop()
|
GameStateShop::~GameStateShop()
|
||||||
{
|
{
|
||||||
|
SAFE_DELETE( cycleCardsButton );
|
||||||
|
SAFE_DELETE( showCardListButton );
|
||||||
End();
|
End();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,8 +627,18 @@ void GameStateShop::Update(float dt)
|
|||||||
bListCards = !bListCards;
|
bListCards = !bListCards;
|
||||||
else if (shopMenu)
|
else if (shopMenu)
|
||||||
{
|
{
|
||||||
if (shopMenu->CheckUserInput(btn))
|
if (cycleCardsButton->ButtonPressed() || showCardListButton->ButtonPressed())
|
||||||
srcCards->Touch();
|
{
|
||||||
|
disablePurchase = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (btn == JGE_BTN_OK && disablePurchase)
|
||||||
|
{
|
||||||
|
disablePurchase = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (shopMenu->CheckUserInput(btn))
|
||||||
|
srcCards->Touch();
|
||||||
}
|
}
|
||||||
if (shopMenu)
|
if (shopMenu)
|
||||||
shopMenu->Update(dt);
|
shopMenu->Update(dt);
|
||||||
@@ -645,6 +663,19 @@ void GameStateShop::deleteDisplay()
|
|||||||
subBooster.clear();
|
subBooster.clear();
|
||||||
SAFE_DELETE(boosterDisplay);
|
SAFE_DELETE(boosterDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameStateShop::enableButtons()
|
||||||
|
{
|
||||||
|
cycleCardsButton->setIsSelectionValid(true);
|
||||||
|
showCardListButton->setIsSelectionValid(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameStateShop::renderButtons()
|
||||||
|
{
|
||||||
|
cycleCardsButton->Render();
|
||||||
|
showCardListButton->Render();
|
||||||
|
}
|
||||||
|
|
||||||
void GameStateShop::Render()
|
void GameStateShop::Render()
|
||||||
{
|
{
|
||||||
//Erase
|
//Erase
|
||||||
@@ -719,10 +750,14 @@ void GameStateShop::Render()
|
|||||||
mFont->SetColor(ARGB(255,255,255,255));
|
mFont->SetColor(ARGB(255,255,255,255));
|
||||||
mFont->DrawString(stream.str(), 5, SCREEN_HEIGHT - 14);
|
mFont->DrawString(stream.str(), 5, SCREEN_HEIGHT - 14);
|
||||||
|
|
||||||
|
#ifndef TOUCH_ENABLED
|
||||||
float len = 4 + mFont->GetStringWidth(kOtherCardsString.c_str());
|
float len = 4 + mFont->GetStringWidth(kOtherCardsString.c_str());
|
||||||
r->RenderQuad(pspIcons[6].get(), SCREEN_WIDTH - len - kGamepadIconSize - 10, SCREEN_HEIGHT - 8, 0, kGamepadIconSize, kGamepadIconSize);
|
r->RenderQuad(pspIcons[6].get(), SCREEN_WIDTH - len - kGamepadIconSize - 10, SCREEN_HEIGHT - 8, 0, kGamepadIconSize, kGamepadIconSize);
|
||||||
mFont->DrawString(kOtherCardsString, SCREEN_WIDTH - len, SCREEN_HEIGHT - 14);
|
mFont->DrawString(kOtherCardsString, SCREEN_WIDTH - len, SCREEN_HEIGHT - 14);
|
||||||
|
#else
|
||||||
|
enableButtons();
|
||||||
|
#endif
|
||||||
|
|
||||||
mFont->SetColor(ARGB(255,255,255,0));
|
mFont->SetColor(ARGB(255,255,255,0));
|
||||||
mFont->DrawString(descPurchase(bigSync.getPos()).c_str(), SCREEN_WIDTH / 2, SCREEN_HEIGHT - 14, JGETEXT_CENTER);
|
mFont->DrawString(descPurchase(bigSync.getPos()).c_str(), SCREEN_WIDTH / 2, SCREEN_HEIGHT - 14, JGETEXT_CENTER);
|
||||||
mFont->SetColor(ARGB(255,255,255,255));
|
mFont->SetColor(ARGB(255,255,255,255));
|
||||||
@@ -733,12 +768,13 @@ void GameStateShop::Render()
|
|||||||
}
|
}
|
||||||
if (menu)
|
if (menu)
|
||||||
menu->Render();
|
menu->Render();
|
||||||
|
|
||||||
|
renderButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameStateShop::ButtonPressed(int controllerId, int controlId)
|
void GameStateShop::ButtonPressed(int controllerId, int controlId)
|
||||||
{
|
{
|
||||||
int sel = bigSync.getOffset();
|
int sel = bigSync.getOffset();
|
||||||
|
|
||||||
switch (controllerId)
|
switch (controllerId)
|
||||||
{
|
{
|
||||||
case -102: //Buying something...
|
case -102: //Buying something...
|
||||||
|
|||||||
@@ -1562,6 +1562,7 @@
|
|||||||
CEA376B71291C60500B9016A /* GuiPhaseBar.h */,
|
CEA376B71291C60500B9016A /* GuiPhaseBar.h */,
|
||||||
CEA376B81291C60500B9016A /* GuiPlay.h */,
|
CEA376B81291C60500B9016A /* GuiPlay.h */,
|
||||||
CEA376B91291C60500B9016A /* GuiStatic.h */,
|
CEA376B91291C60500B9016A /* GuiStatic.h */,
|
||||||
|
12272FC614CD68FB00192DC7 /* InteractiveButton.h */,
|
||||||
CEA376BA1291C60500B9016A /* ManaCost.h */,
|
CEA376BA1291C60500B9016A /* ManaCost.h */,
|
||||||
CEA376BB1291C60500B9016A /* ManaCostHybrid.h */,
|
CEA376BB1291C60500B9016A /* ManaCostHybrid.h */,
|
||||||
CEA376BC1291C60500B9016A /* MenuItem.h */,
|
CEA376BC1291C60500B9016A /* MenuItem.h */,
|
||||||
@@ -1612,7 +1613,6 @@
|
|||||||
CEA376EA1291C60500B9016A /* WFont.h */,
|
CEA376EA1291C60500B9016A /* WFont.h */,
|
||||||
CEA376EB1291C60500B9016A /* WGui.h */,
|
CEA376EB1291C60500B9016A /* WGui.h */,
|
||||||
CEA376EC1291C60500B9016A /* WResourceManager.h */,
|
CEA376EC1291C60500B9016A /* WResourceManager.h */,
|
||||||
12272FC614CD68FB00192DC7 /* InteractiveButton.h */,
|
|
||||||
);
|
);
|
||||||
path = include;
|
path = include;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|||||||
Reference in New Issue
Block a user