added border to extra details popup as per design at
http://wololo.net/forum/viewtopic.php?f=37&t=2380 and http://wololo.net/forum/viewtopic.php?f=37&t=2382
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 59 KiB |
@@ -32,7 +32,7 @@ public:
|
|||||||
DeckMetaData();
|
DeckMetaData();
|
||||||
DeckMetaData(string filename, Player * statsPlayer);
|
DeckMetaData(string filename, Player * statsPlayer);
|
||||||
void load(string filename);
|
void load(string filename);
|
||||||
void loadStatsForPlayer( Player * statsPlayer, string opponentDeckName = "" );
|
void loadStatsForPlayer( Player * statsPlayer, string deckStatsFileName = "" );
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
string getFilename();
|
string getFilename();
|
||||||
@@ -52,6 +52,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class DeckMetaDataList {
|
class DeckMetaDataList {
|
||||||
|
private:
|
||||||
|
map<string,DeckMetaData *>values;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void invalidate(string filename);
|
void invalidate(string filename);
|
||||||
DeckMetaData * get(string filename, Player * statsPlayer = NULL);
|
DeckMetaData * get(string filename, Player * statsPlayer = NULL);
|
||||||
@@ -59,8 +62,6 @@ public:
|
|||||||
static DeckMetaDataList * decksMetaData;
|
static DeckMetaDataList * decksMetaData;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
map<string,DeckMetaData *>values;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class SimplePopup: public JGuiController
|
|||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float mHeight, mWidth, mX, mY;
|
float mWidth, mX, mY;
|
||||||
int mMaxLines;
|
int mMaxLines;
|
||||||
int mFontId;
|
int mFontId;
|
||||||
DeckMetaData * mDeckInformation;
|
DeckMetaData * mDeckInformation;
|
||||||
@@ -28,8 +28,9 @@ private:
|
|||||||
bool mClosed;
|
bool mClosed;
|
||||||
MTGAllCards * mCollection;
|
MTGAllCards * mCollection;
|
||||||
|
|
||||||
void drawHorzPole(float x, float y, float width);
|
void drawHorzPole(string imageName, bool flipX, bool flipY, float x, float y, float width);
|
||||||
void drawVertPole(float x, float y, float height);
|
void drawCorner(string imageName, bool flipX, bool flipY, float x, float y);
|
||||||
|
void drawVertPole(string imageName, bool flipX, bool flipY, float x, float y, float height);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool autoTranslate;
|
bool autoTranslate;
|
||||||
@@ -37,7 +38,7 @@ public:
|
|||||||
|
|
||||||
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL);
|
SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title = "", DeckMetaData* deckInfo = NULL, MTGAllCards * collection = NULL);
|
||||||
~SimplePopup(void);
|
~SimplePopup(void);
|
||||||
|
void drawBoundingBox( float x, float y, float width, float height );
|
||||||
bool isClosed() { return mClosed; }
|
bool isClosed() { return mClosed; }
|
||||||
MTGAllCards* getCollection() { return mCollection; }
|
MTGAllCards* getCollection() { return mCollection; }
|
||||||
void Render();
|
void Render();
|
||||||
|
|||||||
@@ -15,9 +15,12 @@ namespace
|
|||||||
const float kVerticalMargin = 16;
|
const float kVerticalMargin = 16;
|
||||||
const float kHorizontalMargin = 20;
|
const float kHorizontalMargin = 20;
|
||||||
const float kLineHeight = 20;
|
const float kLineHeight = 20;
|
||||||
const float kDescriptionVerticalBoxPadding = 5;
|
const float kDescriptionVerticalBoxPadding = 5;
|
||||||
const float kDescriptionHorizontalBoxPadding = 5;
|
const float kDescriptionHorizontalBoxPadding = 5;
|
||||||
const float kMenuFontScale = 1.0f;
|
|
||||||
|
const float kDescriptiveTextFontScale = 0.85f;
|
||||||
|
const float kDefaultFontScale = 1.0f;
|
||||||
|
|
||||||
const int DETAILED_INFO_THRESHOLD = 20;
|
const int DETAILED_INFO_THRESHOLD = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,16 +42,16 @@ JGuiController(id, listener), fontId(fontId), mShowDetailsScreen( showDetailsOve
|
|||||||
backgroundName = "DeckMenuBackdrop";
|
backgroundName = "DeckMenuBackdrop";
|
||||||
mAlwaysShowDetailsButton = false;
|
mAlwaysShowDetailsButton = false;
|
||||||
mSelectedDeck = NULL;
|
mSelectedDeck = NULL;
|
||||||
mY = 55;
|
mY = 50;
|
||||||
mWidth = 176;
|
mWidth = 176;
|
||||||
mX = 125;
|
mX = 110;
|
||||||
|
|
||||||
titleX = 130; // center point in title box
|
titleX = 110; // center point in title box
|
||||||
titleY = 28;
|
titleY = 15;
|
||||||
titleWidth = 180; // width of inner box of title
|
titleWidth = 180; // width of inner box of title
|
||||||
|
|
||||||
descX = 230 + kDescriptionVerticalBoxPadding;
|
descX = 260 + kDescriptionVerticalBoxPadding;
|
||||||
descY = 65 + kDescriptionHorizontalBoxPadding;
|
descY = 100 + kDescriptionHorizontalBoxPadding;
|
||||||
descHeight = 145;
|
descHeight = 145;
|
||||||
descWidth = 220;
|
descWidth = 220;
|
||||||
|
|
||||||
@@ -56,20 +59,20 @@ JGuiController(id, listener), fontId(fontId), mShowDetailsScreen( showDetailsOve
|
|||||||
detailedInfoBoxY = 235;
|
detailedInfoBoxY = 235;
|
||||||
starsOffsetX = 50;
|
starsOffsetX = 50;
|
||||||
|
|
||||||
statsX = 280;
|
statsX = 300;
|
||||||
statsY = 8;
|
statsY = 15;
|
||||||
statsHeight = 50;
|
statsHeight = 50;
|
||||||
statsWidth = 227;
|
statsWidth = 227;
|
||||||
|
|
||||||
mSelectedDeckId = startIndex;
|
mSelectedDeckId = startIndex;
|
||||||
|
|
||||||
avatarX = 230;
|
avatarX = 232;
|
||||||
avatarY = 8;
|
avatarY = 11;
|
||||||
|
|
||||||
menuInitialized = false;
|
menuInitialized = false;
|
||||||
|
|
||||||
float scrollerWidth = 80;
|
float scrollerWidth = 60;
|
||||||
mScroller = NEW TextScroller(Fonts::MAIN_FONT, 40, 230, scrollerWidth, 100, 1, 1);
|
mScroller = NEW TextScroller(Fonts::MAIN_FONT, 20, 235, scrollerWidth, 100, 1, 1);
|
||||||
|
|
||||||
mAutoTranslate = true;
|
mAutoTranslate = true;
|
||||||
maxItems = 7;
|
maxItems = 7;
|
||||||
@@ -189,7 +192,6 @@ void DeckMenu::Render()
|
|||||||
mSelectedDeck = currentMenuItem->meta;
|
mSelectedDeck = currentMenuItem->meta;
|
||||||
|
|
||||||
WFont *mainFont = resources.GetWFont(Fonts::MAIN_FONT);
|
WFont *mainFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||||
|
|
||||||
// display the "more info" button if special condition is met
|
// display the "more info" button if special condition is met
|
||||||
if (showDetailsScreen())
|
if (showDetailsScreen())
|
||||||
{
|
{
|
||||||
@@ -212,6 +214,7 @@ void DeckMenu::Render()
|
|||||||
}
|
}
|
||||||
// fill in the description part of the screen
|
// fill in the description part of the screen
|
||||||
string text = currentMenuItem->desc;
|
string text = currentMenuItem->desc;
|
||||||
|
mainFont->SetScale(kDescriptiveTextFontScale);
|
||||||
mainFont->DrawString(text.c_str(), descX, descY);
|
mainFont->DrawString(text.c_str(), descX, descY);
|
||||||
mFont->SetColor(ARGB(255,255,255,255));
|
mFont->SetColor(ARGB(255,255,255,255));
|
||||||
|
|
||||||
@@ -229,22 +232,22 @@ void DeckMenu::Render()
|
|||||||
{
|
{
|
||||||
mFont->SetColor(ARGB(150,255,255,255));
|
mFont->SetColor(ARGB(150,255,255,255));
|
||||||
}
|
}
|
||||||
mFont->SetScale(kMenuFontScale);
|
mFont->SetScale(kDefaultFontScale);
|
||||||
currentMenuItem->RenderWithOffset(-kLineHeight * startId);
|
currentMenuItem->RenderWithOffset(-kLineHeight * startId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderBackground();
|
RenderBackground();
|
||||||
|
|
||||||
if (!title.empty())
|
mFont->SetScale(kDescriptiveTextFontScale);
|
||||||
|
mScroller->Render();
|
||||||
|
mFont->SetScale(kDefaultFontScale);
|
||||||
|
|
||||||
|
if (!title.empty())
|
||||||
{
|
{
|
||||||
mFont->SetColor(ARGB(255,255,255,255));
|
mFont->SetColor(ARGB(255,255,255,255));
|
||||||
mFont->SetScale(titleFontScale);
|
|
||||||
mFont->DrawString(title.c_str(), titleX, titleY, JGETEXT_CENTER);
|
mFont->DrawString(title.c_str(), titleX, titleY, JGETEXT_CENTER);
|
||||||
}
|
}
|
||||||
mFont->SetScale(1.0f);
|
|
||||||
mScroller->Render();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeckMenu::Update(float dt)
|
void DeckMenu::Update(float dt)
|
||||||
|
|||||||
@@ -50,31 +50,31 @@ vector<DeckMetaData *> GameState::getValidDeckMetaData(const string& path, const
|
|||||||
std::ostringstream filename;
|
std::ostringstream filename;
|
||||||
filename << path << "/deck" << nbDecks << ".txt";
|
filename << path << "/deck" << nbDecks << ".txt";
|
||||||
DeckMetaData * meta = metas->get(filename.str(), statsPlayer);
|
DeckMetaData * meta = metas->get(filename.str(), statsPlayer);
|
||||||
|
string deckStatsFileName;
|
||||||
if (meta)
|
if (meta)
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
if (statsPlayer)
|
if (statsPlayer)
|
||||||
{
|
{
|
||||||
std::ostringstream smallDeckName;
|
std::ostringstream aiStatsDeckName;
|
||||||
smallDeckName << smallDeckPrefix << "_deck" << nbDecks;
|
aiStatsDeckName << smallDeckPrefix << "_deck" << nbDecks;
|
||||||
meta->loadStatsForPlayer(statsPlayer, smallDeckName.str());
|
deckStatsFileName = aiStatsDeckName.str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ostringstream playerStatsDeckName;
|
std::ostringstream playerStatsDeckName;
|
||||||
playerStatsDeckName << "stats/player_deck" << nbDecks << ".txt";
|
playerStatsDeckName << "stats/player_deck" << nbDecks << ".txt";
|
||||||
string deckstats = options.profileFile(playerStatsDeckName.str());
|
deckStatsFileName = options.profileFile(playerStatsDeckName.str());
|
||||||
meta->loadStatsForPlayer(NULL, deckstats);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta->loadStatsForPlayer(statsPlayer, deckStatsFileName);
|
||||||
retList.push_back(meta);
|
retList.push_back(meta);
|
||||||
nbDecks++;
|
nbDecks++;
|
||||||
}
|
}
|
||||||
meta = NULL;
|
meta = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(retList.begin(), retList.end(), sortByName);
|
std::sort(retList.begin(), retList.end(), sortByName);
|
||||||
|
|
||||||
return retList;
|
return retList;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,6 @@ void GameState::renderDeckMenu(DeckMenu * _menu, const vector<DeckMetaData *>& d
|
|||||||
DeckMetaData * deckMetaData = *i;
|
DeckMetaData * deckMetaData = *i;
|
||||||
string deckName = deckMetaData -> getName();
|
string deckName = deckMetaData -> getName();
|
||||||
string deckDescription = deckMetaData -> getDescription();
|
string deckDescription = deckMetaData -> getDescription();
|
||||||
//int deckId = deckMetaData -> getDeckId(); //do we need this?
|
|
||||||
_menu->Add(deckNumber++, deckName.c_str(), deckDescription.c_str(), false, deckMetaData);
|
_menu->Add(deckNumber++, deckName.c_str(), deckDescription.c_str(), false, deckMetaData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ void GameStateDuel::Start()
|
|||||||
deckManager->updateMetaDataList(&playerDeckList, false);
|
deckManager->updateMetaDataList(&playerDeckList, false);
|
||||||
playerDeckList.clear();
|
playerDeckList.clear();
|
||||||
|
|
||||||
DebugTrace("INFO: Player Deck menu has a size of " << sizeof( deckmenu ) );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,7 +277,7 @@ void GameStateDuel::ensureOpponentMenu()
|
|||||||
{
|
{
|
||||||
if (opponentMenu == NULL)
|
if (opponentMenu == NULL)
|
||||||
{
|
{
|
||||||
opponentMenu = NEW DeckMenu(DUEL_MENU_CHOOSE_OPPONENT, this, Fonts::OPTION_FONT, "Choose Your Opponent",
|
opponentMenu = NEW DeckMenu(DUEL_MENU_CHOOSE_OPPONENT, this, Fonts::OPTION_FONT, "Choose Opponent",
|
||||||
GameStateDuel::selectedAIDeckId, true);
|
GameStateDuel::selectedAIDeckId, true);
|
||||||
opponentMenu->Add(MENUITEM_RANDOM_AI, "Random");
|
opponentMenu->Add(MENUITEM_RANDOM_AI, "Random");
|
||||||
if (options[Options::EVILTWIN_MODE_UNLOCKED].number) opponentMenu->Add(MENUITEM_EVIL_TWIN, "Evil Twin", _(
|
if (options[Options::EVILTWIN_MODE_UNLOCKED].number) opponentMenu->Add(MENUITEM_EVIL_TWIN, "Evil Twin", _(
|
||||||
@@ -690,7 +689,7 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (controlId != MENUITEM_EVIL_TWIN && aiDeckSize > 0) // evil twin
|
else if (controlId != MENUITEM_EVIL_TWIN && aiDeckSize > 0) // evil twin
|
||||||
deckNumber = deckManager->getAIDeckOrderList()->at(controlId - 1)->getDeckId();
|
deckNumber = deckManager->getAIDeckOrderList()->at(controlId - 1)->getDeckId();
|
||||||
loadPlayer(1, deckNumber, 1);
|
loadPlayer(1, deckNumber, 1);
|
||||||
OpponentsDeckid = deckNumber;
|
OpponentsDeckid = deckNumber;
|
||||||
opponentMenu->Close();
|
opponentMenu->Close();
|
||||||
@@ -746,7 +745,8 @@ void GameStateDuel::ButtonPressed(int controllerId, int controlId)
|
|||||||
if (mGamePhase == DUEL_STATE_CHOOSE_DECK1)
|
if (mGamePhase == DUEL_STATE_CHOOSE_DECK1)
|
||||||
{
|
{
|
||||||
vector<DeckMetaData *> * playerDeck = deckManager->getPlayerDeckOrderList();
|
vector<DeckMetaData *> * playerDeck = deckManager->getPlayerDeckOrderList();
|
||||||
if (!premadeDeck && controlId > 0) deckNumber = playerDeck->at(controlId - 1)->getDeckId();
|
if (!premadeDeck && controlId > 0)
|
||||||
|
deckNumber = playerDeck->at(controlId - 1)->getDeckId();
|
||||||
loadPlayer(0, deckNumber);
|
loadPlayer(0, deckNumber);
|
||||||
deckmenu->Close();
|
deckmenu->Close();
|
||||||
mGamePhase = DUEL_STATE_CHOOSE_DECK1_TO_2;
|
mGamePhase = DUEL_STATE_CHOOSE_DECK1_TO_2;
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
primitive->setType(val);
|
primitive->setType(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,115 +1,167 @@
|
|||||||
/*
|
/*
|
||||||
* SimplePopup.cpp
|
* SimplePopup.cpp
|
||||||
*
|
*
|
||||||
* Created on: Nov 18, 2010
|
* Created on: Nov 18, 2010
|
||||||
* Author: Michael
|
* Author: Michael
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PrecompiledHeader.h"
|
#include "PrecompiledHeader.h"
|
||||||
#include "SimplePopup.h"
|
#include "SimplePopup.h"
|
||||||
#include "JTypes.h"
|
#include "JTypes.h"
|
||||||
#include "GameApp.h"
|
#include "GameApp.h"
|
||||||
#include "DeckStats.h"
|
#include "DeckStats.h"
|
||||||
#include "DeckManager.h"
|
#include "DeckManager.h"
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
SimplePopup::SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title, DeckMetaData* deckMetaData, MTGAllCards * collection) :
|
SimplePopup::SimplePopup(int id, JGuiListener* listener, const int fontId, const char * _title, DeckMetaData* deckMetaData, MTGAllCards * collection) :
|
||||||
JGuiController(id, listener), mFontId(fontId), mCollection(collection)
|
JGuiController(id, listener), mFontId(fontId), mCollection(collection)
|
||||||
{
|
{
|
||||||
mX = 35;
|
mX = 18;
|
||||||
mY = 50;
|
mY = 66;
|
||||||
mTitle = _title;
|
mWidth = 180.0f;
|
||||||
mMaxLines = 10;
|
mTitle = _title;
|
||||||
mTextFont = resources.GetWFont(fontId);
|
mMaxLines = 11;
|
||||||
this->mCount = 1;
|
|
||||||
mStatsWrapper = NULL;
|
mTextFont = resources.GetWFont(fontId);
|
||||||
Update(deckMetaData);
|
this->mCount = 1; // a hack to ensure the menus do book keeping correctly. Since we aren't adding items to the menu, this is required
|
||||||
}
|
mStatsWrapper = NULL;
|
||||||
|
Update(deckMetaData);
|
||||||
void SimplePopup::Render()
|
}
|
||||||
{
|
|
||||||
mClosed = false;
|
void SimplePopup::Render()
|
||||||
|
{
|
||||||
JRenderer *r = JRenderer::GetInstance();
|
mClosed = false;
|
||||||
string detailedInformation = getDetailedInformation(mDeckInformation->getFilename());
|
|
||||||
|
JRenderer *r = JRenderer::GetInstance();
|
||||||
mTextFont->SetScale(0.85f);
|
string detailedInformation = getDetailedInformation(mDeckInformation->getFilename());
|
||||||
const float textWidth = 183.0f;
|
|
||||||
const float textHeight = mTextFont->GetHeight() * 10;
|
mTextFont->SetScale(0.85f);
|
||||||
r->DrawRoundRect(mX, mY, textWidth, textHeight, 2.0f, ARGB( 255, 125, 255, 0) );
|
const float textHeight = mTextFont->GetHeight() * mMaxLines;
|
||||||
r->FillRoundRect(mX, mY, textWidth, textHeight, 2.0f, ARGB( 255, 0, 0, 0 ) );
|
r->DrawRoundRect(mX, mY, mWidth, textHeight, 2.0f, ARGB( 255, 125, 255, 0) );
|
||||||
|
r->FillRoundRect(mX, mY, mWidth, textHeight, 2.0f, ARGB( 255, 0, 0, 0 ) );
|
||||||
mTextFont->DrawString(detailedInformation.c_str(), mX + 20 , mY + 10);
|
|
||||||
|
drawBoundingBox( mX, mY, mWidth, textHeight );
|
||||||
}
|
|
||||||
void SimplePopup::Update(DeckMetaData* selectedDeck)
|
mTextFont->DrawString(detailedInformation.c_str(), mX + 20 , mY + 15);
|
||||||
{
|
|
||||||
mDeckInformation = selectedDeck;
|
}
|
||||||
SAFE_DELETE(mStatsWrapper);
|
|
||||||
mStatsWrapper = NEW StatsWrapper(mDeckInformation->getDeckId());
|
void SimplePopup::drawBoundingBox( float x, float y, float width, float height )
|
||||||
mStatsWrapper->updateStats(mDeckInformation->getFilename(), mCollection);
|
{
|
||||||
}
|
JRenderer *r = JRenderer::GetInstance();
|
||||||
|
|
||||||
|
//draw the corners
|
||||||
string SimplePopup::getDetailedInformation(string filename)
|
string topCornerImageName = "top_corner.png";
|
||||||
{
|
string bottomCornerImageName = "bottom_corner.png";
|
||||||
ostringstream oss;
|
string verticalBarImageName = "vert_bar.png";
|
||||||
oss
|
string horizontalBarImageName = "top_bar.png";
|
||||||
<< "------- Deck Summary -----" << endl
|
|
||||||
<< "Cards: "<< mStatsWrapper->cardCount << endl
|
const float boxWidth = ( width + 15 ) / 3.0f;
|
||||||
<< "Creatures: "<< setw(2) << mStatsWrapper->countCreatures
|
const float boxHeight = ( height + 15 ) / 3.0f;
|
||||||
<< " Enchantments: " << mStatsWrapper->countEnchantments << endl
|
|
||||||
<< "Instants: " << setw(4) << mStatsWrapper->countInstants
|
drawHorzPole( horizontalBarImageName, false, false, x, y, boxWidth );
|
||||||
<< " Sorceries: " << setw(2) << mStatsWrapper->countSorceries << endl
|
drawHorzPole( horizontalBarImageName, false, true, x, y + height, boxWidth );
|
||||||
<< "Lands: "
|
|
||||||
<< "A: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] << " "
|
drawVertPole( verticalBarImageName, false, false, x, y, boxHeight );
|
||||||
<< "G: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] + mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] << " "
|
drawVertPole( verticalBarImageName, true, false, x + width, y, boxHeight );
|
||||||
<< "R: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_RED ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_RED ] << " "
|
|
||||||
<< "U: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_BLUE ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_BLUE ] << " "
|
drawCorner( topCornerImageName, false, false, x, y );
|
||||||
<< "B: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_BLACK ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_BLACK ] << " "
|
drawCorner( topCornerImageName, true, false, x + width, y );
|
||||||
<< "W: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_WHITE ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_WHITE ] << endl
|
drawCorner( bottomCornerImageName, false, false, x, y + height );
|
||||||
<< " --- Mana Curve --- " << endl;
|
drawCorner( bottomCornerImageName, true, false, x + width, y + height );
|
||||||
|
}
|
||||||
for ( int costIdx = 0; costIdx < Constants::STATS_MAX_MANA_COST+1; ++costIdx )
|
|
||||||
if ( mStatsWrapper->countCardsPerCost[ costIdx ] > 0 )
|
void SimplePopup::Update(DeckMetaData* selectedDeck)
|
||||||
oss << costIdx << ": " << setw(2) << left << mStatsWrapper->countCardsPerCost[ costIdx ] << " ";
|
{
|
||||||
|
mDeckInformation = selectedDeck;
|
||||||
oss << endl;
|
SAFE_DELETE(mStatsWrapper);
|
||||||
|
mStatsWrapper = NEW StatsWrapper(mDeckInformation->getDeckId());
|
||||||
oss
|
mStatsWrapper->updateStats(mDeckInformation->getFilename(), mCollection);
|
||||||
<< " --- Average Cost --- " << endl
|
}
|
||||||
<< "Creature: "<< setprecision(2) << mStatsWrapper->avgCreatureCost << endl
|
|
||||||
<< "Mana: " << setprecision(2) << mStatsWrapper->avgManaCost << " "
|
|
||||||
<< "Spell: " << setprecision(2) << mStatsWrapper->avgSpellCost << endl;
|
string SimplePopup::getDetailedInformation(string filename)
|
||||||
|
{
|
||||||
return oss.str();
|
ostringstream oss;
|
||||||
}
|
oss
|
||||||
|
<< "------- Deck Summary -----" << endl
|
||||||
void SimplePopup::Update(float dt)
|
<< "Cards: "<< mStatsWrapper->cardCount << endl
|
||||||
{
|
<< "Creatures: "<< setw(2) << mStatsWrapper->countCreatures
|
||||||
JButton key = mEngine->ReadButton();
|
<< " Enchantments: " << mStatsWrapper->countEnchantments << endl
|
||||||
CheckUserInput(key);
|
<< "Instants: " << setw(4) << mStatsWrapper->countInstants
|
||||||
}
|
<< " Sorceries: " << setw(2) << mStatsWrapper->countSorceries << endl
|
||||||
|
<< "Lands: "
|
||||||
void SimplePopup::Close()
|
<< "A: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] << " "
|
||||||
{
|
<< "G: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] + mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] << " "
|
||||||
mClosed = true;
|
<< "R: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_RED ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_RED ] << " "
|
||||||
mCount = 0;
|
<< "U: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_BLUE ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_BLUE ] << " "
|
||||||
}
|
<< "B: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_BLACK ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_BLACK ] << " "
|
||||||
|
<< "W: " << setw(2) << left << mStatsWrapper->countLandsPerColor[ Constants::MTG_COLOR_WHITE ] + mStatsWrapper->countBasicLandsPerColor[ Constants::MTG_COLOR_WHITE ] << endl
|
||||||
SimplePopup::~SimplePopup(void)
|
<< " --- Mana Curve --- " << endl;
|
||||||
{
|
|
||||||
mTextFont = NULL;
|
for ( int costIdx = 0; costIdx < Constants::STATS_MAX_MANA_COST+1; ++costIdx )
|
||||||
mDeckInformation = NULL;
|
if ( mStatsWrapper->countCardsPerCost[ costIdx ] > 0 )
|
||||||
SAFE_DELETE(mStatsWrapper);
|
oss << costIdx << ": " << setw(2) << left << mStatsWrapper->countCardsPerCost[ costIdx ] << " ";
|
||||||
}
|
|
||||||
|
oss << endl;
|
||||||
void SimplePopup::drawHorzPole(float x, float y, float width)
|
|
||||||
{
|
oss
|
||||||
|
<< " --- Average Cost --- " << endl
|
||||||
}
|
<< "Creature: "<< setprecision(2) << mStatsWrapper->avgCreatureCost << endl
|
||||||
|
<< "Mana: " << setprecision(2) << mStatsWrapper->avgManaCost << " "
|
||||||
void SimplePopup::drawVertPole(float x, float y, float height)
|
<< "Spell: " << setprecision(2) << mStatsWrapper->avgSpellCost << endl;
|
||||||
{
|
|
||||||
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SimplePopup::Update(float dt)
|
||||||
|
{
|
||||||
|
JButton key = mEngine->ReadButton();
|
||||||
|
CheckUserInput(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// drawing routines
|
||||||
|
void SimplePopup::drawCorner(string imageName, bool flipX, bool flipY, float x, float y)
|
||||||
|
{
|
||||||
|
JRenderer* r = JRenderer::GetInstance();
|
||||||
|
JQuad *horizontalBarImage = resources.RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
|
||||||
|
horizontalBarImage->SetHFlip(flipX);
|
||||||
|
horizontalBarImage->SetVFlip(flipY);
|
||||||
|
|
||||||
|
r->RenderQuad( horizontalBarImage, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimplePopup::drawHorzPole(string imageName, bool flipX = false, bool flipY = false, float x = 0, float y = 0, float width = SCREEN_WIDTH_F)
|
||||||
|
{
|
||||||
|
JRenderer* r = JRenderer::GetInstance();
|
||||||
|
JQuad *horizontalBarImage = resources.RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
|
||||||
|
horizontalBarImage->SetHFlip(flipX);
|
||||||
|
horizontalBarImage->SetVFlip(flipY);
|
||||||
|
|
||||||
|
r->RenderQuad( horizontalBarImage, x, y, 0, width );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimplePopup::drawVertPole(string imageName, bool flipX = false, bool flipY = false, float x = 0, float y = 0, float height = SCREEN_HEIGHT_F)
|
||||||
|
{
|
||||||
|
JRenderer* r = JRenderer::GetInstance();
|
||||||
|
JQuad *verticalBarImage = resources.RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
|
||||||
|
verticalBarImage->SetHFlip(flipX);
|
||||||
|
verticalBarImage->SetVFlip(flipY);
|
||||||
|
|
||||||
|
r->RenderQuad( verticalBarImage, x, y, 0, 1.0f, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SimplePopup::Close()
|
||||||
|
{
|
||||||
|
mClosed = true;
|
||||||
|
mCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SimplePopup::~SimplePopup(void)
|
||||||
|
{
|
||||||
|
mTextFont = NULL;
|
||||||
|
mDeckInformation = NULL;
|
||||||
|
SAFE_DELETE(mStatsWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user