本文整理汇总了C++中CItemType::GetImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemType::GetImage方法的具体用法?C++ CItemType::GetImage怎么用?C++ CItemType::GetImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemType
的用法示例。
在下文中一共展示了CItemType::GetImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateClassInfoItem
void CUIHelper::CreateClassInfoItem (const CItem &Item, int x, int y, int cxWidth, DWORD dwOptions, const CString &sExtraDesc, int *retcyHeight, IAnimatron **retpInfo) const
// CreateClassInfoItem
//
// Creates an item info animation
{
const CVisualPalette &VI = m_HI.GetVisuals();
const CG16bitFont &MediumFont = VI.GetFont(fontMedium);
const CG16bitFont &MediumBoldFont = VI.GetFont(fontMediumBold);
const CG16bitFont &SubTitleFont = VI.GetFont(fontSubTitle);
// Handle some edge conditions
CItemType *pType = Item.GetType();
if (pType == NULL)
{
if (retcyHeight)
*retcyHeight = 0;
CAniSequencer::Create(CVector(x, y), (CAniSequencer **)retpInfo);
return;
}
// Figure out some dimensions and metrics. Everything is relative to x, y.
bool bRightAlign = ((dwOptions & OPTION_ITEM_RIGHT_ALIGN) ? true : false);
int cxIcon = SMALL_ICON_WIDTH;
int cyIcon = SMALL_ICON_HEIGHT;
int xIcon = (bRightAlign ? -cxIcon : 0);
int yIcon = 0;
int cxText = cxWidth - (cxIcon + ITEM_INFO_SPACING_HORZ);
int xText = (bRightAlign ? -cxWidth : cxIcon + ITEM_INFO_SPACING_HORZ);
int yText = 0;
// Create a sequencer to hold all the controls
CAniSequencer *pRoot;
CAniSequencer::Create(CVector(x, y), &pRoot);
// Create a small item icon
const CObjectImageArray &Image = pType->GetImage();
RECT rcImage = Image.GetImageRect();
if (!Image.IsEmpty())
{
CG16bitImage *pIcon = new CG16bitImage;
pIcon->CreateFromImageTransformed(Image.GetImage(),
rcImage.left,
rcImage.top,
RectWidth(rcImage),
RectHeight(rcImage),
(Metric)SMALL_ICON_WIDTH / RectWidth(rcImage),
(Metric)SMALL_ICON_HEIGHT / RectHeight(rcImage),
0.0);
IAnimatron *pImageFrame = new CAniRect;
pImageFrame->SetPropertyVector(PROP_POSITION, CVector(xIcon, yIcon));
pImageFrame->SetPropertyVector(PROP_SCALE, CVector(SMALL_ICON_WIDTH, SMALL_ICON_HEIGHT));
pImageFrame->SetFillMethod(new CAniImageFill(pIcon, true));
pRoot->AddTrack(pImageFrame, 0);
}
// Create text
int cyText = 0;
IAnimatron *pName = new CAniText;
pName->SetPropertyVector(PROP_POSITION, CVector(xText, yText + cyText));
pName->SetPropertyVector(PROP_SCALE, CVector(cxText, 1000));
pName->SetPropertyColor(PROP_COLOR, VI.GetColor(colorTextDialogInput));
pName->SetPropertyFont(PROP_FONT, &MediumBoldFont);
pName->SetPropertyString(PROP_TEXT, pType->GetNounPhrase(nounActual));
if (bRightAlign)
pName->SetPropertyString(PROP_TEXT_ALIGN_HORZ, ALIGN_RIGHT);
pRoot->AddTrack(pName, 0);
cyText += MediumBoldFont.GetHeight();
// Add the damage type adjustment
CItemDataAnimatron *pDamageDesc = new CItemDataAnimatron(VI, Item);
if (!pDamageDesc->IsEmpty())
{
pDamageDesc->SetPropertyVector(PROP_POSITION, CVector(xText, yText + cyText));
pDamageDesc->SetPropertyVector(PROP_SCALE, CVector(cxText, 1000));
if (bRightAlign)
pDamageDesc->SetPropertyString(PROP_TEXT_ALIGN_HORZ, ALIGN_RIGHT);
pRoot->AddTrack(pDamageDesc, 0);
RECT rcRect;
pDamageDesc->GetSpacingRect(&rcRect);
cyText += RectHeight(rcRect);
}
else
delete pDamageDesc;
//.........这里部分代码省略.........