void Damage::Render() { WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); mFont->SetBase(0); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); char buffer[200]; sprintf(buffer, _("Deals %i damage to").c_str(), damage); //mFont->DrawString(buffer, x + 20, y, JGETEXT_LEFT); mFont->DrawString(buffer, x + 32, y + GetVerticalTextOffset(), JGETEXT_LEFT); JRenderer * renderer = JRenderer::GetInstance(); JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(source, CACHE_THUMB); if (quad.get()) { //float scale = 30 / quad->mHeight; //renderer->RenderQuad(quad.get(), x, y, 0, scale, scale); quad->SetColor(ARGB(255,255,255,255)); float scale = mHeight / quad->mHeight; renderer->RenderQuad(quad.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale); } else { //mFont->DrawString(_(source->getName()).c_str(), x, y - 15); mFont->DrawString(_(source->getName()).c_str(), x, y + GetVerticalTextOffset() - 15); } quad = target->getIcon(); if (quad.get()) { //float scale = 30 / quad->mHeight; //renderer->RenderQuad(quad.get(), x + 150, y, 0, scale, scale); float backupX = quad->mHotSpotX; float backupY = quad->mHotSpotY; quad->SetColor(ARGB(255,255,255,255)); quad->SetHotSpot(quad->mWidth / 2, quad->mHeight / 2); float scale = mHeight / quad->mHeight; renderer->RenderQuad(quad.get(), x + 130, y - 0.5f + ((mHeight - quad->mHeight) / 2) + quad->mHotSpotY, 0, scale, scale); quad->SetHotSpot(backupX, backupY); } else { //if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE) //mFont->DrawString(_(((MTGCardInstance *) target)->getName()).c_str(), x + 120, y); if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE) mFont->DrawString(_(((MTGCardInstance *) target)->getName()).c_str(), x + 35, y+15 + GetVerticalTextOffset()); else if(target->type_as_damageable == Damageable::DAMAGEABLE_PLAYER) mFont->DrawString(_(((Player *) target)->getDisplayName()).c_str(), x + 35, y+15 + GetVerticalTextOffset()); } }
void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad) { WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetColor(ARGB(255,255,255,255)); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT); JRenderer * renderer = JRenderer::GetInstance(); JQuadPtr quad = observer->getResourceManager()->RetrieveCard(source, CACHE_THUMB); if (!quad.get()) quad = CardGui::AlternateThumbQuad(source); if (quad.get()) { quad->SetColor(ARGB(255,255,255,255)); float scale = mHeight / quad->mHeight; renderer->RenderQuad(quad.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale); } else if (alt1.size()) { mFont->DrawString(_(alt1).c_str(), x, y + GetVerticalTextOffset()); } if (bigQuad) { Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220); CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode()); } if (targetQuad) { float backupX = targetQuad->mHotSpotX; float backupY = targetQuad->mHotSpotY; targetQuad->SetColor(ARGB(255,255,255,255)); targetQuad->SetHotSpot(targetQuad->mWidth / 2, targetQuad->mHeight / 2); float scale = mHeight / targetQuad->mHeight; renderer->RenderQuad(targetQuad, x + 150, y + ((mHeight - targetQuad->mHeight) / 2) + targetQuad->mHotSpotY, 0, scale, scale); targetQuad->SetHotSpot(backupX, backupY); } else if (alt2.size()) { mFont->DrawString(_(alt2).c_str(), x + 120, y + GetVerticalTextOffset()); } }
void DrawAction::Render() { WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetBase(0); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); char buffer[200]; int playerId = 1; if (player == observer->players[1]) playerId = 2; sprintf(buffer, _("Player %i draws %i card").c_str(), playerId, nbcards); mFont->DrawString(buffer, x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT); }
void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad) { WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetColor(ARGB(255,255,255,255)); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); JRenderer * renderer = JRenderer::GetInstance(); if (!targetQuad) { /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name) mFont->DrawString("You play ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); else if(source->controller()->isAI() && source->controller()->opponent()->isHuman() && !alt2.size() && _(action).c_str() == source->name) mFont->DrawString("Opponent plays ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT);*/ mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT); } else { renderer->FillRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(235,10,10,10)); /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI()) renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,0,255,0)); else renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,255,0,0));*/ mFont->DrawString(">", x + 32, y + GetVerticalTextOffset(), JGETEXT_LEFT); mFont->DrawString(_(action).c_str(), x + 75, y + GetVerticalTextOffset(), JGETEXT_LEFT); } JQuadPtr quad = observer->getResourceManager()->RetrieveCard(source, CACHE_THUMB); if (!quad.get()) quad = CardGui::AlternateThumbQuad(source); if (quad.get()) { quad->SetColor(ARGB(255,255,255,255)); float scale = mHeight / quad->mHeight; renderer->RenderQuad(quad.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale); } else if (alt1.size()) { mFont->DrawString(_(alt1).c_str(), x, y + GetVerticalTextOffset()); } if (bigQuad) { //Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220); Pos npos = Pos(CardGui::BigWidth / 2 + 8.f, CardGui::BigHeight / 2 - 2.f, 1.0f - (1.0f/10), 0.0, 220); //border if(observer->getCardSelector()->GetDrawMode() < 2) { string cardsetname = setlist[source->setId].c_str(); if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") { JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255)); JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20)); } else { JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,5,5,5)); JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(50,240,240,240)); } } //render card CardGui::DrawCard(source, npos, observer->getCardSelector()->GetDrawMode(),false,true); } if (targetQuad) { float backupX = targetQuad->mHotSpotX; float backupY = targetQuad->mHotSpotY; targetQuad->SetColor(ARGB(255,255,255,255)); targetQuad->SetHotSpot(targetQuad->mWidth / 2, targetQuad->mHeight / 2); float scale = mHeight / targetQuad->mHeight; renderer->RenderQuad(targetQuad, x + 55, y + ((mHeight - targetQuad->mHeight) / 2) + targetQuad->mHotSpotY, 0, scale, scale); targetQuad->SetHotSpot(backupX, backupY); } else if (alt2.size()) { mFont->DrawString(_(alt2).c_str(), x + 35, y+15 + GetVerticalTextOffset()); } }
void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad) { WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetColor(ARGB(255,255,255,255)); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); JRenderer * renderer = JRenderer::GetInstance(); if (!targetQuad) { /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name) mFont->DrawString("You play ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); else if(source->controller()->isAI() && source->controller()->opponent()->isHuman() && !alt2.size() && _(action).c_str() == source->name) mFont->DrawString("Opponent plays ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT);*/ mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT); } else { renderer->FillRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(235,10,10,10)); /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI()) renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,0,255,0)); else renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,255,0,0));*/ mFont->DrawString(">", x + 32, y + GetVerticalTextOffset(), JGETEXT_LEFT); mFont->DrawString(_(action).c_str(), x + 75, y + GetVerticalTextOffset(), JGETEXT_LEFT); } JQuadPtr quad = observer->getResourceManager()->RetrieveCard(source, CACHE_THUMB); if (!quad.get()) quad = CardGui::AlternateThumbQuad(source); if (quad.get()) { quad->SetColor(ARGB(255,255,255,255)); float scale = mHeight / quad->mHeight; renderer->RenderQuad(quad.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale); } else if (alt1.size()) { mFont->DrawString(_(alt1).c_str(), x, y + GetVerticalTextOffset()); } if (bigQuad) { /*Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220); CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode());*/ Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220); pos.actY = 142;//adjust y a little bit CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode()); } if (targetQuad) { float backupX = targetQuad->mHotSpotX; float backupY = targetQuad->mHotSpotY; targetQuad->SetColor(ARGB(255,255,255,255)); targetQuad->SetHotSpot(targetQuad->mWidth / 2, targetQuad->mHeight / 2); float scale = mHeight / targetQuad->mHeight; renderer->RenderQuad(targetQuad, x + 55, y + ((mHeight - targetQuad->mHeight) / 2) + targetQuad->mHotSpotY, 0, scale, scale); targetQuad->SetHotSpot(backupX, backupY); } else if (alt2.size()) { mFont->DrawString(_(alt2).c_str(), x + 35, y+15 + GetVerticalTextOffset()); } }