1st step in refactoring some of the card rendering logic - currently, each 'client' has duplicated code having to deal with how to render the full card graphic vs text mode vs using a 'back' image if a card isn't found. This is a first pass at consolidating some of that logic to one location - the ultimate goal being, eventually, the resource cache will actually own the notion of whether it's handing out a real card image or a default filler if the card isn't available, and the client code rendering the card should be oblivious.

In this change, I made the CardGui's RenderBig() and AlternateRender() functions protected; anyone wanting to render a card simply calls RenderCard(), and the card drawing mode is passed along as a param.
This commit is contained in:
wrenczes@gmail.com
2010-11-14 08:15:26 +00:00
parent e758c7eea1
commit 27fd107208
9 changed files with 125 additions and 110 deletions
+5 -15
View File
@@ -212,28 +212,18 @@ void CardDisplay::Render(){
}
//TODO: CardSelector should handle the graveyard and the library in the future...
if (mCount && mObjects[mCurr] != NULL){
if (mCount && mObjects[mCurr] != NULL)
{
mObjects[mCurr]->Render();
CardGui * cardg = ((CardGui *)mObjects[mCurr]);
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
int showMode = BIG_MODE_SHOW;
if (game){
showMode = CardSelectorSingleton::Instance()->GetDrawMode();
if (game)
{
pos.actY = 150;
if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2;
}
switch(showMode){
case BIG_MODE_SHOW:
cardg->RenderBig(pos);
break;
case BIG_MODE_TEXT:
cardg->alternateRenderBig(pos);
break;
default:
break;
}
cardg->DrawCard(pos, CardSelectorSingleton::Instance()->GetDrawMode());
}
}