本文整理汇总了C++中CUIStatic::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ CUIStatic::Init方法的具体用法?C++ CUIStatic::Init怎么用?C++ CUIStatic::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUIStatic
的用法示例。
在下文中一共展示了CUIStatic::Init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitIcon
float CUIPdaKillMessage::InitIcon(CUIStatic& refStatic, float x, IconInfo& info){
if ( 0 == info.m_rect.width())
return 0;
if (info.m_shader == NULL)
return 0;
float y = 0;
float selfHeight = GetHeight();
float scale = 0;
Frect rect = info.m_rect;
float width = rect.width();
float height = rect.height();
scale = selfHeight/height;
if (scale > 1)
scale = 1;
width = width*scale;
height = height*scale;
y = (selfHeight - height) /2;
refStatic.Init(x, y, width, height);
refStatic.SetOriginalRect(info.m_rect);
refStatic.SetShader(info.m_shader);
refStatic.SetStretchTexture(true);
return width;
}
示例2: InitText
float CUIPdaKillMessage::InitText(CUIStatic& refStatic, float x, PlayerInfo& info){
if ( 0 == xr_strlen(info.m_name))
return 0;
float y = 0;
float selfHeight = GetHeight();
CGameFont* pFont = GetFont();
float width = pFont->SizeOf_(*info.m_name);
UI()->ClientToScreenScaledWidth (width);
float height = pFont->CurrentHeight_();
y = (selfHeight - height)/2;
float __eps = pFont->SizeOf_('o');//hack -(
UI()->ClientToScreenScaledWidth (__eps);
clamp (width, 0.0f, 120.0f);
refStatic.Init (x, 0/*y*/, width + __eps, height);
//. refStatic.SetElipsis (CUIStatic::eepEnd, 0);
refStatic.SetText (*info.m_name);
refStatic.SetTextColor (info.m_color);
return width;
}
示例3: AddField
CUIStatic* CUIListBoxItem::AddField(LPCSTR txt, float len, LPCSTR key)
{
fields.push_back (xr_new<CUIStatic>());
CUIStatic* st = fields.back();
AttachChild (st);
st->Init (FieldsLength(),0, GetWidth(), len);
st->SetFont (GetFont());
st->SetTextAlignment (GetTextAlignment());
st->SetVTextAlignment (m_lines.GetVTextAlignment());
st->SetTextColor (GetTextColor());
st->SetText (txt);
st->SetWindowName (key);
return st;
}