Пример #1
0
void RearrangeTabButtons(CUITabControl* pTab, xr_vector<Fvector2>& vec_sign_places)
{
	TABS_VECTOR *	btn_vec		= pTab->GetButtonsVector();
	TABS_VECTOR::iterator it	= btn_vec->begin();
	TABS_VECTOR::iterator it_e	= btn_vec->end();
	vec_sign_places.clear		();
	vec_sign_places.resize		(btn_vec->size());

	Fvector2					pos;
	pos.set						((*it)->GetWndPos());
	Fvector2					sign_sz;
	sign_sz.set					(9.0f+3.0f, 11.0f);
	u32 idx						= 0;
	float	btn_text_len		= 0.0f;
	CUIStatic* st				= NULL;

	for(;it!=it_e;++it,++idx)
	{
		if(idx!=0)
		{
			st = xr_new<CUIStatic>(); st->SetAutoDelete(true);pTab->AttachChild(st);
			st->SetFont((*it)->GetFont());
			st->SetTextColor	(color_rgba(90,90,90,255));
			st->SetText("//");
			st->SetWndSize		((*it)->GetWndSize());
			st->AdjustWidthToText();
			st->SetWndPos		(pos);
			pos.x				+= st->GetWndSize().x;
		}

		vec_sign_places[idx].set(pos);
		vec_sign_places[idx].y	+= iFloor(((*it)->GetWndSize().y - sign_sz.y)/2.0f);
		vec_sign_places[idx].y	= (float)iFloor(vec_sign_places[idx].y);
		pos.x					+= sign_sz.x;

		(*it)->SetWndPos		(pos);
		(*it)->AdjustWidthToText();
		btn_text_len			= (*it)->GetWndSize().x;
		pos.x					+= btn_text_len+3.0f;
	}

}
Пример #2
0
float CUIPdaKillMessage::InitText(CUIStatic& refStatic, float x, PlayerInfo& info)
{

	if ( 0 == xr_strlen(info.m_name))
		return 0.0f;

	CGameFont* pFont					= GetFont();
	float _eps							= pFont->SizeOf_(' ');
	UI()->ClientToScreenScaledWidth		(_eps); //add one letter

	float height						= pFont->CurrentHeight_();
	float y								= (GetHeight() - height)/2;

	refStatic.SetWndPos					(Fvector2().set(x, y));
	refStatic.SetHeight					(GetHeight());
	refStatic.SetEllipsis				(1, 0);
	refStatic.SetText					(info.m_name.c_str());
	refStatic.AdjustWidthToText			();
	refStatic.SetWidth					(refStatic.GetWidth()+_eps);
	refStatic.SetTextColor				(info.m_color);

	return		refStatic.GetWidth		();
}