本文整理汇总了C++中CItemType::HasAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemType::HasAttribute方法的具体用法?C++ CItemType::HasAttribute怎么用?C++ CItemType::HasAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemType
的用法示例。
在下文中一共展示了CItemType::HasAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PaintItem
void CGItemListArea::PaintItem (CG16bitImage &Dest, const CItem &Item, const RECT &rcRect, bool bSelected)
// PaintItem
//
// Paints the item
{
// Item context
CItemCtx Ctx(&Item, m_pListData->GetSource());
CItemType *pItemType = Item.GetType();
// Paint the image
DrawItemTypeIcon(Dest, rcRect.left, rcRect.top, pItemType);
RECT rcDrawRect = rcRect;
rcDrawRect.left += ICON_WIDTH + ITEM_TEXT_MARGIN_X;
rcDrawRect.right -= ITEM_TEXT_MARGIN_X;
rcDrawRect.top += ITEM_TEXT_MARGIN_Y;
// Paint the attribute blocks
RECT rcAttrib;
rcAttrib = rcDrawRect;
rcAttrib.bottom = rcAttrib.top + m_pFonts->MediumHeavyBold.GetHeight();
if (Item.IsDamaged())
PaintItemModifier(Dest,
CONSTLIT("Damaged"),
RGB_ILLEGAL_BACKGROUND,
&rcAttrib);
else if (Item.IsDisrupted())
PaintItemModifier(Dest,
CONSTLIT("Ionized"),
RGB_ILLEGAL_BACKGROUND,
&rcAttrib);
if (pItemType->IsKnown()
&& pItemType->HasAttribute(CONSTLIT("Military")))
PaintItemModifier(Dest,
CONSTLIT("Military"),
RGB_MILITARY_BACKGROUND,
&rcAttrib);
if (pItemType->IsKnown()
&& pItemType->HasAttribute(CONSTLIT("Illegal")))
PaintItemModifier(Dest,
CONSTLIT("Illegal"),
RGB_ILLEGAL_BACKGROUND,
&rcAttrib);
CString sEnhanced = Item.GetEnhancedDesc(m_pListData->GetSource());
if (!sEnhanced.IsBlank())
{
bool bDisadvantage = (*(sEnhanced.GetASCIIZPointer()) == '-');
PaintItemModifier(Dest,
sEnhanced,
(bDisadvantage ? RGB_ILLEGAL_BACKGROUND : RGB_MILITARY_BACKGROUND),
&rcAttrib);
}
// Paint the item name
int cyHeight;
RECT rcTitle = rcDrawRect;
rcTitle.right = rcAttrib.right;
m_pFonts->LargeBold.DrawText(Dest,
rcTitle,
m_pFonts->wItemTitle,
Item.GetNounPhrase(nounCount | nounNoModifiers),
0,
CG16bitFont::SmartQuotes | CG16bitFont::TruncateLine,
&cyHeight);
rcDrawRect.top += cyHeight;
// Stats
CString sStat;
int iLevel = pItemType->GetApparentLevel();
CString sReference = pItemType->GetReference(Ctx);
DamageTypes iDamageType;
CString sDamageRef;
int iDamageAdj[damageCount];
int iHP;
if (Item.GetReferenceDamageType(m_pListData->GetSource(), -1, 0, &iDamageType, &sDamageRef))
{
// Paint the initial text
sStat = strPatternSubst("Level %s —", strLevel(iLevel));
int cxWidth = m_pFonts->Medium.MeasureText(sStat, &cyHeight);
m_pFonts->Medium.DrawText(Dest,
rcDrawRect,
m_pFonts->wItemRef,
sStat,
0,
0,
//.........这里部分代码省略.........