コード例 #1
0
ファイル: OptionItem.cpp プロジェクト: Esplin/wagic
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);
    }
}
コード例 #2
0
ファイル: SimplePopup.cpp プロジェクト: Rolzad73/wagic
void SimplePopup::Render()
{
    mClosed = false;
    float modX = (SCREEN_WIDTH_F / 2)-5;

    JRenderer *r = JRenderer::GetInstance();
    string detailedInformation = getDetailedInformation(mDeckInformation->getFilename());
#if !defined (PSP)
    
    JQuadPtr statsholder = WResourceManager::Instance()->RetrieveTempQuad("statsholder.png");//new graphics statsholder
    //const float textHeight = mTextFont->GetHeight() * mMaxLines;
    //r->FillRect(0,0,SCREEN_WIDTH_F,SCREEN_HEIGHT_F,ARGB(220,15,15,15));
    if(statsholder.get())
        r->RenderQuad(statsholder.get(),0,0,0,SCREEN_WIDTH_F/statsholder->mWidth,SCREEN_HEIGHT_F/statsholder->mHeight);
#endif
    r->FillRoundRect(mX+modX+3, mY + 7, 190.f, 148.f, 0, ARGB( 240, 15, 15, 15 ) );

    // currently causes a crash on the PSP when drawing the corners.
    // TODO: clean up the image ot make it loook cleaner. Find solution to load gfx to not crash PSP
#if 0
    r->DrawRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 125, 255, 0) );
    drawBoundingBox( mX-3, mY, mWidth + 3, textHeight );
#endif
    mTextFont->DrawString(detailedInformation.c_str(), modX+mX + 9 , mY + 15);

}
コード例 #3
0
ファイル: SimpleMenu.cpp プロジェクト: SkyRaiderX/wagic
SimpleMenu::SimpleMenu(JGE* jge, WResourceManager* resourceManager, int id, JGuiListener* listener, int fontId, float x, float y, const char * _title, int _maxItems, bool centerHorizontal, bool centerVertical)
    : JGuiController(jge, id, listener), fontId(fontId), mCenterHorizontal(centerHorizontal), mCenterVertical(centerVertical), stars(0)
{
    autoTranslate = true;
    isMultipleChoice = false;
    mHeight = 2 * SimpleMenuConst::kVerticalMargin;
    mWidth = 0;
    mX = x;
    mY = y;
    title = _(_title);
    startId = 0;
    maxItems = _maxItems;
    selectionT = 0;
    timeOpen = 0;
    mClosed = false;
    selectionTargetY = selectionY = y + SimpleMenuConst::kVerticalMargin;

    if(resourceManager)
    {
        JRenderer* renderer = JRenderer::GetInstance();

        if (!spadeLTex) spadeLTex = resourceManager->RetrieveTexture("spade_ul.png", RETRIEVE_MANAGE);
        if (!spadeRTex) spadeRTex = resourceManager->RetrieveTexture("spade_ur.png", RETRIEVE_MANAGE);
        if (!jewelTex) jewelTex = renderer->CreateTexture(5, 5, TEX_TYPE_USE_VRAM);
        if (!sideTex) sideTex = resourceManager->RetrieveTexture("menuside.png", RETRIEVE_MANAGE);
        spadeL = resourceManager->RetrieveQuad("spade_ul.png", 0, 0, 0, 0, "spade_ul", RETRIEVE_MANAGE);
        spadeR = resourceManager->RetrieveQuad("spade_ur.png", 0, 0, 0, 0, "spade_ur", RETRIEVE_MANAGE);
        jewel.reset(NEW JQuad(jewelTex, 1, 1, 3, 3));
        side = resourceManager->RetrieveQuad("menuside.png", 1, 1, 1, SimpleMenuConst::kPoleWidth, "menuside", RETRIEVE_MANAGE);

        stars = NEW hgeParticleSystem(resourceManager->RetrievePSI("stars.psi", resourceManager->GetQuad("stars").get()));

        stars->FireAt(mX, mY);
    }
}
コード例 #4
0
ファイル: InteractiveButton.cpp プロジェクト: Esplin/wagic
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);
}
コード例 #5
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);
    }
}
コード例 #6
0
ファイル: OptionItem.cpp プロジェクト: Esplin/wagic
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);

}
コード例 #7
0
ファイル: JGE.cpp プロジェクト: TomK14/w-menu
void JGE::Render()
{
    JRenderer* renderer = JRenderer::GetInstance();

    renderer->BeginScene();
    if (mApp != NULL) mApp->Render();
    renderer->EndScene();
}
コード例 #8
0
ファイル: SimplePopup.cpp プロジェクト: SkyRaiderX/wagic
// drawing routines
void SimplePopup::drawCorner(string imageName, bool flipX, bool flipY, float x, float y)
{
    LOG(" Drawing a Corner! ");
    JRenderer* r = JRenderer::GetInstance();
    JQuadPtr horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
    horizontalBarImage->SetHFlip(flipX);
    horizontalBarImage->SetVFlip(flipY);

    r->RenderQuad(horizontalBarImage.get(), x, y);
    LOG(" Done Drawing a Corner! ");
}
コード例 #9
0
ファイル: GameApp.cpp プロジェクト: 173210/w-menu
void GameApp::startTransition() {
    if (wallpapers.size() > 1) {
        JRenderer* renderer = JRenderer::GetInstance();
        int rnd = (rand() % wallpapers.size());
        backTex2=renderer->LoadTexture(wallpapers[rnd].c_str());
        if (backTex2) backQuad2 = new JQuad(backTex2, 0, 0, 480, 272);
    }

    transition = 0;

}
コード例 #10
0
ファイル: OptionItem.cpp プロジェクト: Esplin/wagic
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();
}
コード例 #11
0
ファイル: Damage.cpp プロジェクト: younthu/wagic
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());
    }

}
コード例 #12
0
ファイル: GameApp.cpp プロジェクト: DrakonPL/jge
void GameApp::Render()
{

	JRenderer* renderer = JRenderer::GetInstance();

	renderer->RenderQuad(mBg, 0, 0);
	
 	mFont->SetColor(ARGB(255,255,255,255));
 	mFont->DrawString("Press O to show spline", 5.0f, 130.0f, JGETEXT_LEFT); 

	if (mShowSpline)
		mSpline->Render(0, 0);

	mPlane->Render();

}
コード例 #13
0
ファイル: OptionItem.cpp プロジェクト: Esplin/wagic
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);
    }
}
コード例 #14
0
ファイル: CardDisplay.cpp プロジェクト: Rolzad73/wagic
void CardDisplay::Render()
{

    JRenderer * r = JRenderer::GetInstance();
    r->DrawRect(static_cast<float> (x), static_cast<float> (y), static_cast<float> (nb_displayed_items * 30 + 20), 50,
                    ARGB(255,255,255,255));
    if (!mObjects.size()) return;
    for (int i = start_item; i < start_item + nb_displayed_items && i < (int)(mObjects.size()); i++)
    {
        if (mObjects[i])
        {
            mObjects[i]->Render();
            if (tc)
            {
                CardGui * cardg = (CardGui *) mObjects[i];
                if (tc->alreadyHasTarget(cardg->card))
                {
                    r->DrawCircle(cardg->x + 5, cardg->y + 5, 5, ARGB(255,255,0,0));
                }
                else if (!tc->canTarget(cardg->card))
                {
                    r->FillRect(cardg->x, cardg->y, 30, 40, ARGB(200,0,0,0));
                }
            }
        }
    }

    //TODO: CardSelector should handle the graveyard and the library in the future...
    if (mObjects.size() && mObjects[mCurr] != NULL)
    {
        mObjects[mCurr]->Render();
        CardGui * cardg = ((CardGui *) mObjects[mCurr]);
        //Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
        Pos pos = Pos((CardGui::BigWidth / 2), CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220);
        int drawMode = DrawMode::kNormal;
        if (observer)
        {
            //pos.actY = 145;
            pos.actY = 142;//reduce y a little
            if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2;
            drawMode = observer->getCardSelector()->GetDrawMode();
        }

        cardg->DrawCard(pos, drawMode);
    }
}
コード例 #15
0
ファイル: GuiBackground.cpp プロジェクト: Azurami/wagic
void GuiBackground::Render()
{
    JRenderer* renderer = JRenderer::GetInstance();
    JQuadPtr quad;
    if (observer && observer->mRules && observer->mRules->bg.size())
    {
        quad = WResourceManager::Instance()->RetrieveTempQuad(observer->mRules->bg);
    }
    if (!quad.get())
    {
        quad = WResourceManager::Instance()->RetrieveTempQuad(kBackdropFile);
    }
    if (quad.get())
    {
        renderer->RenderQuad(quad.get(), 0, 18);
    }
}
コード例 #16
0
ファイル: DeckEditorMenu.cpp プロジェクト: Rolzad73/wagic
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();

}
コード例 #17
0
ファイル: SimplePopup.cpp プロジェクト: SkyRaiderX/wagic
void SimplePopup::drawHorzPole(string imageName, bool flipX = false, bool flipY = false, float x = 0, float y = 0, float width = SCREEN_WIDTH_F)
{
    LOG(" Drawing a horizontal border! ");
    JRenderer* r = JRenderer::GetInstance();
    JQuadPtr horizontalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
    if ( horizontalBarImage != NULL )
    {
    horizontalBarImage->SetHFlip(flipX);
    horizontalBarImage->SetVFlip(flipY);

    r->RenderQuad(horizontalBarImage.get(), x, y, 0, width);
    }
    else
    {
        LOG ( "ERROR: Error trying to render horizontal edge! ");
    }
    LOG(" Done Drawing a horizontal border! ");
}
コード例 #18
0
ファイル: JSpline.cpp プロジェクト: DrakonPL/jge
void JSpline::Render(float x, float y, PIXEL_TYPE color, PIXEL_TYPE controlColor)
{
	if (mCount > 0)
	{
		JRenderer* renderer = JRenderer::GetInstance();
//		renderer->SetLineWidth(1.2f);

		int size = mPixels.size();
		
		for (int i=0;i<size-1;i++)
			renderer->DrawLine(x+mPixels[i].x, y+mPixels[i].y, x+mPixels[i+1].x, y+mPixels[i+1].y, color);

		size = mMidPoints.size();
		for (int i=0; i < size; i++)
			renderer->FillRect(mMidPoints[i].x-3, mMidPoints[i].y-3, 6, 6, controlColor);
	}
	
}
コード例 #19
0
ファイル: SimplePopup.cpp プロジェクト: SkyRaiderX/wagic
void SimplePopup::drawVertPole(string imageName, bool flipX = false, bool flipY = false, float x = 0, float y = 0, float height = SCREEN_HEIGHT_F)
{
    LOG(" Drawing a Vertical border! ");
    JRenderer* r = JRenderer::GetInstance();
    JQuadPtr verticalBarImage = WResourceManager::Instance()->RetrieveTempQuad( imageName, TEXTURE_SUB_5551);
    if ( verticalBarImage != NULL )
    {
        verticalBarImage->SetHFlip(flipX);
        verticalBarImage->SetVFlip(flipY);

        r->RenderQuad(verticalBarImage.get(), x, y, 0, 1.0f, height);
    }
    else
    {
        LOG ( "ERROR: Error trying to render vertical edge! ");
    }
    LOG(" DONE Drawing a horizontal border! ");
}
コード例 #20
0
ファイル: GameApp.cpp プロジェクト: DrakonPL/jge
//-------------------------------------------------------------------------------------
// All rendering operations should be done in Render() only.
// 
//-------------------------------------------------------------------------------------
void GameApp::Render()
{

	// get JRenderer instance
	JRenderer* renderer = JRenderer::GetInstance();		

	// clear screen to black
	renderer->ClearScreen(ARGB(255,128,128,128));

	//
	// Your rendering code here...
	//

	if (mBox2D)	
		mBox2D->Render();
	

}
コード例 #21
0
ファイル: ActionStack.cpp プロジェクト: zwvc/wagic-x
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());
    }
}
コード例 #22
0
ファイル: SimplePopup.cpp プロジェクト: SkyRaiderX/wagic
void SimplePopup::Render()
{
    mClosed = false;

    JRenderer *r = JRenderer::GetInstance();
    string detailedInformation = getDetailedInformation(mDeckInformation->getFilename());

    const float textHeight = mTextFont->GetHeight() * mMaxLines;
    r->FillRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 0, 0, 0 ) );

    // currently causes a crash on the PSP when drawing the corners.
    // TODO: clean up the image ot make it loook cleaner. Find solution to load gfx to not crash PSP
#if 0
    r->DrawRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 125, 255, 0) );
    drawBoundingBox( mX-3, mY, mWidth + 3, textHeight );
#endif
    mTextFont->DrawString(detailedInformation.c_str(), mX + 9 , mY + 10);

}
コード例 #23
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
}
コード例 #24
0
ファイル: SimpleMenu.cpp プロジェクト: SkyRaiderX/wagic
void SimpleMenu::drawHorzPole(float x, float y, float width)
{
    JRenderer* renderer = JRenderer::GetInstance();

    float leftXOffset = (spadeR->mWidth - SimpleMenuConst::kPoleWidth) / 2;
    float rightXOffset = leftXOffset;
    float yOffset = leftXOffset;
    if (spadeR->mWidth != spadeR->mHeight) 
    {
        //We have a weird case to deal with in the "Classic" theme, the spades graphics need to be aligned specifically,
        // While the ones in the "Final Saga" theme need to be centered
        leftXOffset =  SimpleMenuConst::kSpadeWidthOffset;
        yOffset = SimpleMenuConst::kSpadeHeightOffset;
        rightXOffset = SimpleMenuConst::kSpadeRightBottomOffset;
    }

    renderer->RenderQuad(side.get(), x, y, 0, width);
    spadeR->SetHFlip(true);
    spadeL->SetHFlip(false);
    renderer->RenderQuad(spadeR.get(), x - leftXOffset, y - yOffset );
    renderer->RenderQuad(spadeL.get(), x + width - rightXOffset, y - yOffset);

    renderer->RenderQuad(jewel.get(), x, y - 1);
    renderer->RenderQuad(jewel.get(), x + width - 1, y - 1);
}
コード例 #25
0
ファイル: SimpleMenu.cpp プロジェクト: SkyRaiderX/wagic
void SimpleMenu::drawVertPole(float x, float y, float height)
{
    JRenderer* renderer = JRenderer::GetInstance();

    float xOffset = (spadeR->mWidth - SimpleMenuConst::kPoleWidth) / 2;
    float topYOffset = xOffset;
    float bottomYOffset = xOffset;
    if (spadeR->mWidth != spadeR->mHeight) 
    {
        //We have a weird case to deal with in the "Classic" theme, the spades graphics need to be aligned specifically,
        // While the ones in the "Final Saga" theme need to be centered
        xOffset = SimpleMenuConst::kSpadeHeightOffset;
        topYOffset = SimpleMenuConst::kSpadeWidthOffset;
        bottomYOffset = SimpleMenuConst::kSpadeRightBottomOffset;
    }

    renderer->RenderQuad(side.get(), x + SimpleMenuConst::kPoleWidth, y, M_PI / 2, height);
    spadeR->SetHFlip(true);
    spadeL->SetHFlip(false);
    renderer->RenderQuad(spadeR.get(), x + SimpleMenuConst::kPoleWidth + xOffset, y - topYOffset, M_PI / 2);
    renderer->RenderQuad(spadeL.get(), x + SimpleMenuConst::kPoleWidth + xOffset, y + height - bottomYOffset, M_PI / 2);

    renderer->RenderQuad(jewel.get(), x - 1, y - 1);
    renderer->RenderQuad(jewel.get(), x - 1, y + height - 1);
}
コード例 #26
0
ファイル: hgedistort.cpp プロジェクト: DrakonPL/jge
void hgeDistortionMesh::Render(float x, float y)
{
	int i,j,idx;

	VertexColor points[4];
	JRenderer* renderer = JRenderer::GetInstance();

	for(j=0; j<nRows-1; j++)
		for(i=0; i<nCols-1; i++)
		{
			idx=j*nCols+i;

			quad->SetTextureRect(disp_array[idx].u, disp_array[idx].v, cellw, cellh);

			points[0].x = x+disp_array[idx+nCols].x;
			points[0].y = y+disp_array[idx+nCols].y;
			points[0].z = disp_array[idx+nCols].z;
			points[0].color = disp_array[idx+nCols].color;

			points[1].x = x+disp_array[idx+nCols+1].x;
			points[1].y = y+disp_array[idx+nCols+1].y;
			points[1].z = disp_array[idx+nCols+1].z;
			points[1].color = disp_array[idx+nCols+1].color;

			points[2].x = x+disp_array[idx+1].x;
			points[2].y = y+disp_array[idx+1].y;
			points[2].z = disp_array[idx+1].z;
			points[2].color = disp_array[idx+1].color;

			points[3].x = x+disp_array[idx].x;
			points[3].y = y+disp_array[idx].y;
			points[3].z = disp_array[idx].z;
			points[3].color = disp_array[idx].color;

			renderer->RenderQuad(quad, points);

		}
}
コード例 #27
0
ファイル: GameApp.cpp プロジェクト: cymbiotica/wagic
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

}
コード例 #28
0
ファイル: GameApp.cpp プロジェクト: DrakonPL/jge
void GameApp::Create()
{

	mFont = new JLBFont("f3", 16, true);

	mSpline = new JSpline();						// Load spline and scale it down a little bit because the 
	mSpline->Load("sample.spl", 0.60f, 0.56f);		// spline was originally created for 800x600 size screen.
	mSpline->GeneratePixels();						// Generate all the points on the spline.

	JRenderer* renderer = JRenderer::GetInstance();
	
	mTexBg = renderer->LoadTexture("bg.jpg");
	mBg = new JQuad(mTexBg, 0, 0, SCREEN_WIDTH_F, SCREEN_HEIGHT_F);

	mTexPlane = renderer->LoadTexture("sprites.png");		// Load the plane and set up the animation frames.
	mPlane = new JGameObject(mTexPlane, 1, 1, 63, 63);
	mPlane->AddFrame(1,65,63,63);
	mPlane->AddFrame(1,129,63,63);
	mPlane->SetHotSpot(32, 32);

	mPlane->SetRenderFlags(RENDER_FLAG_ANGLE);				// Make the plane facing the direction it is moving to.


	mIndex = 0;
	mCounter = 0.0;

	Point pt;
	mSpline->GetPixel(pt, mIndex);
	mPlane->SetPosition(pt.x, pt.y);

	mSpline->GetPixel(pt, mIndex+1);
	mPlane->SetDirection(pt.x, pt.y);

	mShowSpline = false;

}
コード例 #29
0
ファイル: GameApp.cpp プロジェクト: DrakonPL/jge
//-------------------------------------------------------------------------------------
// All rendering operations should be done in Render() only.
// 
//-------------------------------------------------------------------------------------
void GameApp::Render()
{

	// get JRenderer instance
	JRenderer* renderer = JRenderer::GetInstance();		

	// clear screen to black
	renderer->ClearScreen(ARGB(0,0,0,0));

	float xList[] =
	{
		10, 100, 120, 80, 50, 10
	};

	float yList[] = 
	{
		100, 100, 60, 30, 10, 10
	};

	renderer->DrawPolygon(xList, yList, 6, ARGB(255,0,0,255));				// Draw polygon with 6 vertices.

	renderer->DrawLine(120, 100, 320, 250, 5, ARGB(255,255,0,0));				

	renderer->FillCircle(400, 180, 50, ARGB(255,123,60,200));

 	renderer->DrawPolygon(180, 200, 40, 4, mAngle, ARGB(255,0,0,255));		// Draw a symmetric polygon with 4 sides.
 
 	renderer->FillPolygon(80, 200, 80, 6, mAngle, ARGB(255,0,0,255));		// Draw a symmetric polygon with 6 sides.

	renderer->DrawRect(250, 100, 40, 60, ARGB(255,255,255,255));

	renderer->DrawRoundRect(340, 30, 30, 20, 5, ARGB(255,255,255,255));

	renderer->FillRoundRect(200, 20, 40, 40, 8, ARGB(255,255,255,64));

}
コード例 #30
0
ファイル: GameStateAwards.cpp プロジェクト: zwvc/wagic-x
void GameStateAwards::Render()
{
    JRenderer * r = JRenderer::GetInstance();
    r->ClearScreen(ARGB(0,0,0,0));

    JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("awardback.jpg", TEXTURE_SUB_5551);
    if (background.get())
        r->RenderQuad(background.get(), 0, 0);

    switch (mState)
    {
    case STATE_LISTVIEW:
        if (listview)
            listview->Render();
        break;
    case STATE_DETAILS:
        if (detailview)
            detailview->Render();
        break;
    }

    if (showMenu && menu)
        menu->Render();
}