reformatting code according to guidelines defined at

http://wololo.net/forum/viewtopic.php?f=35&t=2235&start=10
This commit is contained in:
techdragon.nguyen@gmail.com
2010-11-16 00:55:16 +00:00
parent c79fdcbf50
commit acd7bb1aa4
103 changed files with 38044 additions and 31222 deletions

View File

@@ -6,92 +6,92 @@
#include "GameApp.h"
#include <iomanip>
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const char * _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats)
: DeckMenu( id, listener, fontId, _title ), selectedDeck(_selectedDeck), stw( stats )
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const char * _title, DeckDataWrapper *_selectedDeck,
StatsWrapper *stats) :
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
{
backgroundName = "DeckEditorMenuBackdrop";
deckTitle = selectedDeck ? selectedDeck->parent->meta_name : "";
backgroundName = "DeckEditorMenuBackdrop";
mX = 123;
mY = 70;
starsOffsetX = 50;
deckTitle = selectedDeck ? selectedDeck->parent->meta_name : "";
titleX = 110; // center point in title box
titleY = 25;
titleWidth = 180; // width of inner box of title
mX = 123;
mY = 70;
starsOffsetX = 50;
descX = 275;
descY = 80;
descHeight = 154;
descWidth = 175;
statsHeight = 50;
statsWidth = 185;
statsX = 280;
statsY = 12;
avatarX = 222;
avatarY = 8;
titleX = 110; // center point in title box
titleY = 25;
titleWidth = 180; // width of inner box of title
float scrollerWidth = 80;
SAFE_DELETE(scroller); // need to delete the scroller init in the base class
scroller = NEW TextScroller(Fonts::MAIN_FONT, 40 , 230, scrollerWidth, 100, 1, 1);
descX = 275;
descY = 80;
descHeight = 154;
descWidth = 175;
statsHeight = 50;
statsWidth = 185;
statsX = 280;
statsY = 12;
avatarX = 222;
avatarY = 8;
float scrollerWidth = 80;
SAFE_DELETE(scroller); // need to delete the scroller init in the base class
scroller = NEW TextScroller(Fonts::MAIN_FONT, 40, 230, scrollerWidth, 100, 1, 1);
}
void DeckEditorMenu::Render()
{
JRenderer *r = JRenderer::GetInstance();
r->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,ARGB(200,0,0,0));
JRenderer *r = JRenderer::GetInstance();
r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(200,0,0,0));
DeckMenu::Render();
if ( deckTitle.size() > 0 )
{
WFont *mainFont = resources.GetWFont( Fonts::OPTION_FONT );
DWORD currentColor = mainFont->GetColor();
mainFont->SetColor( ARGB(255,255,255,255) );
mainFont->DrawString( deckTitle.c_str(), statsX + (statsWidth / 2), statsHeight / 2 , JGETEXT_CENTER);
mainFont->SetColor( currentColor );
}
DeckMenu::Render();
if (deckTitle.size() > 0)
{
WFont *mainFont = resources.GetWFont(Fonts::OPTION_FONT);
DWORD currentColor = mainFont->GetColor();
mainFont->SetColor(ARGB(255,255,255,255));
mainFont->DrawString(deckTitle.c_str(), statsX + (statsWidth / 2), statsHeight / 2, JGETEXT_CENTER);
mainFont->SetColor(currentColor);
}
if ( stw && selectedDeck )
drawDeckStatistics();
if (stw && selectedDeck)
drawDeckStatistics();
}
void DeckEditorMenu::drawDeckStatistics()
{
ostringstream deckStatsString;
ostringstream deckStatsString;
deckStatsString
<< "------- Deck Summary -----" << endl
<< "Cards: "<< selectedDeck->getCount() << endl
<< "Creatures: "<< setw(2) << stw->countCreatures
<< " Enchantments: " << stw->countEnchantments << endl
<< "Instants: " << setw(4) << stw->countInstants
<< " Sorceries: " << setw(2) << stw->countSorceries << endl
<< "Lands: "
<< "A: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] << " "
<< "G: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] + stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] << " "
<< "R: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_RED ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_RED ] << " "
<< "U: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLUE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLUE ] << " "
<< "B: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLACK ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLACK ] << " "
<< "W: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_WHITE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_WHITE ] << endl
deckStatsString
<< "------- Deck Summary -----" << endl
<< "Cards: "<< selectedDeck->getCount() << endl
<< "Creatures: "<< setw(2) << stw->countCreatures
<< " Enchantments: " << stw->countEnchantments << endl
<< "Instants: " << setw(4) << stw->countInstants
<< " Sorceries: " << setw(2) << stw->countSorceries << endl
<< "Lands: "
<< "A: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] << " "
<< "G: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] + stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] << " "
<< "R: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_RED ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_RED ] << " "
<< "U: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLUE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLUE ] << " "
<< "B: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLACK ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLACK ] << " "
<< "W: " << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_WHITE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_WHITE ] << endl
<< " --- Card color count --- " << endl
<< "A: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_ARTIFACT) << " "
<< "G: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_GREEN) << " "
<< "U: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLUE) << " "
<< "R: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_RED) << " "
<< "B: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLACK) << " "
<< "W: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_WHITE) << endl
<< " --- Card color count --- " << endl
<< "A: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_ARTIFACT) << " "
<< "G: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_GREEN) << " "
<< "U: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLUE) << " "
<< "R: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_RED) << " "
<< "B: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLACK) << " "
<< "W: " << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_WHITE) << endl
<< " --- Average Cost --- " << endl
<< "Creature: "<< setprecision(2) << stw->avgCreatureCost << endl
<< "Mana: " << setprecision(2) << stw->avgManaCost << " "
<< "Spell: " << setprecision(2) << stw->avgSpellCost << endl;
<< " --- Average Cost --- " << endl
<< "Creature: "<< setprecision(2) << stw->avgCreatureCost << endl
<< "Mana: " << setprecision(2) << stw->avgManaCost << " "
<< "Spell: " << setprecision(2) << stw->avgSpellCost << endl;
WFont *mainFont = resources.GetWFont( Fonts::MAIN_FONT );
mainFont->DrawString( deckStatsString.str().c_str(), descX, descY + 25 );
@@ -99,5 +99,5 @@ void DeckEditorMenu::drawDeckStatistics()
DeckEditorMenu::~DeckEditorMenu()
{
SAFE_DELETE( scroller );
SAFE_DELETE( scroller );
}