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:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user