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; }
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 (); }