本文整理汇总了C++中JQuadPtr类的典型用法代码示例。如果您正苦于以下问题:C++ JQuadPtr类的具体用法?C++ JQuadPtr怎么用?C++ JQuadPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JQuadPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
int ResourceManagerImpl::CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height)
{
if (!quadName.size() || !textureName.size()) return INVALID_ID;
if (GetQuad(quadName) != NULL)
{
assert(false);
return ALREADY_EXISTS;
}
WCachedTexture * jtex = textureWCache.Retrieve(0, textureName, RETRIEVE_MANAGE);
lastError = textureWCache.mError;
int id = INVALID_ID;
//Somehow, jtex wasn't promoted.
if (RETRIEVE_MANAGE && jtex && !jtex->isPermanent()) return id;
if (jtex)
{
JQuadPtr quad = jtex->GetQuad(x, y, width, height, quadName);
if (quad.get())
{
jtex->deadbolt();
WManagedQuad mq;
mq.resname = quadName;
mq.texture = jtex;
id = AddQuadToManaged(mq);
}
}
assert(id != INVALID_ID);
return id;
}
示例2: getDetailedInformation
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: sprintf
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);
}
示例4: RetrieveQuad
JQuadPtr ResourceManagerImpl::RetrieveCard(MTGCard * card, int style, int submode)
{
//Cards are never, ever resource managed, so just check cache.
if (!card || options[Options::DISABLECARDS].number) return JQuadPtr();
submode = submode | TEXTURE_SUB_CARD;
//static std::ostringstream filename;
//filename.str("");
string filename;
filename.reserve(4096);
//filename << setlist[card->setId] << "/" << card->getImageName();
filename.append(setlist[card->setId]);
filename.append("/");
filename.append(card->getImageName());
int id = card->getMTGId();
//Aliases.
if (style == RETRIEVE_THUMB)
{
submode = submode | TEXTURE_SUB_THUMB;
style = RETRIEVE_NORMAL;
}
JQuadPtr jq = RetrieveQuad(filename, 0, 0, 0, 0, "", style, submode | TEXTURE_SUB_5551, id);
lastError = textureWCache.mError;
if (jq)
{
jq->SetHotSpot(static_cast<float> (jq->mTex->mWidth / 2), static_cast<float> (jq->mTex->mHeight / 2));
return jq;
}
return JQuadPtr();
}
示例5: GetQuad
JQuadPtr WCachedTexture::GetCard(float offX, float offY, float width, float height, const string& resname)
{
JQuadPtr jq = GetQuad(offX, offY, width, height, resname);
if (jq.get())
jq->SetHotSpot(static_cast<float> (jq->mTex->mWidth / 2), static_cast<float> (jq->mTex->mHeight / 2));
return jq;
}
示例6: GetQuad
JQuadPtr ResourceManagerImpl::RetrieveQuad(const string& filename, float offX, float offY, float width, float height, string resname,
int style, int submode, int id)
{
//Lookup managed resources, but only with a real resname.
if (resname.size() && (style == RETRIEVE_MANAGE || style == RETRIEVE_RESOURCE))
{
JQuadPtr quad = GetQuad(resname);
if (quad.get() || style == RETRIEVE_RESOURCE) return quad;
}
//Aliases.
if (style == RETRIEVE_THUMB)
{
submode = submode | TEXTURE_SUB_THUMB;
style = RETRIEVE_NORMAL;
}
//Resname defaults to filename.
if (!resname.size()) resname = filename;
//No quad, but we have a managed texture for this!
WCachedTexture* jtex = textureWCache.Retrieve(id, filename, style, submode);
lastError = textureWCache.mError;
//Somehow, jtex wasn't promoted.
if (style == RETRIEVE_MANAGE && jtex && !jtex->isPermanent()) return JQuadPtr();
//Make this quad, overwriting any similarly resname'd quads.
if (jtex)
{
JQuadPtr quad = jtex->GetQuad(offX, offY, width, height, resname);
if (!quad.get())
return quad;
if (style == RETRIEVE_MANAGE && resname != "")
{
WManagedQuad mq;
mq.resname = resname;
mq.texture = jtex;
AddQuadToManaged(mq);
}
if (style == RETRIEVE_LOCK)
jtex->lock();
else if (style == RETRIEVE_UNLOCK)
jtex->unlock();
else if (style == RETRIEVE_MANAGE) jtex->deadbolt();
return quad;
}
//Texture doesn't exist, so no quad.
return JQuadPtr();
}
示例7: 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! ");
}
示例8: Render
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();
}
示例9: 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);
}
}
示例10: GetVerticalTextOffset
void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action,
bool bigQuad)
{
WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT);
mFont->SetColor(ARGB(255,255,255,255));
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT);
JRenderer * renderer = JRenderer::GetInstance();
JQuadPtr quad = observer->getResourceManager()->RetrieveCard(source, CACHE_THUMB);
if (!quad.get())
quad = CardGui::AlternateThumbQuad(source);
if (quad.get())
{
quad->SetColor(ARGB(255,255,255,255));
float scale = mHeight / quad->mHeight;
renderer->RenderQuad(quad.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale);
}
else if (alt1.size())
{
mFont->DrawString(_(alt1).c_str(), x, y + GetVerticalTextOffset());
}
if (bigQuad)
{
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode());
}
if (targetQuad)
{
float backupX = targetQuad->mHotSpotX;
float backupY = targetQuad->mHotSpotY;
targetQuad->SetColor(ARGB(255,255,255,255));
targetQuad->SetHotSpot(targetQuad->mWidth / 2, targetQuad->mHeight / 2);
float scale = mHeight / targetQuad->mHeight;
renderer->RenderQuad(targetQuad, x + 150, y + ((mHeight - targetQuad->mHeight) / 2) + targetQuad->mHotSpotY, 0, scale, scale);
targetQuad->SetHotSpot(backupX, backupY);
}
else if (alt2.size())
{
mFont->DrawString(_(alt2).c_str(), x + 120, y + GetVerticalTextOffset());
}
}
示例11: GuiLayer
GuiPhaseBar::GuiPhaseBar(DuelLayers* duelLayers) :
GuiLayer(duelLayers->getObserver()), PlayGuiObject(80, 0, 106, 0, false),
displayedPhaseId(0), angle(0.0f), zoomFactor(zoom_small), angleEasing(angle),
zoomFactorEasing(zoomFactor), mpDuelLayers(duelLayers)
{
if(duelLayers->getObserver()->getResourceManager())
{
JQuadPtr quad = WResourceManager::Instance()->GetQuad("phasebar");
if (quad.get() != NULL)
{
quad->mHeight = kHeight;
quad->mWidth = kWidth;
}
else
GameApp::systemError = "Error loading phasebar texture : " __FILE__;
}
mpDuelLayers->getCardSelector()->Add(this);
}
示例12: 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());
}
}
示例13: RenderBackground
void DeckMenu::RenderBackground()
{
ostringstream bgFilename;
bgFilename << backgroundName << ".png";
static bool loadBackground = true;
if (loadBackground)
{
//Erwan 2010/07/11 the TEXTURE_SUB_5551 below is useless, JGE doesn't support it for png. I'm letting it here to avoid causing a bug, but it should be removed
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad(bgFilename.str(), TEXTURE_SUB_5551);
if (background.get())
{
float scaleX = SCREEN_WIDTH_F / background.get()->mWidth;
float scaleY = SCREEN_HEIGHT_F / background.get()->mHeight;
JRenderer::GetInstance()->RenderQuad(background.get(), 0, 0,0,scaleX, scaleY);
}
else
loadBackground = false;
}
}
示例14: Render
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();
}
示例15: initMenuItems
void DeckMenu::Render()
{
JRenderer * renderer = JRenderer::GetInstance();
float height = mHeight;
if (!menuInitialized)
{
initMenuItems();
stars->Fire();
timeOpen = 0;
menuInitialized = true;
}
if (timeOpen < 1) height *= timeOpen > 0 ? timeOpen : -timeOpen;
for (int i = startId; i < startId + maxItems; i++)
{
if (i > mCount - 1) break;
DeckMenuItem *currentMenuItem = static_cast<DeckMenuItem*> (mObjects[i]);
if (currentMenuItem->getY() - DeckMenuConst::kLineHeight * startId < mY + height - DeckMenuConst::kLineHeight + 7)
{
// only load stats for visible items in the list
DeckMetaData* metaData = currentMenuItem->getMetaData();
if (metaData && !metaData->mStatsLoaded)
{
metaData->LoadStats();
}
if (currentMenuItem->hasFocus())
{
mSelectedDeck = metaData;
WFont *descriptionFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
// display the "more info" button if special condition is met
if (showDetailsScreen())
{
dismissButton->setIsSelectionValid(true);
dismissButton->Render();
}
else
{
dismissButton->setIsSelectionValid(false);
}
// display the avatar image
string currentAvatarImageName = currentMenuItem->getImageFilename();
if (currentAvatarImageName.size() > 0)
{
JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad(currentAvatarImageName, TEXTURE_SUB_AVATAR);
if(quad.get())
{
quad->mWidth = 35.f;
quad->mHeight = 50.f;
if (currentMenuItem->getText() == "Evil Twin")
{
JQuad * evil = quad.get();
evil->SetHFlip(true);
renderer->RenderQuad(quad.get(), avatarX, avatarY);
evil = NULL;
}
else
renderer->RenderQuad(quad.get(), avatarX, avatarY);
}
}
// fill in the description part of the screen
string text = wordWrap(_(currentMenuItem->getDescription()), descWidth, descriptionFont->mFontID );
descriptionFont->SetColor(ARGB(255,255,255,255));
descriptionFont->DrawString(text.c_str(), descX, descY);
// fill in the statistical portion
if (currentMenuItem->hasMetaData())
{
ostringstream oss;
oss << _("Deck: ") << currentMenuItem->getDeckName() << endl;
oss << currentMenuItem->getDeckStatsSummary();
descriptionFont->SetColor(ARGB(255,255,255,255));
descriptionFont->DrawString(oss.str(), statsX, statsY);
}
// change the font color of the current menu item
mFont->SetColor(ARGB(255,255,255,255));
}
else // reset the font color to be slightly muted
mFont->SetColor(ARGB(150,255,255,255));
currentMenuItem->RenderWithOffset(-DeckMenuConst::kLineHeight * startId);
}
}
if (!title.empty())
{
mFont->SetColor(ARGB(255,255,255,255));
mFont->DrawString(title.c_str(), titleX, titleY, JGETEXT_CENTER);
}
mScroller->Render();
RenderBackground();
RenderDeckManaColors();
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
stars->Render();
//.........这里部分代码省略.........