void AIStats::Render() { GameObserver * g = player->getObserver(); float x0 = 10; if (player == g->players[1]) x0 = 280; JRenderer::GetInstance()->FillRoundRect(x0, 10, 200, 180, 5, ARGB(50,0,0,0)); WFont * f = g->getResourceManager()->GetWFont(Fonts::MAIN_FONT); int i = 0; char buffer[512]; list<AIStat *>::iterator it; for (it = stats.begin(); it != stats.end(); ++it) { if (i > 10) break; AIStat * stat = *it; if (stat->value > 0) { MTGCard * card = MTGCollection()->getCardById(stat->source); if (card) { sprintf(buffer, "%s %i", card->data->getName().c_str(), stat->value); f->DrawString(buffer, x0 + 5, 10 + 16 * (float) i); i++; } } } }
void DamagerDamaged::Render(CombatStep mode) { TransientCardView::Render(); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); mFont->SetBase(0); switch (mode) { case BLOCKERS: case TRIGGERS: case ORDER: mFont->SetColor(ARGB(92,255,255,255)); break; case FIRST_STRIKE: case END_FIRST_STRIKE: case DAMAGE: case END_DAMAGE: mFont->SetColor(ARGB(255, 255, 64, 0)); break; } char buf[6]; sprintf(buf, "%i", sumDamages()); mFont->DrawString(buf, actX - 14 * actZ + 5, actY - 14 * actZ); }
void DeckEditorMenu::drawDeckStatistics() { ostringstream deckStatsString; deckStatsString << _("------- Deck Summary -----") << endl << _("Cards: ") << stw->cardCount << endl << _("Creatures: ") << setw(2) << stw->countCreatures << _(" Enchantments: ") << stw->countEnchantments << endl << _("Instants: ") << setw(4) << stw->countInstants << _(" Sorceries: ") << setw(2) << stw->countSorceries << endl << _("Lands: ") << _("A: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_ARTIFACT ] << " " << _("G: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] + stw->countLandsPerColor[ Constants::MTG_COLOR_GREEN ] << " " << _("R: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_RED ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_RED ] << " " << _("U: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLUE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLUE ] << " " << _("B: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_BLACK ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_BLACK ] << " " << _("W: ") << setw(2) << left << stw->countLandsPerColor[ Constants::MTG_COLOR_WHITE ] + stw->countBasicLandsPerColor[ Constants::MTG_COLOR_WHITE ] << endl << _(" --- Card color count --- ") << endl << _("A: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_ARTIFACT) << " " << _("G: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_GREEN) << " " << _("U: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLUE) << " " << _("R: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_RED) << " " << _("B: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_BLACK) << " " << _("W: ") << setw(2) << left << selectedDeck->getCount(Constants::MTG_COLOR_WHITE) << endl << _(" --- Average Cost --- ") << endl << _("Creature: ") << setprecision(2) << stw->avgCreatureCost << endl << _("Mana: ") << setprecision(2) << stw->avgManaCost << " " << _("Spell: ") << setprecision(2) << stw->avgSpellCost << endl; WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); mainFont->DrawString(deckStatsString.str().c_str(), descX, descY + 25); }
FontSupport::FontMatch FontSupport::matchFont(const WFont& font) const { for (MatchCache::iterator i = cache_.begin(); i != cache_.end(); ++i) { if (i->font.genericFamily() == font.genericFamily() && i->font.specificFamilies() == font.specificFamilies() && i->font.weight() == font.weight() && i->font.style() == font.style()) { cache_.splice(cache_.begin(), cache_, i); // implement LRU return cache_.front().match; } } FontMatch match; for (unsigned i = 0; i < fontCollections_.size(); ++i) { FontMatch m = matchFont(font, fontCollections_[i].directory, fontCollections_[i].recursive); if (m.quality() > match.quality()) match = m; } // implement LRU cache_.pop_back(); cache_.push_front(Matched()); cache_.front().font = font; cache_.front().match = match; return match; }
void GameStateShop::beginPurchase(int controlId) { WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT); mFont->SetScale(SCALE_NORMAL); SAFE_DELETE(menu); if (mInventory[controlId] <= 0) { menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), -145, this, Fonts::MENU_FONT, SCREEN_WIDTH - 300, SCREEN_HEIGHT / 2, _("Sold Out").c_str()); menu->Add(-1, "Ok"); } else if (playerdata->credits - mPrices[controlId] < 0) { menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), -145, this, Fonts::MENU_FONT, SCREEN_WIDTH - 300, SCREEN_HEIGHT / 2, _("Not enough credits").c_str()); menu->Add(-1, "Ok"); if (options[Options::CHEATMODE].number) { menu->Add(-2, _("Steal it").c_str()); } } else { char buf[512]; if (controlId < BOOSTER_SLOTS) sprintf(buf, _("Purchase Booster: %i credits").c_str(), mPrices[controlId]); else sprintf(buf, _("Purchase Card: %i credits").c_str(), mPrices[controlId]); menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), -145, this, Fonts::MENU_FONT, SCREEN_WIDTH - 300, SCREEN_HEIGHT / 2, buf); menu->Add(controlId, "Yes"); menu->Add(-1, "No"); } }
void InteractiveButton::Render() { if (!isSelectionValid()) return; JRenderer *renderer = JRenderer::GetInstance(); WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); const string detailedInfoString = _(getText()); float stringWidth = mainFont->GetStringWidth(detailedInfoString.c_str()); float pspIconsSize = 0.5; float mainFontHeight = mainFont->GetHeight(); float boxStartX = getX() - 5; mXOffset = 0; mYOffset = 0; #ifndef TOUCH_ENABLED renderer->FillRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 9, 5, ARGB(0, 0, 0, 0)); #else renderer->FillRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 5, 5, ARGB(255, 192, 172, 119)); renderer->DrawRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 5, 5, ARGB(255, 255, 255, 255)); mYOffset += 2; #endif float buttonXOffset = getX() - mXOffset; float buttonYOffset = getY() + mYOffset; if (buttonImage != NULL) { renderer->RenderQuad(buttonImage.get(), buttonXOffset - buttonImage.get()->mWidth/2, buttonYOffset + mainFontHeight/2, 0, pspIconsSize, pspIconsSize); } mainFont->SetColor(ARGB(255, 0, 0, 0)); mainFont->DrawString(detailedInfoString, buttonXOffset, buttonYOffset); }
void SimpleButton::RenderWithOffset(float yOffset) { mYOffset = yOffset; WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId); mFont->SetScale(mScale); mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER); }
float SimpleButton::GetWidth() { WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId); float backup = mFont->GetScale(); mFont->SetScale(1.0); float result = mFont->GetStringWidth(mText.c_str()); mFont->SetScale(backup); return result; }
void ExtraCost::Render() { if (!mCostRenderString.empty()) { WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetColor(ARGB(255,255,255,255)); mFont->DrawString(mCostRenderString, 20, 20, JGETEXT_LEFT); } }
void OptionProfile::Render() { JRenderer * renderer = JRenderer::GetInstance(); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT); mFont->SetScale(1); int spacing = 2 + (int) mFont->GetHeight(); float pX, pY; pX = x; pY = y; char buf[512]; if (selections[value] == "Default") sprintf(buf, "player/avatar.jpg"); else sprintf(buf, "profiles/%s/avatar.jpg", selections[value].c_str()); string filename = buf; JQuadPtr avatar = WResourceManager::Instance()->RetrieveTempQuad(filename, TEXTURE_SUB_EXACT); if (avatar) { renderer->RenderQuad(avatar.get(), x, pY); pX += 40; } mFont->SetColor(getColor(WGuiColor::TEXT_HEADER)); mFont->DrawString(selections[value].c_str(), pX, pY + 2, JGETEXT_LEFT); mFont->SetScale(0.8f); mFont->SetColor(getColor(WGuiColor::TEXT_BODY)); mFont->DrawString(preview.c_str(), pX, pY + spacing + 2, JGETEXT_LEFT); mFont->SetScale(1.0f); }
void OptionSelect::Render() { WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT); mFont->SetColor(getColor(WGuiColor::TEXT)); mFont->DrawString(_(displayValue).c_str(), x, y + 2); if (value < selections.size()) mFont->DrawString(_(selections[value]).c_str(), x + width - 10, y + 2, JGETEXT_RIGHT); else mFont->DrawString(_("Unset").c_str(), x + width - 10, y + 2, JGETEXT_RIGHT); }
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 FontSupport::matchFont(const WFont& font, const std::vector<std::string>& fontNames, const std::string& path, FontMatch& match) const { if (boost::ends_with(path, ".ttf") || boost::ends_with(path, ".ttc")) { std::string name = Utils::lowerCase(FileUtils::leaf(path)); name = name.substr(0, name.length() - 4); Utils::replace(name, ' ', std::string()); std::vector<const char*> weightVariants, styleVariants; if (font.weight() == WFont::Bold) { weightVariants.push_back("bold"); weightVariants.push_back("bf"); } else { weightVariants.push_back(""); } switch (font.style()) { case WFont::NormalStyle: styleVariants.push_back("regular"); styleVariants.push_back(""); break; case WFont::Italic: styleVariants.push_back("italic"); styleVariants.push_back("oblique"); break; case WFont::Oblique: styleVariants.push_back("oblique"); break; } for (unsigned i = 0; i < fontNames.size(); ++i) { double q = 1.0 - 0.1 * i; if (q <= match.quality()) return; for (unsigned w = 0; w < weightVariants.size(); ++w) for (unsigned s = 0; s < styleVariants.size(); ++s) { std::string fn = fontNames[i] + weightVariants[w] + styleVariants[s]; if (fn == name) { match = FontMatch(path, q); return; } } } } }
FontSupport::FontMatch FontSupport::matchFont(const WFont& font, const std::string& directory, bool recursive) const { if (!FileUtils::exists(directory) || !FileUtils::isDirectory(directory)) { LOG_ERROR("cannot read directory '" << directory << "'"); return FontMatch(); } std::vector<std::string> fontNames; std::string families = font.specificFamilies().toUTF8(); boost::split(fontNames, families, boost::is_any_of(",")); for (unsigned i = 0; i < fontNames.size(); ++i) { std::string s = Utils::lowerCase(fontNames[i]); // UTF-8 ! boost::trim_if(s, boost::is_any_of("\"'")); s = Utils::replace(s, ' ', std::string()); fontNames[i] = s; } switch (font.genericFamily()) { case WFont::Serif: fontNames.push_back("times"); fontNames.push_back("timesnewroman"); break; case WFont::SansSerif: fontNames.push_back("helvetica"); fontNames.push_back("arialunicode"); fontNames.push_back("arial"); fontNames.push_back("verdana"); break; case WFont::Cursive: fontNames.push_back("zapfchancery"); break; case WFont::Fantasy: fontNames.push_back("western"); break; case WFont::Monospace: fontNames.push_back("courier"); fontNames.push_back("mscouriernew"); break; default: ; } FontMatch match; matchFont(font, fontNames, directory, recursive, match); return match; }
void NextGamePhase::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 (observer->currentActionPlayer == observer->players[1]) playerId = 2; sprintf(buffer, "%s %i : -> %s", _("Player").c_str(), playerId, observer->getNextGamePhaseName()); mFont->DrawString(buffer, x + 30, y, JGETEXT_LEFT); }
void LifeAction::Render() { WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetBase(0); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); char buffer[200]; if(amount > 0) sprintf(buffer, _("Player gains %i life").c_str(), amount); else if(amount < 0) sprintf(buffer, _("Player loses %i life").c_str(), amount); else sprintf(buffer, _("Nothing happened").c_str(), amount); mFont->DrawString(buffer, x + 20, y, JGETEXT_LEFT); }
void OptionKey::Overlay() { JRenderer * renderer = JRenderer::GetInstance(); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT); mFont->SetColor(ARGB(255, 0, 0, 0)); if (grabbed) { static const float x = 30, y = 45; renderer->FillRoundRect(x, y, SCREEN_WIDTH - 2 * x, 50, 2, ARGB(200, 200, 200, 255)); string msg = _("Press a key to associate."); mFont->DrawString(msg, (SCREEN_WIDTH - mFont->GetStringWidth(msg.c_str())) / 2, y + 20); } else if (btnMenu) btnMenu->Render(); }
WFontMetrics FontSupport::fontMetrics(const WFont& font) { PANGO_LOCK; enabledFontFormats = enabledFontFormats_; PangoFont *pangoFont = matchFont(font).pangoFont(); PangoFontMetrics *metrics = pango_font_get_metrics(pangoFont, nullptr); double ascent = pangoUnitsToDouble(pango_font_metrics_get_ascent(metrics)); double descent = pangoUnitsToDouble(pango_font_metrics_get_descent(metrics)); double leading = (ascent + descent) - font.sizeLength(12).toPixels(); // ascent < leading is an odd thing. it happens with a font like // Cursive. if (ascent > leading) ascent -= leading; else leading = 0; WFontMetrics result(font, leading, ascent, descent); pango_font_metrics_unref(metrics); return result; }
void DeckEditorMenu::Render() { JRenderer *r = JRenderer::GetInstance(); r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(200,0,0,0));//bg?? DeckMenu::Render(); if (deckTitle.size() > 0) { WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT); DWORD currentColor = mainFont->GetColor(); mainFont->SetColor(ARGB(255,255,255,255)); mainFont->DrawString(deckTitle.c_str(), (SCREEN_WIDTH_F / 2)-15, (statsHeight / 2)+4, JGETEXT_CENTER); mainFont->SetColor(currentColor); } if (stw && selectedDeck) drawDeckStatistics(); }
/* This alters the card structure, but this is intentional for performance and * space purpose: The only time we get the card text is to render it * on the screen, in a formatted way. * Formatting the string every frame is not efficient, especially since we always display it the same way * Formatting all strings at startup is inefficient too. * Instead, we format when requested, but only once, and cache the result. * To avoid memory to blow up, in exchange of the cached result, we erase the original string */ const vector<string>& CardPrimitive::getFormattedText() { if (!text.size()) return formattedText; std::string::size_type found = text.find_first_of("{}"); while (found != string::npos) { text[found] = '/'; found = text.find_first_of("{}", found + 1); } WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT); mFont->FormatText(text, formattedText); text = ""; return formattedText; };
QFont transform(const WFont& font) { QFont f(QString::fromStdString(font.family()), font.pointSize(), font.weight(), font.italic()); f.setUnderline(font.underline()); f.setStrikeOut(font.strikeOut()); f.setKerning(font.kerning()); return f; }
void PutInGraveyard::Render() { WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetBase(0); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); if (!removeFromGame) { mFont->DrawString(_("goes to graveyard").c_str(), x + 30, y, JGETEXT_LEFT); } else { mFont->DrawString(_("is exiled").c_str(), x + 30, y, JGETEXT_LEFT); } JRenderer * renderer = JRenderer::GetInstance(); JQuadPtr quad = observer->getResourceManager()->RetrieveCard(card, CACHE_THUMB); if (quad.get()) { quad->SetColor(ARGB(255,255,255,255)); float scale = 30 / quad->mHeight; renderer->RenderQuad(quad.get(), x, y, 0, scale, scale); } else { mFont->DrawString(_(card->name).c_str(), x, y - 15); } }
void OptionKey::Render() { WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT); mFont->SetColor(getColor(WGuiColor::TEXT)); JRenderer * renderer = JRenderer::GetInstance(); if (LOCAL_KEY_NONE == from) { string msg = _("New binding..."); mFont->DrawString(msg, (SCREEN_WIDTH - mFont->GetStringWidth(msg.c_str())) / 2, y + 2); } else { const KeyRep& rep = translateKey(from); if (rep.second) renderer->RenderQuad(rep.second, x + 4, y + 3, 0, 16.0f / rep.second->mHeight, 16.0f / rep.second->mHeight); else mFont->DrawString(rep.first, x + 4, y + 3, JGETEXT_LEFT); const KeyRep& rep2 = translateKey(to); if (rep2.second) { float ratio = 16.0f / rep2.second->mHeight; renderer->RenderQuad(rep2.second, x + width - (ratio * rep2.second->mWidth) - 2, y + 3, 0, ratio, ratio); } else mFont->DrawString(rep2.first, width - 4, y + 3, JGETEXT_RIGHT); } }
//OptionInteger void OptionInteger::Render() { WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT); mFont->SetColor(getColor(WGuiColor::TEXT)); mFont->DrawString(_(displayValue).c_str(), x + 2, y + 3); char buf[512]; if (maxValue == 1) { if (value) sprintf(buf, "%s", _("Yes").c_str()); else sprintf(buf, "%s", _("No").c_str()); } else { if (value == defValue && strDefault.size()) sprintf(buf, "%s", _(strDefault).c_str()); else sprintf(buf, "%i", value); } mFont->DrawString(buf, width - 5, y + 3, JGETEXT_RIGHT); }
void GameApp::Render() { if (systemError.size()) { fprintf(stderr, "%s", systemError.c_str()); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); if (mFont) mFont->DrawString(systemError.c_str(), 1, 1); return; } JRenderer * renderer = JRenderer::GetInstance(); renderer->ClearScreen(ARGB(0,0,0,0)); if (mCurrentState) mCurrentState->Render(); #ifdef DEBUG_CACHE WResourceManager::Instance()->DebugRender(); #endif #if defined(DEBUG) && !defined(IOS) JGE* mEngine = JGE::GetInstance(); float fps = mEngine->GetFPS(); totalFPS += fps; nbUpdates+=1; WFont * mFont= WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); char buf[512]; sprintf(buf, "avg:%.02f - %.02f fps",totalFPS/nbUpdates, fps); if (mFont) { mFont->SetColor(ARGB(255,255,255,255)); mFont->DrawString(buf, 10, SCREEN_HEIGHT-25); } #endif }
void OptionTheme::Render() { JRenderer * renderer = JRenderer::GetInstance(); char buf[512]; if (!bChecked) { author = ""; bChecked = true; if (selections[value] == "Default") sprintf(buf, "%s", "graphics/themeinfo.txt"); else sprintf(buf, "themes/%s/themeinfo.txt", selections[value].c_str()); string contents; if (JFileSystem::GetInstance()->readIntoString(buf, contents)) { std::stringstream stream(contents); string temp; std::getline(stream, temp); for (unsigned int x = 0; x < 17 && x < temp.size(); x++) { if (isprint(temp[x])) //Clear stuff that breaks mFont->DrawString, cuts to 16 chars. author += temp[x]; } } } sprintf(buf, _("Theme: %s").c_str(), selections[value].c_str()); JQuadPtr q = getImage(); if (q) { float scale = 128 / q->mHeight; renderer->RenderQuad(q.get(), x, y, 0, scale, scale); } WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT); mFont->SetColor(getColor(WGuiColor::TEXT_HEADER)); mFont->DrawString(buf, x + 2, y + 2); if (bChecked && author.size()) { mFont->SetColor(getColor(WGuiColor::TEXT_BODY)); mFont->SetScale(0.8f); float hi = mFont->GetHeight(); sprintf(buf, _("Artist: %s").c_str(), author.c_str()); mFont->DrawString(buf, x + 2, y + getHeight() - hi); mFont->SetScale(1); } }
float SimpleButton::GetEnlargedWidth() { WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId); float backup = mFont->GetScale(); mFont->SetScale(SCALE_SELECTED); if(mText.size() < 20) mFont->SetScale(SCALE_SELECTED_LARGE); float result = mFont->GetStringWidth(mText.c_str()); mFont->SetScale(backup); return result; }
void __fastcall TForm1::FormCreate(TObject *Sender) { HFONT winfont; winfont=CreateFont( 200,0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, // DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "ΊΪΜε"); font.Create(winfont,4); }
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 GuiGameZone::Render() { //Texture JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID); float scale = defaultHeight / quad->mHeight; quad->SetColor(ARGB((int)(actA),255,255,255)); if(type == GUI_EXILE) { quad->SetColor(ARGB((int)(actA),255,240,255)); } JRenderer::GetInstance()->RenderQuad(quad.get(), actX, actY, 0.0, scale * actZ, scale * actZ); float x0 = actX; if (x0 < SCREEN_WIDTH / 2) { x0 += 7; } if (mHasFocus) JRenderer::GetInstance()->FillRect(actX, actY, quad->mWidth * scale * actZ, quad->mHeight * scale * actZ, ARGB(abs(128 - wave),255,255,255)); //Number of cards WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); char buffer[11]; int mAlpha = (int) (actA); /*if(type == GUI_GRAVEYARD) sprintf(buffer, "%i\ng", zone->nb_cards); else if(type == GUI_LIBRARY) sprintf(buffer, "%i\nl", zone->nb_cards); else if(type == GUI_OPPONENTHAND) sprintf(buffer, "%i\nh", zone->nb_cards); else if(type == GUI_EXILE) sprintf(buffer, "%i\ne", zone->nb_cards); else*/ sprintf(buffer, "%i", zone->nb_cards); mFont->SetColor(ARGB(mAlpha,0,0,0)); mFont->DrawString(buffer, x0 + 1, actY + 1); if (actA > 120) mAlpha = 255; mFont->SetColor(ARGB(mAlpha,255,255,255)); mFont->DrawString(buffer, x0, actY); if (showCards) cd->Render(); for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it) (*it)->Render(); PlayGuiObject::Render(); }