Erwan
- a few graphical fixes in shop and DeckViewer
This commit is contained in:
@@ -29,6 +29,7 @@ void CardView::Update(float dt)
|
||||
PlayGuiObject::Update(dt);
|
||||
}
|
||||
|
||||
|
||||
void CardView::Render()
|
||||
{
|
||||
JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MAIN_FONT);
|
||||
@@ -102,29 +103,11 @@ void CardView::Render()
|
||||
PlayGuiObject::Render();
|
||||
}
|
||||
|
||||
void CardGui::RenderBig(const Pos& pos){
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
if (quad){
|
||||
quad->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||
float scale = pos.actZ * 257.f / quad->mHeight;
|
||||
renderer->RenderQuad(quad, pos.actX, pos.actY, pos.actT, scale, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
JQuad * q;
|
||||
if ((q = cache.getThumb(card)))
|
||||
{
|
||||
float scale = pos.actZ * 250 / q->mHeight;
|
||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||
renderer->RenderQuad(q, pos.actX, pos.actY, pos.actT, scale, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we come here, we do not have the picture.
|
||||
|
||||
void CardGui::alternateRender(MTGCard * card, JQuad ** manaIcons, const Pos& pos){
|
||||
// Draw the "unknown" card model
|
||||
MTGCard * mtgcard = card->model;
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JQuad * q;
|
||||
switch(card->getColor())
|
||||
{
|
||||
case Constants::MTG_COLOR_GREEN: q = GameApp::CommonRes->GetQuad("green"); break;
|
||||
@@ -165,7 +148,7 @@ void CardGui::RenderBig(const Pos& pos){
|
||||
if (card->isCreature())
|
||||
{
|
||||
char buffer[32];
|
||||
sprintf(buffer, "%i/%i", card->power, card->life);
|
||||
sprintf(buffer, "%i/%i", card->power, card->toughness);
|
||||
float w = font->GetStringWidth(buffer) * 0.8;
|
||||
font->DrawString(buffer, pos.actX + 65 - w / 2, pos.actY + 106);
|
||||
}
|
||||
@@ -225,6 +208,30 @@ void CardGui::RenderBig(const Pos& pos){
|
||||
font->SetScale(backup_scale);
|
||||
}
|
||||
|
||||
void CardGui::RenderBig(const Pos& pos){
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
if (quad){
|
||||
quad->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||
float scale = pos.actZ * 257.f / quad->mHeight;
|
||||
renderer->RenderQuad(quad, pos.actX, pos.actY, pos.actT, scale, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
JQuad * q;
|
||||
if ((q = cache.getThumb(card)))
|
||||
{
|
||||
float scale = pos.actZ * 250 / q->mHeight;
|
||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||
renderer->RenderQuad(q, pos.actX, pos.actY, pos.actT, scale, scale);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we come here, we do not have the picture.
|
||||
MTGCard * mtgcard = card->model;
|
||||
alternateRender(card,manaIcons,pos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
MTGCardInstance* CardView::getCard() { return card; }
|
||||
|
||||
@@ -43,8 +43,6 @@ GameApp::GameApp(): JApp()
|
||||
players[0] = 0;
|
||||
players[1] = 0;
|
||||
gameType = GAME_TYPE_CLASSIC;
|
||||
//gameType = GAME_TYPE_MOMIR;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -97,6 +95,8 @@ void GameApp::Create()
|
||||
|
||||
CommonRes->CreateTexture("sets/back.jpg");
|
||||
CommonRes->CreateQuad("back", "sets/back.jpg", 0, 0, 200, 285);
|
||||
CommonRes->GetQuad("back")->SetHotSpot(100, 145);
|
||||
|
||||
CommonRes->CreateTexture("sets/back_thumb.jpg");
|
||||
CommonRes->CreateQuad("back_thumb", "sets/back_thumb.jpg", 0, 0, MTG_MINIIMAGE_WIDTH, MTG_MINIIMAGE_HEIGHT);
|
||||
|
||||
@@ -166,8 +166,7 @@ void GameApp::Create()
|
||||
//CommonRes->CreateTexture("graphics/interrupt.png");
|
||||
//CommonRes->CreateQuad("interrupt", "graphics/interrupt.png", 0, 0, 256, 128);
|
||||
|
||||
cache = NEW TexturesCache();
|
||||
collection = NEW MTGAllCards(cache);
|
||||
collection = NEW MTGAllCards(&cache);
|
||||
|
||||
|
||||
Particles[0] = NEW hgeParticleSystem("graphics/particle1.psi", CommonRes->GetQuad("particles"));
|
||||
@@ -233,7 +232,6 @@ void GameApp::Destroy()
|
||||
collection->destroyAllCards();
|
||||
SAFE_DELETE(collection);
|
||||
}
|
||||
SAFE_DELETE(cache);
|
||||
SampleCache::DestroyInstance();
|
||||
delete(DeckStats::GetInstance());
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ void GameStateMenu::fillScroller(){
|
||||
scroller->Add(buff2);
|
||||
|
||||
|
||||
DeckDataWrapper* ddw = NEW DeckDataWrapper(NEW MTGDeck(RESPATH"/player/collection.dat", mParent->cache,mParent->collection));
|
||||
DeckDataWrapper* ddw = NEW DeckDataWrapper(NEW MTGDeck(RESPATH"/player/collection.dat", &cache,mParent->collection));
|
||||
int totalCards = ddw->getCount();
|
||||
if (totalCards){
|
||||
sprintf(buff2, _("You have a total of %i cards in your collection").c_str(),totalCards);
|
||||
@@ -401,7 +401,7 @@ void GameStateMenu::createUsersFirstDeck(int setId){
|
||||
sprintf(buf, "setID: %i", setId);
|
||||
OutputDebugString(buf);
|
||||
#endif
|
||||
MTGDeck *mCollection = NEW MTGDeck(RESPATH"/player/collection.dat", mParent->cache, mParent->collection);
|
||||
MTGDeck *mCollection = NEW MTGDeck(RESPATH"/player/collection.dat", &cache, mParent->collection);
|
||||
//10 lands of each
|
||||
int sets[] = {setId};
|
||||
if (!mCollection->addRandomCards(10, sets,1, Constants::RARITY_L,"Forest")){
|
||||
|
||||
@@ -68,9 +68,10 @@ ShopItem::ShopItem(int id, JLBFont *font, int _cardid, float _xy[], bool hasFocu
|
||||
quantity = 1 + (rand() % 4);
|
||||
if (card->getRarity() == Constants::RARITY_L) quantity = 50;
|
||||
quad = NULL;
|
||||
// thumb = card->getThumb();
|
||||
// if (!thumb)
|
||||
thumb = GameApp::CommonRes->GetQuad("back_thumb");
|
||||
|
||||
thumb = cache.getThumb(card);
|
||||
|
||||
if (!thumb) thumb = GameApp::CommonRes->GetQuad("back_thumb");
|
||||
if (thumb){
|
||||
mesh=NEW hgeDistortionMesh(2,2);
|
||||
mesh->SetTexture(thumb->mTex);
|
||||
@@ -158,9 +159,9 @@ void ShopItem::Render(){
|
||||
if (card) quad = cache.getQuad(card);
|
||||
if (quad){
|
||||
quad->SetColor(ARGB(255,255,255,255));
|
||||
renderer->RenderQuad(quad,SCREEN_WIDTH/2 + 50,5,0, 0.9f,0.9f);
|
||||
renderer->RenderQuad(quad,SCREEN_WIDTH - 105,SCREEN_HEIGHT/2 - 5,0, 0.9f,0.9f);
|
||||
}else{
|
||||
// if (card) CardGui::alternateRender(card,NULL,SCREEN_WIDTH/2 + 100 + 20,133,0, 0.9f);
|
||||
//if (card) CardGui::alternateRender(card,NULL,SCREEN_WIDTH/2 + 100 + 20,133,0, 0.9f);
|
||||
}
|
||||
mFont->DrawString(mText.c_str(), SCREEN_WIDTH/2 - 50, SCREEN_HEIGHT - 16,JGETEXT_CENTER);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user