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

	}
}
Exemple #2
0
void CHUDRadar::SetPlayerDead(HOBJECT hObj, bool bDead)
{
	if (!hObj) return;

	if (bDead)
		ChangeRadarType(hObj, RADAR_PLAYER_DEAD_TYPE );
	else
		ChangeRadarType(hObj, RADAR_PLAYER_ALIVE_TYPE );


	RadarPlayerList::iterator iter = m_Players.begin();
	while (iter != m_Players.end() &&  (*iter)->hObj != hObj )
	{
		iter++;
	}

	if (iter != m_Players.end())
	{
		CUIFormattedPolyString* pStr = (*iter)->pName;
		(*iter)->bDead = bDead;
		if (bDead)
			pStr->SetColor(nDeadColor);
		else
			pStr->SetColor(nLiveColor);
	}
}
Exemple #3
0
const char*	CLTGUIColumnCtrl::GetString(uint8 nColumnIndex) const
{
    CUIFormattedPolyString*	pString = GetPolyString(nColumnIndex);
    if (pString)
        return pString->GetText();
    else
        return LTNULL;
}
Exemple #4
0
// Build the screen
LTBOOL CScreenFailure::Build()
{
	CreateTitle(NULL);

	if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"FailStringRect"))
	{
		stringRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_FAILURE,"FailStringRect");
	}
	if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"FailStringSize"))
	{
		stringSize = (uint8)g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_FAILURE,"FailStringSize");
	}

	if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"HelpStringPos"))
	{
		helpPos = g_pLayoutMgr->GetScreenCustomPoint(SCREEN_ID_FAILURE,"HelpStringPos");
	}
	if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"HelpStringSize"))
	{
		helpSize = (uint8)g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_FAILURE,"HelpStringSize");
	}

	LTIntPt stringPos;
	stringPos.x = (stringRect.left + stringRect.right) / 2;
	stringPos.y = stringRect.top;
	m_pString = AddTextItem("failed",NULL,NULL,stringPos,LTTRUE);
	if (m_pString)
	{
		m_pString->SetFont(NULL,stringSize);
		m_pString->SetFixedWidth(stringRect.right - stringRect.left);
		CUIFormattedPolyString *pStr = m_pString->GetString();
		if (pStr)
		{
			pStr->SetAlignmentH(CUI_HALIGN_CENTER);
		}
	}

	if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"Delay"))
	{
		g_fDelay = g_pLayoutMgr->GetScreenCustomFloat(SCREEN_ID_FAILURE,"Delay");
	}

	CLTGUITextCtrl *pString = AddTextItem(IDS_HELP_FAILURE,NULL,NULL,helpPos,LTTRUE);
	if (pString)
	{
		pString->SetFont(NULL,helpSize);
	}


	// Make sure to call the base class
	if (! CBaseScreen::Build()) return LTFALSE;

	UseBack(LTFALSE);
	return LTTRUE;
}
Exemple #5
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++;

		}

	}
	

}
Exemple #6
0
void CCredit::Draw()
{
	// Sanity checks...

	if (m_Strings.size() <= 0) return;

	FPStringArray::iterator iter = m_Strings.begin();
	while (iter != m_Strings.end())
	{
		CUIFormattedPolyString* pStr = (*iter);
		float x;
		float y;
		pStr->GetPosition(&x,&y);

		//drop shadow
		pStr->SetPosition(x+2.0f,y+2.0f);
		pStr->SetColor(argbBlack);
		pStr->Render();

		pStr->SetPosition(x,y);
		pStr->SetColor(argbWhite);
		pStr->Render();
		iter++;
	}

}
Exemple #7
0
void CHUDRadar::UpdatePlayerName( uint32 nId, const char*pName, uint8 nTeamID )
{
	RadarPlayerList::iterator iter = m_Players.begin();
	while (iter != m_Players.end() &&  (*iter)->nID != nId )
	{
		iter++;
	}

	if (iter != m_Players.end())
	{
		CUIFormattedPolyString* pStr = (*iter)->pName;
		pStr->SetText(pName);


	}
	UpdateNamePositions();
}
Exemple #8
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++;
	}
}
Exemple #9
0
void CScreenFailure::OnFocus(LTBOOL bFocus)
{

	if (bFocus)
	{
		g_fDuration = 0.0f;
		if (m_pString)
		{
			CUIFormattedPolyString *pStr = m_pString->GetString();
			if (pStr)
				pStr->SetText(LoadTempString(g_pInterfaceMgr->GetFailStringID()));
		}
	}
	else
	{
		if (m_pString)
		{
			CUIFormattedPolyString *pStr = m_pString->GetString();
			if (pStr)
				pStr->SetText("");
		}
	}
	CBaseScreen::OnFocus(bFocus);
}