本文整理汇总了C++中JRenderer类的典型用法代码示例。如果您正苦于以下问题:C++ JRenderer类的具体用法?C++ JRenderer怎么用?C++ JRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
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: Render
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: JGuiController
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: Render
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: Render
void JGE::Render()
{
JRenderer* renderer = JRenderer::GetInstance();
renderer->BeginScene();
if (mApp != NULL) mApp->Render();
renderer->EndScene();
}
示例6: LOG
// 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! ");
}
示例7: startTransition
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;
}
示例8: Overlay
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();
}
示例9: sprintf
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());
}
}
示例10: Render
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();
}
示例11: Render
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);
}
}
示例12: Render
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);
}
}
示例13: Render
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();
}
示例14: Render
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);
}
}
示例15: Render
//-------------------------------------------------------------------------------------
// 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();
}