Ejemplo n.º 1
0
void MainMenu::DrawMainMenu()
{
	for (int8 i = 0; i < m_pButtonsInGame.Count(); i++)
		m_pButtonsInGame[i]->SetVisible(GameUI2().IsInLevel());

	for (int8 i = 0; i < m_pButtonsBackground.Count(); i++)
		m_pButtonsBackground[i]->SetVisible(GameUI2().IsInBackgroundLevel());

	for (int8 i = 0; i < m_pButtonsShared.Count(); i++)
		m_pButtonsShared[i]->SetVisible(GameUI2().IsInLevel() || GameUI2().IsInBackgroundLevel());

	CUtlVector<Button_MainMenu*> activeButtons;
	if (GameUI2().IsInLevel())
		activeButtons.AddVectorToTail(m_pButtonsInGame);
	else if (GameUI2().IsInBackgroundLevel())
		activeButtons.AddVectorToTail(m_pButtonsBackground);
	activeButtons.AddVectorToTail(m_pButtonsShared);

	m_pButtons = activeButtons;
	
	if (m_pButtons.Count() > 0)
		m_pButtons.Sort(ButtonsPositionTop);

	for (int8 i = 0; i < m_pButtons.Count(); i++)
	{
		if ((i + 1) < m_pButtons.Count())
		{
			int32 x0, y0;
			m_pButtons[i + 1]->GetPos(x0, y0);
			m_pButtons[i]->SetPos(m_fButtonsOffsetX, y0 - (m_pButtons[i]->GetHeight() + m_fButtonsSpace));
		}
		else
		{
			m_pButtons[i]->SetPos(m_fButtonsOffsetX, GameUI2().GetViewport().y - (m_fButtonsOffsetY + m_pButtons[i]->GetHeight()));
		}

		m_pButtons[i]->SetVisible(true);
	}
}
Ejemplo n.º 2
0
void CLightingEditor::RenderSprites()
{
	CMatRenderContextPtr pRenderContext( materials );
	pRenderContext->Bind( m_matSprite_Light );

	CUtlVector< def_light_t* > hSortedLights;
	hSortedLights.AddVectorToTail( m_hEditorLights );
	hSortedLights.Sort( DefLightSort );

	FOR_EACH_VEC( hSortedLights, i )
	{
		def_light_t *pLight = hSortedLights[ i ];

		Vector origin = pLight->pos;

		float flC3[3] = { 0 };
		float flMax = MAX( 1, MAX( pLight->col_diffuse[0],
			MAX( pLight->col_diffuse[1], pLight->col_diffuse[2] ) ) );

		for ( int i = 0; i < 3; i++ )
			flC3[i] = clamp( pLight->col_diffuse[i] / flMax, 0, 1 );

		DrawHalo( m_matSprite_Light, origin, LIGHT_BOX_SIZE, flC3 );
	}