-AlternatRender calls fixes
-Replaced "borderline" default cards design with something more generic
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 12 KiB |
@@ -28,7 +28,7 @@ struct CardGui : public PlayGuiObject {
|
|||||||
virtual void Render() = 0;
|
virtual void Render() = 0;
|
||||||
void RenderBig(const Pos&);
|
void RenderBig(const Pos&);
|
||||||
virtual void Update(float dt) = 0;
|
virtual void Update(float dt) = 0;
|
||||||
static void alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos);
|
static void alternateRender(MTGCard * card, const Pos& pos);
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -639,7 +639,8 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
|||||||
mFont->SetScale(scaleBackup);
|
mFont->SetScale(scaleBackup);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// CardGui::alternateRender(card, mIcons, x_center, y + 142.5*scale, 0, scale);
|
Pos pos = Pos(x, y, scale* 285/250, 0.0, 255);
|
||||||
|
CardGui::alternateRender(card, pos);
|
||||||
quad = cache.getThumb(card);
|
quad = cache.getThumb(card);
|
||||||
if (quad){
|
if (quad){
|
||||||
float _scale = 285 * scale / quad->mHeight;
|
float _scale = 285 * scale / quad->mHeight;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void CardView::Render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CardGui::alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos){
|
void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||||
// Draw the "unknown" card model
|
// Draw the "unknown" card model
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
JQuad * q;
|
JQuad * q;
|
||||||
@@ -128,11 +128,12 @@ void CardGui::alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos
|
|||||||
font->SetScale(0.8 * pos.actZ);
|
font->SetScale(0.8 * pos.actZ);
|
||||||
|
|
||||||
{
|
{
|
||||||
const char* name = _(card->getName()).c_str();
|
char name[4096];
|
||||||
|
sprintf(name, _(card->getName()).c_str());
|
||||||
float w = font->GetStringWidth(name) * 0.8 * pos.actZ;
|
float w = font->GetStringWidth(name) * 0.8 * pos.actZ;
|
||||||
if (w > BigWidth - 30)
|
if (w > BigWidth - 30)
|
||||||
font->SetScale((BigWidth - 30) / w);
|
font->SetScale((BigWidth - 30) / w);
|
||||||
font->DrawString(name, pos.actX + 22 - BigWidth / 2, pos.actY + 22 - BigHeight / 2);
|
font->DrawString(name, pos.actX + (22 - BigWidth / 2)*pos.actZ, pos.actY + (25 - BigHeight / 2)*pos.actZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the description
|
// Write the description
|
||||||
@@ -141,7 +142,7 @@ void CardGui::alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos
|
|||||||
const std::vector<string> txt = card->formattedText();
|
const std::vector<string> txt = card->formattedText();
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
for (std::vector<string>::const_iterator it = txt.begin(); it != txt.end(); ++it, ++i)
|
for (std::vector<string>::const_iterator it = txt.begin(); it != txt.end(); ++it, ++i)
|
||||||
font->DrawString(it->c_str(), pos.actX + 22 - BigWidth / 2, pos.actY + 35 + 11 * i);
|
font->DrawString(it->c_str(), pos.actX + (22 - BigWidth / 2)*pos.actZ, pos.actY + (-BigHeight/2 + 80 + 11 * i)*pos.actZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the strength
|
// Write the strength
|
||||||
@@ -150,7 +151,7 @@ void CardGui::alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos
|
|||||||
char buffer[32];
|
char buffer[32];
|
||||||
sprintf(buffer, "%i/%i", card->power, card->toughness);
|
sprintf(buffer, "%i/%i", card->power, card->toughness);
|
||||||
float w = font->GetStringWidth(buffer) * 0.8;
|
float w = font->GetStringWidth(buffer) * 0.8;
|
||||||
font->DrawString(buffer, pos.actX + 65 - w / 2, pos.actY + 106);
|
font->DrawString(buffer, pos.actX + (65 - w / 2)*pos.actZ, pos.actY + (106)*pos.actZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mana
|
// Mana
|
||||||
@@ -160,18 +161,20 @@ void CardGui::alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos
|
|||||||
unsigned int j = 0;
|
unsigned int j = 0;
|
||||||
unsigned char t = (JGE::GetInstance()->GetTime() / 3) & 0xFF;
|
unsigned char t = (JGE::GetInstance()->GetTime() / 3) & 0xFF;
|
||||||
unsigned char v = t + 127;
|
unsigned char v = t + 127;
|
||||||
|
float yOffset = -112;
|
||||||
while ((h = manacost->getHybridCost(j)))
|
while ((h = manacost->getHybridCost(j)))
|
||||||
{
|
{
|
||||||
float scale = pos.actZ * 0.05 * cosf(2*M_PI*((float)t)/256.0);
|
float scale = pos.actZ * 0.05 * cosf(2*M_PI*((float)t)/256.0);
|
||||||
|
|
||||||
if (scale < 0)
|
if (scale < 0)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[h->color1], pos.actX - 12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0), pos.actY - 115 + 3 * cosf(2*M_PI*((float)(t-35))/256.0), 0, 0.4 + scale, 0.4 + scale);
|
renderer->RenderQuad(manaIcons[h->color1], pos.actX + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
||||||
renderer->RenderQuad(manaIcons[h->color2], pos.actX - 12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0), pos.actY - 115 + 3 * cosf(2*M_PI*((float)(v-35))/256.0), 0, 0.4 - scale, 0.4 - scale);
|
renderer->RenderQuad(manaIcons[h->color2], pos.actX + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[h->color2], pos.actX - 12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0), pos.actY - 115 + 3 * cosf(2*M_PI*((float)(v-35))/256.0), 0, 0.4 - scale, 0.4 - scale);
|
renderer->RenderQuad(manaIcons[h->color2], pos.actX + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
||||||
renderer->RenderQuad(manaIcons[h->color1], pos.actX - 12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0), pos.actY - 115 + 3 * cosf(2*M_PI*((float)(t-35))/256.0), 0, 0.4 + scale, 0.4 + scale);
|
renderer->RenderQuad(manaIcons[h->color1], pos.actX + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
||||||
}
|
}
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
@@ -179,7 +182,7 @@ void CardGui::alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos
|
|||||||
{
|
{
|
||||||
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[i], pos.actX - 12*j + 75, pos.actY - 115, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
renderer->RenderQuad(manaIcons[i], pos.actX + (-12*j + 75)*pos.actZ, pos.actY + (yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,12 +191,13 @@ void CardGui::alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos
|
|||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
sprintf(buffer, "%d", cost);
|
sprintf(buffer, "%d", cost);
|
||||||
renderer->RenderQuad(manaIcons[0], pos.actX - 12*j + 75, pos.actY - 115, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
renderer->RenderQuad(manaIcons[0], pos.actX + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||||
float w = font->GetStringWidth(buffer);
|
float w = font->GetStringWidth(buffer);
|
||||||
font->DrawString(buffer, pos.actX - 12*j + 76 - w/2, pos.actY - 120);
|
font->DrawString(buffer, pos.actX +(- 12*j + 76 - w/2)*pos.actZ, pos.actY + (yOffset - 5)*pos.actZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//types
|
||||||
{
|
{
|
||||||
string s = "";
|
string s = "";
|
||||||
for (int i = card->nb_types - 1; i > 0; --i)
|
for (int i = card->nb_types - 1; i > 0; --i)
|
||||||
@@ -202,7 +206,7 @@ void CardGui::alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos
|
|||||||
s += " - ";
|
s += " - ";
|
||||||
}
|
}
|
||||||
s += _(Subtypes::subtypesList->find(card->types[0]));
|
s += _(Subtypes::subtypesList->find(card->types[0]));
|
||||||
font->DrawString(s.c_str(), pos.actX + 22 - BigWidth / 2, pos.actY + 17);
|
font->DrawString(s.c_str(), pos.actX + (22 - BigWidth / 2)*pos.actZ, pos.actY + (49 - BigHeight / 2)*pos.actZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
font->SetScale(backup_scale);
|
font->SetScale(backup_scale);
|
||||||
@@ -229,7 +233,7 @@ void CardGui::RenderBig(const Pos& pos){
|
|||||||
|
|
||||||
// If we come here, we do not have the picture.
|
// If we come here, we do not have the picture.
|
||||||
MTGCard * mtgcard = card->model;
|
MTGCard * mtgcard = card->model;
|
||||||
alternateRender(card,manaIcons,pos);
|
alternateRender(card,pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ void ShopItem::Render(){
|
|||||||
quad->SetColor(ARGB(255,255,255,255));
|
quad->SetColor(ARGB(255,255,255,255));
|
||||||
renderer->RenderQuad(quad,SCREEN_WIDTH - 105,SCREEN_HEIGHT/2 - 5,0, 0.9f,0.9f);
|
renderer->RenderQuad(quad,SCREEN_WIDTH - 105,SCREEN_HEIGHT/2 - 5,0, 0.9f,0.9f);
|
||||||
}else{
|
}else{
|
||||||
//if (card) CardGui::alternateRender(card,NULL,SCREEN_WIDTH/2 + 100 + 20,133,0, 0.9f);
|
if (card) CardGui::alternateRender(card,Pos(SCREEN_WIDTH/2 + 100 + 20,133,0.9f* 285/250, 0,255));
|
||||||
|
|
||||||
}
|
}
|
||||||
mFont->DrawString(mText.c_str(), SCREEN_WIDTH/2 - 50, SCREEN_HEIGHT - 16,JGETEXT_CENTER);
|
mFont->DrawString(mText.c_str(), SCREEN_WIDTH/2 - 50, SCREEN_HEIGHT - 16,JGETEXT_CENTER);
|
||||||
}
|
}
|
||||||
|
|||||||