Пример #1
0
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
0
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
0
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;
}