promoted StatsWrapper struct into class
altered deck editor information display for statistics
This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
<<<<<<< .mine
|
||||
#include "PrecompiledHeader.h"
|
||||
#include <iomanip>
|
||||
#include "DeckEditorMenu.h"
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "DeckEditorMenu.h"
|
||||
#include "DeckDataWrapper.h"
|
||||
#include "DeckStats.h"
|
||||
#include "JTypes.h"
|
||||
|
||||
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const char * _title)
|
||||
: DeckMenu( id, listener, fontId, _title )
|
||||
#include "GameApp.h"
|
||||
|
||||
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 : "";
|
||||
|
||||
mX = 120;
|
||||
mY = 70;
|
||||
@@ -37,10 +47,53 @@ void DeckEditorMenu::Render()
|
||||
{
|
||||
JRenderer *r = JRenderer::GetInstance();
|
||||
r->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,ARGB(200,0,0,0));
|
||||
DeckMenu::Render();
|
||||
}
|
||||
|
||||
DeckEditorMenu::~DeckEditorMenu()
|
||||
{
|
||||
SAFE_DELETE( scroller );
|
||||
}
|
||||
DeckMenu::Render();
|
||||
WFont *mainFont = resources.GetWFont( Fonts::MAIN_FONT );
|
||||
mainFont->DrawString( deckTitle.c_str(), statsX, statsY );
|
||||
|
||||
if ( stw && selectedDeck )
|
||||
drawDeckStatistics();
|
||||
|
||||
}
|
||||
|
||||
void DeckEditorMenu::drawDeckStatistics()
|
||||
{
|
||||
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
|
||||
|
||||
<< " --- 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;
|
||||
|
||||
WFont *mainFont = resources.GetWFont( Fonts::MAIN_FONT );
|
||||
mainFont->DrawString( deckStatsString.str().c_str(), descX, descY + 25 );
|
||||
}
|
||||
|
||||
DeckEditorMenu::~DeckEditorMenu()
|
||||
{
|
||||
SAFE_DELETE( scroller );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user