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:
@@ -74,7 +74,7 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JQuad * quad = resources.RetrieveCard(source,CACHE_THUMB);
|
||||
if (!quad)
|
||||
quad = CardGui::alternateThumbQuad(source);
|
||||
quad = CardGui::AlternateThumbQuad(source);
|
||||
if (quad){
|
||||
quad->SetColor(ARGB(255,255,255,255));
|
||||
float scale = mHeight / quad->mHeight;
|
||||
@@ -83,19 +83,10 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string
|
||||
mFont->DrawString(_(alt1).c_str(),x,y-15);
|
||||
}
|
||||
|
||||
if (bigQuad){
|
||||
int showMode = CardSelectorSingleton::Instance()->GetDrawMode();
|
||||
if (bigQuad)
|
||||
{
|
||||
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
|
||||
switch(showMode){
|
||||
case BIG_MODE_SHOW:
|
||||
CardGui::RenderBig(source,pos);
|
||||
break;
|
||||
case BIG_MODE_TEXT:
|
||||
CardGui::alternateRender(source, pos);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
CardGui::DrawCard(source, pos, CardSelectorSingleton::Instance()->GetDrawMode());
|
||||
}
|
||||
|
||||
if (targetQuad){
|
||||
|
||||
Reference in New Issue
Block a user