예제 #1
0
// Add more strings to the control.  These are cycled when OnLeft() and OnRight() are called
void CLTGUICycleCtrl::AddString(const char *pString)
{
	
	if ( !pString || !m_pFont || !m_nFontSize || m_stringArray.size() >= kMaxNumStrings)
	{
		ASSERT(0);
		return;
	}



	int x = m_pos.x + (int)((float)m_nHeaderWidth * m_fScale);
	CUIFormattedPolyString *pPolyStr = g_pFontManager->CreateFormattedPolyString(m_pFont,(char *)pString,(float)x,(float)m_pos.y);


	if (pPolyStr)
	{

		pPolyStr->SetCharScreenHeight(m_nFontSize);

		m_stringArray.push_back(pPolyStr);

		//if this is the first string, select it
		if (m_nSelIndex == kNoSelection)
		{
			m_nSelIndex = 0;
			CalculateSize();
		}

	}
}
예제 #2
0
void CCredit::FormatStrings()
{
	float x = (float)m_Pos.x * g_pInterfaceResMgr->GetXRatio();
	float y = (float)m_Pos.y * g_pInterfaceResMgr->GetYRatio();
	FPStringArray::iterator iter = m_Strings.begin();
	while (iter != m_Strings.end())
	{
		CUIFormattedPolyString* pStr = *iter;

		uint8 nSize = (uint8)(16.0f * g_pInterfaceResMgr->GetXRatio());
		if (m_bBig)
			nSize = (uint8)(24.0f * g_pInterfaceResMgr->GetYRatio());


		pStr->SetCharScreenHeight(nSize);
		pStr->SetColor(argbWhite);
		pStr->SetAlignmentH(m_hAlign);
		pStr->SetPosition(x,y);
		y += (float)pStr->GetHeight();

		iter++;

	}

	float offset = y - ((float)m_Pos.y * g_pInterfaceResMgr->GetYRatio());
	switch (m_ePosition)
	{
	case CP_CENTER:
		offset /= 2.0f;
		break;
	case CP_UR:
	case CP_UL:
		offset = 0.0f;
		break;
	}

	if (offset > 0.0f)
	{
		FPStringArray::iterator iter = m_Strings.begin();
		while (iter != m_Strings.end())
		{
			CUIFormattedPolyString* pStr = *iter;

			float x,y;
			pStr->GetPosition(&x,&y);

			y -= offset;

			pStr->SetPosition(x,y);

			iter++;

		}

	}
	

}
예제 #3
0
void CHUDRadar::UpdateNamePositions()
{

	float fx = (float)(m_NamePos.x) * g_pInterfaceResMgr->GetXRatio();
	float fy = (float)(m_NamePos.y) * g_pInterfaceResMgr->GetYRatio();

	if( IsTeamGameType() )
	{
		CClientInfoMgr* pCIMgr = g_pInterfaceMgr->GetClientInfoMgr();
		CLIENT_INFO *pLocalCI = pCIMgr->GetLocalClient();
		uint8 nTeam = 0;
		if( pLocalCI)
		{
			nTeam = pLocalCI->nTeamID;
		}

		g_pDrawPrim->SetRGBA4( &teamPoly, nTeamColors[nTeam][1], nTeamColors[nTeam][0], nTeamColors[nTeam][1], nTeamColors[nTeam][2] );

		float fw = 90.0f * g_pInterfaceResMgr->GetXRatio();
		float fh = 90.0f * g_pInterfaceResMgr->GetYRatio();

		g_pDrawPrim->SetXYWH( &teamPoly, fx-fw, fy, fw, fh);

	}

		
	RadarPlayerList::iterator iter = m_Players.begin();
	while (iter != m_Players.end())
	{
		CUIFormattedPolyString* pStr = (*iter)->pName;

		if (pStr->GetLength())
		{
			uint8 nSize = (uint8)(12.0f * g_pInterfaceResMgr->GetXRatio());
			pStr->SetCharScreenHeight(nSize);
			
			pStr->SetPosition(fx,fy);
			fy += (float)pStr->GetHeight();
			
		}
		iter++;
	}
}