Esempio n. 1
0
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);
    }
}
Esempio n. 2
0
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);
    }
}
Esempio n. 3
0
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);

}
Esempio n. 4
0
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);
}
Esempio n. 5
0
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();
}
Esempio n. 6
0
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());
    }

}
Esempio n. 7
0
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);
}
Esempio n. 8
0
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);
}
Esempio n. 9
0
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);

}
Esempio n. 10
0
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++;
            }
        }
    }
}
Esempio n. 11
0
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);
    }
}
Esempio n. 12
0
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);
}
Esempio n. 13
0
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());
    }
}
Esempio n. 14
0
//ResourceManagerImpl
void ResourceManagerImpl::DebugRender()
{
    JRenderer* renderer = JRenderer::GetInstance();
    WFont * font = ResourceManagerImpl::Instance()->GetWFont(Fonts::MAIN_FONT);
    if (!font || !renderer) return;

    font->SetColor(ARGB(255,255,255,255));
    font->SetScale(DEFAULT_MAIN_FONT_SCALE);
    renderer->FillRect(0, 0, SCREEN_WIDTH, 40, ARGB(128,155,0,0));

    renderer->FillRect(0, SCREEN_HEIGHT - 20, SCREEN_WIDTH, 40, ARGB(128,155,0,0));
    char buf[512];

    unsigned long man = 0;
    unsigned int misses = 0;

    if (textureWCache.cacheItems < textureWCache.cache.size()) misses = textureWCache.cache.size() - textureWCache.cacheItems;

    if (textureWCache.totalSize > textureWCache.cacheSize) man = textureWCache.totalSize - textureWCache.cacheSize;

    sprintf(buf, "Textures %u+%llu (of %u) items (%u misses), Pixels: %lu (of %lu) + %lu", textureWCache.cacheItems,
            (long long unsigned int) textureWCache.managed.size(), textureWCache.maxCached, misses,
            textureWCache.cacheSize, textureWCache.maxCacheSize, man);
    font->DrawString(buf, 10, 5);

#ifdef PSP
    //deliberately off - these functions aren't thread safe!
    //int maxLinear = ramAvailableLineareMax();
    //int ram = ramAvailable();

    //sprintf(buf, "Ram : linear max: %i - total : %i sceSize : %i\n", maxLinear, ram, sceSize);
    //font->DrawString(buf, 10, 20);
#endif

    sprintf(buf, "Time: %u. Total Size: %lu (%lu cached, %lu managed). ", lastTime, Size(), SizeCached(), SizeManaged());
    font->DrawString(buf, SCREEN_WIDTH - 10, SCREEN_HEIGHT - 15, JGETEXT_RIGHT);

#ifdef DEBUG_CACHE
    if(debugMessage.size())
        font->DrawString(debugMessage.c_str(), SCREEN_WIDTH-10,SCREEN_HEIGHT-25,JGETEXT_RIGHT);

#endif
}
Esempio n. 15
0
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);
    }
}
Esempio n. 16
0
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);
}
Esempio n. 17
0
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);
}
Esempio n. 18
0
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);
}
Esempio n. 19
0
//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);
}
Esempio n. 20
0
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();
}
Esempio n. 21
0
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();

}
Esempio n. 22
0
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

}
Esempio n. 23
0
void GuiPhaseBar::Render()
{
    JQuadPtr quad = WResourceManager::Instance()->GetQuad("phasebar");
    JQuadPtr phaseinfo = WResourceManager::Instance()->RetrieveTempQuad("fakebar.png"); //new fakebar graphics
    //uncomment to draw a hideous line across hires screens.
    // JRenderer::GetInstance()->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));

    const float radius  = 25 * zoomFactor;

    for(int i = 0; i < 6; ++i)
    {
        //the position of the glyphe in the circle
        const float circPos = (i - 2) * step + angle;
        const float glyphY = this->y + this->mHeight / 2 + sin(circPos) * radius;

        //the scale is computed so that the glyphes touch each other
        //hint: sin(circPos + PI/2) = cos(circPos)
        const float glyphScale = float(zoomFactor * cosf(circPos) * 0.5f);

        if (observer->currentPlayer && observer->currentPlayer->isAI() && !observer->currentPlayer->opponent()->isAI())
            DrawGlyph(quad.get(), (displayedPhaseId - 2 + i + kPhases) % kPhases, 0, glyphY, glyphScale, 29);
        else
            DrawGlyph(quad.get(), (displayedPhaseId - 2 + i + kPhases) % kPhases, 0, glyphY, glyphScale, 0);
    }

    //print phase name
    WFont * font = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
    string currentP = _("your turn");
    string interrupt = "";
    if (observer->currentPlayer == mpDuelLayers->getRenderedPlayerOpponent())
    {
        currentP = _("opponent's turn");
    }
    font->SetColor(ARGB(255, 255, 255, 255));
    if (observer->currentlyActing() && observer->currentlyActing()->isAI())
    {
        font->SetColor(ARGB(255, 128, 128, 128));
    }
    if (observer->currentlyActing() != observer->currentPlayer)
    {
        if (observer->currentPlayer == mpDuelLayers->getRenderedPlayer())
        {
            interrupt = _(" - ") + _("opponent plays");
        }
        else
        {
            interrupt = _(" - ") + _("you play");
        }
    }

    char buf[200];
    //running this string through translate returns gibberish even though we defined the variables in the lang.txt
    //the conversion from phase bar phases to mtg phases is x%kPhases + 1
    //todo: just to this when the displayedPhaseId updates
    string phaseNameToTranslate = observer->phaseRing->phaseName(displayedPhaseId%kPhases + 1);
    phaseNameToTranslate = _(phaseNameToTranslate);
    sprintf(buf, _("(%s%s) %s").c_str(), currentP.c_str(), interrupt.c_str(),phaseNameToTranslate.c_str());
#if !defined (PSP)
    if(phaseinfo.get())
    {
        
        phaseinfo->mWidth = font->GetStringWidth(buf)+12.f;
        phaseinfo->SetHotSpot(phaseinfo->mWidth -4, 0);
        //phaseinfo->mHeight = font->GetHeight()+5.f;
        JRenderer::GetInstance()->RenderQuad(phaseinfo.get(),SCREEN_WIDTH_F,0,0,2.2f, SCREEN_HEIGHT_F / phaseinfo->mHeight);
    }
#endif
    font->DrawString(buf, SCREEN_WIDTH - 5, 2, JGETEXT_RIGHT);
}
Esempio n. 24
0
void GameStateOptions::Render()
{
    //Erase
    JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));

    const char * const CreditsText[] = {
        "Wagic, The Homebrew?! by Wololo",
        "",
        "updates, new cards, and more on http://wololo.net/wagic",
        "Many thanks to the people who help this project",
        "",
        "",
        "Art: Ilya B, Julio, Jeck, J, Kaioshin, Lakeesha",
        "Check themeinfo.txt for the full credits of each theme!",
        "",
        "Dev Team:",
        "Abrasax, Almosthumane, Daddy32, DJardin, Dr.Solomat,",
        "J, Jeck, kevlahnota, Leungclj, linshier, Mootpoint, Mnguyen,",
        "Psyringe, Salmelo, Superhiro, Wololo, Yeshua, Zethfox",
        "",
        "Music by Celestial Aeon Project, http://www.jamendo.com",
        "",
        "Deck Builders: Abrasax, AzureKnight, colarchon",
        "Excessum, Hehotfarv, Jeremy, Jog1118, JonyAS",
        "Lachaux, Link17, Muddobbers, Nakano, Niegen",
        "Kaioshin, Psyringe, r1c47, Superhiro, Szei",
        "Thanatos02, Whismer, Wololo",
        "",
        "Thanks also go to Dr.Watson, Orine, Raphael, Sakya, Tyranid",
        "for their help.",
        "",
        "Thanks to everyone who contributes code/content on the forums!",
        "",
        "Developed with the JGE++ Library (http://code.google.com/p/wagic)",
        "SFX From www.soundsnap.com",

        "",
        "",
        "This work is not related to or endorsed by Wizards of the Coast, Inc",
        "",
        "Please support this project with donations at http://wololo.net/wagic",
    };

    WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT);
    mFont->SetColor(ARGB(255,200,200,200));
    mFont->SetScale(1.0);
    float startpos = 272 - timer;
    float pos = startpos;
    int size = sizeof(CreditsText) / sizeof(CreditsText[0]);

    for (int i = 0; i < size; i++)
    {
        pos = startpos + 20 * i;
        if (pos > -20 && pos < SCREEN_HEIGHT + 20)
        {
            mFont->DrawString(CreditsText[i], SCREEN_WIDTH / 2, pos, JGETEXT_CENTER);
        }
    }

    if (pos < -20)
        timer = 0;

    optionsTabs->Render();

    if (mState == SHOW_OPTIONS_MENU)
        optionsMenu->Render();

    if (options.keypadActive())
        options.keypadRender();
}
Esempio n. 25
0
void ActionStack::Render()
{
    //This is a hack to avoid rendering the stack above the tuto messages
    //Ideally, the tuto messages should be moved to a layer above this one
    if (getCurrentTutorial())
        return;

    static const float kSpacer = 8;
    static const float x0 = 250;
    static const float y0 = 0;
    float width = 200;
    float height = 25;
    float currenty = y0 + 5;

    if (mode == ACTIONSTACK_STANDARD)
    {
        if (!askIfWishesToInterrupt || !askIfWishesToInterrupt->displayStack())
            return;
        /*observer->mExtraPayment = NULL*/;//end any payment request from extra cost as we open the stack to display items.
        if(observer->mExtraPayment)
        {
            observer->mExtraPayment->action->CheckUserInput(JGE_BTN_SEC);
            observer->mExtraPayment = NULL;
        }
        for (size_t i = 0; i < mObjects.size(); i++)
        {
            Interruptible * current = (Interruptible *) mObjects[i];
            if (current->state == NOT_RESOLVED)
                height += current->mHeight;
        }

        WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT);
        mFont->SetBase(0);
        mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
        mFont->SetColor(ARGB(255,255,255,255));
        JRenderer * renderer = JRenderer::GetInstance();

        //stack shadow
        //renderer->FillRoundRect(x0 - 7, y0+2, width + 17, height + 2, 9.0f, ARGB(128,0,0,0));
        //stack fill
        renderer->FillRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(225,5,5,5));
        //stack highlight
        renderer->FillRect(x0 - 6, y0+3, width + 15, 30, ARGB(255,89,89,89));
        //another border
        renderer->DrawRect(x0 - 6, y0+33, width + 15, height - 18, ARGB(255,89,89,89));
        //stack border
        renderer->DrawRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(255,240,240,240));

        std::ostringstream stream;
        // WALDORF - changed "interrupt ?" to "Interrupt?". Don't display count down
        // seconds if the user disables auto progressing interrupts by setting the seconds
        // value to zero in Options.

        // Mootpoint 01/12/2011: draw the interrupt text first, at the top.  Offset the rest of the
        // unresolved stack effects down so that they don't collide with the interrupt text.
        if (options[Options::INTERRUPT_SECONDS].number == 0)
            stream << _(kInterruptMessageString);
        else
            stream << _(kInterruptMessageString) << " " << static_cast<int>(timer);

        mFont->DrawString(stream.str(), x0 + 5, currenty - 2);

//        static const float kIconVerticalOffset = 24;
        static const float kIconHorizontalOffset = 10;
        static const float kBeforeIconSpace = 12;

        //Render "interrupt?" text + possible actions
        {
            float currentx = x0 + 10;
            interruptBtnXOffset = static_cast<int>(currentx);

            if (gModRules.game.canInterrupt())
            {
                renderer->RenderQuad(pspIcons[7].get(), currentx, kIconVerticalOffset - 2, 0, kGamepadIconSize, kGamepadIconSize);
                currentx+= kIconHorizontalOffset;
                mFont->DrawString(_(kInterruptString), currentx, kIconVerticalOffset - 8);
                currentx+= mFont->GetStringWidth(_(kInterruptString).c_str()) + kBeforeIconSpace;
            }

            noBtnXOffset = static_cast<int>(currentx);

            renderer->RenderQuad(pspIcons[4].get(), currentx, kIconVerticalOffset - 2, 0, kGamepadIconSize, kGamepadIconSize);
            currentx+= kIconHorizontalOffset;
            mFont->DrawString(_(kNoString), currentx, kIconVerticalOffset - 8);
            currentx+= mFont->GetStringWidth(_(kNoString).c_str()) + kBeforeIconSpace;

            noToAllBtnXOffset = static_cast<int>(currentx);
            if (mObjects.size() > 1)
            {
                renderer->RenderQuad(pspIcons[6].get(), currentx, kIconVerticalOffset - 2, 0, kGamepadIconSize, kGamepadIconSize);
                currentx+= kIconHorizontalOffset;
                mFont->DrawString(_(kNoToAllString), currentx, kIconVerticalOffset - 8);
                currentx+= mFont->GetStringWidth(_(kNoToAllString).c_str()) + kBeforeIconSpace;
            }

            interruptDialogWidth = static_cast<int>(currentx);
        }

        currenty += kIconVerticalOffset + kSpacer;

        for (size_t i = 0; i < mObjects.size(); i++)
        {
            Interruptible * current = (Interruptible *) mObjects[i];
            if (current && current->state == NOT_RESOLVED)
            {
                current->x = x0;
                current->y = currenty;
                current->Render();

                currenty += current->mHeight;
            }
        }
    }
    else if (mode == ACTIONSTACK_TARGET && modal)
    {
        for (size_t i = 0; i < mObjects.size(); i++)
        {
            Interruptible * current = (Interruptible *) mObjects[i];
            if (current->display)
                height += current->mHeight;
        }

        WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT);
        mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
        mFont->SetColor(ARGB(255,255,255,255));

        JRenderer * renderer = JRenderer::GetInstance();
        renderer->FillRect(x0, y0, width, height, ARGB(200,0,0,0));
        renderer->DrawRect(x0 - 1, y0 - 1, width + 2, height + 2, ARGB(255,255,255,255));

        for (size_t i = 0; i < mObjects.size(); i++)
        {
            Interruptible * current = (Interruptible *) mObjects[i];
            if (mObjects[i] != NULL && current->display)
            {
                ((Interruptible *) mObjects[i])->x = x0 + 5;
                if (i != mObjects.size() - 1)
                {
                    ((Interruptible *) mObjects[i])->y = currenty;
                    currenty += ((Interruptible *) mObjects[i])->mHeight;
                }
                else
                {
                    ((Interruptible *) mObjects[i])->y = currenty + 40;
                    currenty += ((Interruptible *) mObjects[i])->mHeight + 40;
                }
                mObjects[i]->Render();
            }
        }
    }
}
Esempio n. 26
0
void GuiAvatar::Render()
{
    JRenderer * r = JRenderer::GetInstance();
    int life = player->life;
    int poisonCount = player->poisonCount;
    WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
    mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
    //Avatar
    int lifeDiff = life - currentLife;
    if (lifeDiff < 0 && currentLife > 0)
    {
        avatarRed = 192 + (3 * 255 * lifeDiff) / currentLife / 4;
        if (avatarRed < 0)
            avatarRed = 0;
    }
    int poisonDiff = poisonCount - currentpoisonCount;
    if (poisonDiff < 0 && currentpoisonCount > 0)
    {
        avatarRed = 192 + (3 * 255 * poisonDiff) / currentpoisonCount / 4;
        if (avatarRed < 0)
            avatarRed = 0;
    }
    currentpoisonCount = poisonCount;
    currentLife = life;

    r->FillRect(actX + 2, actY + 2, Width * actZ, Height * actZ, ARGB((int)(actA / 2), 0, 0, 0));

    float x0 = actX;
    float y0 = actY;

    if (player->getIcon().get())
    {
        if (corner == BOTTOM_RIGHT)
        {
            x0 -= Width * actZ;
            y0 -= Height * actZ;
        }
        switch (corner)
        {
        case TOP_LEFT:
            player->getIcon()->SetHotSpot(0, 0);
            break;
        case BOTTOM_RIGHT:
            player->getIcon()->SetHotSpot(player->getIcon()->mWidth, player->getIcon()->mHeight);
            break;
        }
        player->getIcon()->SetColor(ARGB((int)actA, 255, avatarRed, avatarRed));
        r->RenderQuad(player->getIcon().get(), actX, actY, actT, Width/player->getIcon()->mWidth*actZ, Height/player->getIcon()->mHeight*actZ);
        if (mHasFocus)
        {
            r->FillRect(x0, x0, Width/player->getIcon()->mWidth * actZ, Height/player->getIcon()->mHeight * actZ, ARGB(abs(128 - wave),255,255,255));
        }
    }

    if (avatarRed < 255)
    {
        avatarRed += 3;
        if (avatarRed > 255)
            avatarRed = 255;
    }

    if (player->getObserver()->currentPlayer == player)
        r->DrawRect(x0 - 1, y0 - 1, 36 * actZ, 51 * actZ, ARGB((int)actA, 0, 255, 0));
    else if (player->getObserver()->currentActionPlayer == player)
        r->DrawRect(x0, y0, 34 * actZ, 49 * actZ, ARGB((int)actA, 0, 0, 255));
    if (player->getObserver()->isInterrupting == player)
        r->DrawRect(x0, y0, 34 * actZ, 49 * actZ, ARGB((int)actA, 255, 0, 0));

    //Life
    char buffer[10];
    int lx = 255, ly = 255, lz = 255;
    if(life > 24) { lx = 127; ly = 255; lz = 212; }
    if(life > 16 && life < 24) { lx = 255; ly = 255; lz = 255; }
    if(life > 12 && life < 17) { lx = 255; ly = 255; lz = 105; }
    if(life > 8 && life < 13) { lx = 255; ly = 255; lz = 13; }
    if(life > 4 && life < 9) { lx = 255; ly = 166; lz = 0; }
    if(life < 5) { lx = 255; ly = 40; lz = 0; }
    sprintf(buffer, "%i", life);
    switch (corner)
    {
    case TOP_LEFT:
        mFont->SetColor(ARGB((int)actA / 4, 0, 0, 0));
        mFont->DrawString(buffer, actX + 2, actY + 2);
        mFont->SetScale(1.3f);
        mFont->SetColor(ARGB((int)actA, lx, ly, lz));
        mFont->DrawString(buffer, actX + 1, actY + 1);
        mFont->SetScale(1);
        break;
    case BOTTOM_RIGHT:
        mFont->SetScale(1.3f);
        mFont->SetColor(ARGB((int)actA, lx, ly, lz));
        mFont->DrawString(buffer, actX, actY - 14, JGETEXT_RIGHT);
        mFont->SetScale(1);
        break;
    }
    //poison
    char poison[5];
    if (poisonCount > 0)
    {
        sprintf(poison, "%i", poisonCount);
        switch (corner)
        {
        case TOP_LEFT:
            mFont->SetColor(ARGB((int)actA / 1, 0, 255, 0));
            mFont->DrawString(poison, actX + 2, actY + 10);
            break;
        case BOTTOM_RIGHT:
            mFont->SetColor(ARGB((int)actA / 1 ,0, 255, 0));
            mFont->DrawString(poison, actX, actY - 20, JGETEXT_RIGHT);
            break;
        }
    }
    PlayGuiObject::Render();
}
Esempio n. 27
0
void TaskList::Render()
{
    JRenderer * r = JRenderer::GetInstance();
    //Setup fonts.
    WFont * f = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
    WFont * f2 = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT);
    WFont * f3 = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT); //OPTION_FONT
    f2->SetColor(ARGB(255, 205, 237, 240));
    f3->SetColor(ARGB(255, 219, 206, 151));

    //Render background board
    if (mBgTex)
    {
        r->FillRect(0, vPos, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(128,0,0,0));
        r->RenderQuad(mBg[0], 0, vPos, 0, sW, sH); //TL
        r->RenderQuad(mBg[2], SCREEN_WIDTH - 64, vPos, 0, sW, sH); //TR
        r->RenderQuad(mBg[6], 0, vPos + SCREEN_HEIGHT - 64, 0, sW, sH); //BL
        r->RenderQuad(mBg[8], SCREEN_WIDTH - 64, vPos + SCREEN_HEIGHT - 64, 0, sW, sH); //BR

        //Stretch the sides
        float stretchV = (144.0f / 128.0f) * sH;
        float stretchH = (176.0f / 128.0f) * sW;
        r->RenderQuad(mBg[3], 0, vPos + 64, 0, sW, stretchV); //L
        r->RenderQuad(mBg[5], SCREEN_WIDTH - 64, vPos + 64, 0, sW, stretchV); //R
        r->RenderQuad(mBg[1], 64, vPos, 0, stretchH, sH); //T1
        r->RenderQuad(mBg[1], 240, vPos, 0, stretchH, sH); //T1
        r->RenderQuad(mBg[7], 64, vPos + 208, 0, stretchH, sH); //B1
        r->RenderQuad(mBg[7], 240, vPos + 208, 0, stretchH, sH); //B1
        r->RenderQuad(mBg[4], 64, vPos + 64, 0, stretchH, stretchV); //Center1
        r->RenderQuad(mBg[4], 240, vPos + 64, 0, stretchH, stretchV); //Center2

        f2->SetColor(ARGB(255, 55, 46, 34));
        f = f2;
    }
    else
    {
        r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(128,0,0,0));
        r->FillRect(10, 10 + vPos, SCREEN_WIDTH - 10, SCREEN_HEIGHT - 10, ARGB(128,0,0,0));
    }

    float posX = 40, posY = vPos + 20;
    char buffer[300];
    string title = _("Task Board");

    f3->DrawString(title.c_str(), static_cast<float> ((SCREEN_WIDTH - 20) / 2 - title.length() * 4), posY);
    posY += 30;

    if (0 == tasks.size())
    {
        f->DrawString(_("There are no tasks that need to be done. Come again tomorrow.").c_str(), posX, posY);
        return;
    }

    for (vector<Task*>::iterator it = tasks.begin(); it != tasks.end(); it++)
    {
        sprintf(buffer, "%s", (*it)->getShortDesc().c_str());
        f2->DrawString(buffer, posX, posY);
        if (mBgTex)
        {
            f->SetScale(.8f);
        }
        sprintf(buffer, _("Days left: %i").c_str(), (*it)->getExpiration());
        f->DrawString(buffer, SCREEN_WIDTH - 190, posY);
        sprintf(buffer, _("Reward: %i").c_str(), (*it)->getReward());
        f->DrawString(buffer, SCREEN_WIDTH - 100, posY);
        posY += 15;

        sprintf(buffer, "%s", (*it)->getDesc().c_str());
        f->DrawString(buffer, posX + 10, posY);
        posY += 15;
        if (mBgTex)
        {
            f->SetScale(1);
        }
        //r->DrawLine((SCREEN_WIDTH)/2 - 200, posY, (SCREEN_WIDTH)/2 + 200, posY, ARGB(128, 255, 255, 255));
    }
    f->SetScale(1);
}
Esempio n. 28
0
void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHborder)
{
    WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);

    const CardRep& cardPosition = mCards[index];

    if (!cardPosition.card) return;

    if (!WResourceManager::Instance()->IsThreaded())
    {
        JQuadPtr backQuad = WResourceManager::Instance()->GetQuad(kGenericCardID);
        JQuadPtr quad;

        int cacheError = CACHE_ERROR_NONE;

        if (!options[Options::DISABLECARDS].number)
        {
            quad = WResourceManager::Instance()->RetrieveCard(cardPosition.card, RETRIEVE_EXISTING);
            cacheError = WResourceManager::Instance()->RetrieveError();
            if (!quad.get() && cacheError != CACHE_ERROR_404)
            {
                if (last_user_activity > (abs(2 - index) + 1) * no_user_activity_show_card_delay)
                    quad = WResourceManager::Instance()->RetrieveCard(cardPosition.card);
                else
                {
                    quad = backQuad;
                }
            }
        }

        if (quad.get())
        {
            if (quad == backQuad)
            {
                quad->SetColor(ARGB(255,255,255,255));
                float _scale = cardPosition.scale * (285 / quad->mHeight);
                JRenderer::GetInstance()->RenderQuad(quad.get(), cardPosition.x, cardPosition.y, 0.0f, _scale, _scale);
            }
            else
            {
                Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255);
                CardGui::DrawCard(cardPosition.card, pos, asThumbnail, true);
            }
        }
        else
        {
            Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255);
            CardGui::DrawCard(cardPosition.card, pos, DrawMode::kText, asThumbnail, true);
        }
    }
    else
    {//NORMAL VIEW WITH IMAGES
        int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText;
        float modx = addWHborder ? 2.0f:0.0f;
        //border for editor && others???
        string cardsetname = setlist[cardPosition.card->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((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(255,248,248,255));
            JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(150,20,20,20));
        }
        else
        {
            JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(255,10,10,10));
            JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(50,240,240,240));
        }
        Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255);
        CardGui::DrawCard(cardPosition.card, pos, mode, asThumbnail, true);
    }
    int quadAlpha = alpha;
    if (!deck()->count(cardPosition.card)) quadAlpha /= 2;
    quadAlpha = 255 - quadAlpha;
    if (quadAlpha > 0)
    {
        JRenderer::GetInstance()->FillRect(cardPosition.x - cardPosition.scale * 100.0f, cardPosition.y - cardPosition.scale * 142.5f, cardPosition.scale * 200.0f, cardPosition.scale * 285.0f,
                                           ARGB(quadAlpha,0,0,0));
    }
    if (last_user_activity < 3)
    {
        int fontAlpha = alpha;
        float qtY = cardPosition.y - 135 * cardPosition.scale;
        float qtX = cardPosition.x + 40 * cardPosition.scale;
        char buffer[4096];
        sprintf(buffer, "x%i", deck()->count(cardPosition.card));
        WFont * font = mFont;
        font->SetScale(1.4f);
        font->SetColor(ARGB(fontAlpha/2,0,0,0));
        JRenderer::GetInstance()->FillRect(qtX, qtY, font->GetStringWidth(buffer) + 6, 18, ARGB(fontAlpha/2,0,0,0));
        JRenderer::GetInstance()->DrawRect(qtX, qtY, font->GetStringWidth(buffer) + 6, 18, ARGB(fontAlpha/2,240,240,240));
        font->DrawString(buffer, qtX + 5, qtY + 3);
        font->SetColor(ARGB(fontAlpha,255,255,255));
        font->DrawString(buffer, qtX + 4, qtY + 2);
        font->SetColor(ARGB(255,255,255,255));
        font->SetScale(1.0f);
    }
}
Esempio n. 29
0
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());
    }
}
Esempio n. 30
0
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());
    }
}