예제 #1
0
//-----------------------------------------------------------------------------
// called when we're ticked...
//-----------------------------------------------------------------------------
void CEntityPanel::OnTick()
{
	// Determine if panel parent should switch
	ComputeParent();

	// If we should shouldn't draw, don't bother with any of this
	if ( !ShouldDraw() )
		return;

	// Update our current position
	int sx, sy;
	GetEntityPosition( sx, sy );

	// Recalculate our size
	ComputeAndSetSize();

	// Set the position
	SetPos( (int)(sx + m_OffsetX + 0.5f), (int)(sy + m_OffsetY + 0.5f));
}
예제 #2
0
//-----------------------------------------------------------------------------
// Purpose: Adds to beam entity list
//-----------------------------------------------------------------------------
void CBeam::AddEntity( void )
{
	// If set to invisible, skip. Do this before resetting the entity pointer so it has 
	// valid data to decide whether it's visible.
	if ( !ShouldDraw() )
	{
		return;
	}

	//FIXME: If we're hooked up to an attachment point, then recompute our bounds every frame
	if ( m_hAttachEntity[0].Get() || m_hAttachEntity[1].Get() )
	{
		// Compute the bounds here...
		Vector mins, maxs;
		ComputeBounds( mins, maxs );
		SetCollisionBounds( mins, maxs );
	}

	MoveToLastReceivedPosition();
}
예제 #3
0
bool Sprite::RenderMinimalSetup()
{
    if (!ShouldDraw())
        return false;

    UpdateTexture();

    SetBlendingMode(BlendingMode);

    UvBuffer->Bind();
    glVertexAttribPointer(WindowFrame.EnableAttribArray(A_UV), 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, nullptr);

    // Set the color.
    WindowFrame.SetUniform(U_COLOR, Red, Green, Blue, Alpha);
    DoQuadDraw();

    DrawLighten();

    return true;
}
예제 #4
0
AUI_ERRCODE aui_Region::Enable( BOOL enable )
{
	BOOL changed = FALSE;

	if ( enable )
	{
		if ( IsDisabled() )
		{
			m_attributes &= ~k_REGION_ATTRIBUTE_DISABLED;
			changed = TRUE;
		}
	}
	else
	{
		if ( !IsDisabled() )
		{
			m_attributes |= k_REGION_ATTRIBUTE_DISABLED;
			changed = TRUE;
		}
	}

	if(m_childList) {

		ListPos position = m_childList->GetHeadPosition();
		for ( sint32 i = m_childList->L(); i; i-- )
		{
			aui_Region *region = m_childList->GetNext( position );
			region->Enable( enable );
		}
	}

	if ( changed )
	{

		ShouldDraw();

		return Reset();
	}

	return AUI_ERRCODE_OK;
}
예제 #5
0
void SecurityBypass::ShowInterface ()
{

	if ( !IsInterfaceVisible () ) CreateInterface ();

	int pid = SvbLookupPID ( this );

	char main [32];
	char pause [32];
	char close [32];
	char title [32];
	char status [32];

	UplinkSnprintf ( main, sizeof ( main ), "sbypass_main %d", pid );
	UplinkSnprintf ( pause, sizeof ( pause ), "sbypass_pause %d", pid );
	UplinkSnprintf ( close, sizeof ( close ), "sbypass_close %d",  pid );
	UplinkSnprintf ( title, sizeof ( title ), "sbypass_title %d", pid );
	UplinkSnprintf ( status, sizeof ( status ), "sbypass_status %d", pid );
	
	/********** Patched by François Gagné **********/
	if ( ShouldDraw ( pid ) ) {

		EclButtonBringToFront ( main );
		EclButtonBringToFront ( pause );
		EclButtonBringToFront ( close );
		EclButtonBringToFront ( title );
		EclButtonBringToFront ( status );

	} else {

		EclButtonSendToBack ( status );
		EclButtonSendToBack ( title );
		EclButtonSendToBack ( close );
		EclButtonSendToBack ( pause );
		EclButtonSendToBack ( main );

	}

}
예제 #6
0
//-----------------------------------------------------------------------------
// Purpose: Abort selecting a weapon
//-----------------------------------------------------------------------------
void CBaseHudWeaponSelection::CancelWeaponSelection( void )
{
	C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
	if ( !player )
		return;

	// Fastswitches happen in a single frame, so the Weapon Selection HUD Element isn't visible
	// yet, but it's going to be next frame. We need to ask it if it thinks it's going to draw,
	// instead of checking it's IsActive flag.
	if ( ShouldDraw() )
	{
		HideSelection();

		m_hSelectedWeapon = NULL;

		// Play the "close weapon selection" sound
		player->EmitSound( "Player.WeaponSelectionClose" );
	}
	else
	{
		engine->ClientCmd("escape");
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CDownloadSliderPanel::OnTick( void )
{
	SetVisible( ShouldDraw() );
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointIcon::UpdateCapImage( void )
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer )
		return;

	if ( m_pCapImage )
	{
		int iCappingTeam = ObjectiveResource()->GetCappingTeam( m_iCPIndex );
		int iOwningTeam = ObjectiveResource()->GetOwningTeam( m_iCPIndex );

		if ( iCappingTeam != TEAM_UNASSIGNED && iCappingTeam != iOwningTeam )
		{
			const char *pszCapSwipe = ObjectiveResource()->GetGameSpecificCPCappingSwipe( m_iCPIndex, iCappingTeam );
			if ( m_bSwipeUp )
			{
				m_pCapImage->SetImage( VarArgs("%s_up",pszCapSwipe)  );
			}
			else
			{
				m_pCapImage->SetImage( pszCapSwipe );
			}
			m_pCapImage->SetVisible( true );

			// Tell the cap highlight image to fire up if it's our point being capped
			if ( m_pCapHighlightImage && pPlayer->GetTeamNumber() != iCappingTeam && pPlayer->GetTeamNumber() > LAST_SHARED_TEAM )
			{
				if ( ShouldDraw() && GetParent() && GetParent()->IsVisible() )
				{
					m_pCapHighlightImage->SetVisible( true );
					m_pCapHighlightImage->StartSwoop();
				}
				m_pBaseImage->StartPulsing( STARTCAPANIM_ICON_SWITCH, 0, true );
			}
			else
			{
				m_pBaseImage->StartPulsing( 0, 0, true );
			}

			if ( m_pCapPlayerImage )
			{
				m_pCapPlayerImage->SetVisible( true );
			}

			m_iPrevCappers = iCappingTeam;
			InvalidateLayout( true );
		}
		else
		{
			m_pBaseImage->StopPulsing();
			m_pCapImage->SetVisible( false );
			if ( m_pCapHighlightImage )
			{
				m_pCapHighlightImage->SetVisible( false );
			}
			if ( m_pCapPlayerImage )
			{
				m_pCapPlayerImage->SetVisible( false );
			}
			if ( m_pCapNumPlayers )
			{
				m_pCapNumPlayers->SetVisible( false );
			}
		}
	}
}
void CHudAmmo::Paint( void )
{
	int r, g, b, a, nUnused;
	int x, y;
	Color clrAmmo;

	if (!ShouldDraw())
		return;

	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	C_BaseCombatWeapon *pActiveWeapon = GetActiveWeapon();
	// find and display our current selection

	if ( !pPlayer || !pActiveWeapon )
	{
		hudlcd->SetGlobalStat( "(ammo_primary)", "n/a" );
		hudlcd->SetGlobalStat( "(ammo_secondary)", "n/a" );
		return;
	}

	hudlcd->SetGlobalStat( "(weapon_print_name)", pActiveWeapon ? pActiveWeapon->GetPrintName() : " " );
	hudlcd->SetGlobalStat( "(weapon_name)", pActiveWeapon ? pActiveWeapon->GetName() : " " );

	if ( ( pActiveWeapon->GetPrimaryAmmoType() == -1 ) && ( pActiveWeapon->GetSecondaryAmmoType() == -1 ) )
		return;

	int nFontWidth	= GetNumberFontWidth();
	int nFontHeight	= GetNumberFontHeight();

	a = (int)max( MIN_ALPHA, m_flFade );

	if ( m_flFade > 0 )
		m_flFade -= ( gpGlobals->frametime * 20 );

	(gHUD.m_clrYellowish).GetColor( r, g, b, nUnused );
	clrAmmo.SetColor( r, g, b, a );

	int nHudElemWidth, nHudElemHeight;
	GetSize( nHudElemWidth, nHudElemHeight );

	// Does this weapon have a clip?
	y = nHudElemHeight - ( nFontHeight * 1.5 );

	// Does weapon have any ammo at all?
	if ( pActiveWeapon->GetPrimaryAmmoType() != -1 )
	{
		CHudTexture	*icon_ammo = gWR.GetAmmoIconFromWeapon( pActiveWeapon->GetPrimaryAmmoType() );

		if ( !icon_ammo )
		{
			return;
		}

		int nIconWidth	= icon_ammo->Width();
		
		if ( pActiveWeapon->UsesClipsForAmmo1() )
		{
			// room for the number and the '|' and the current ammo
			
			x = nHudElemWidth - (8 * nFontWidth) - nIconWidth;
			x = DrawHudNumber( x, y, pActiveWeapon->Clip1(), clrAmmo );

			int nBarWidth = nFontWidth / 10;

			x += nFontWidth / 2;

			(gHUD.m_clrYellowish).GetColor( r, g, b, nUnused );
			clrAmmo.SetColor( r, g, b, a );

			// draw the | bar
			clrAmmo.SetColor( r, g, b, a  );
			vgui::surface()->DrawSetColor( clrAmmo );
			vgui::surface()->DrawFilledRect( x, y, x + nBarWidth, y + nFontHeight );

			x += nBarWidth + nFontWidth / 2;

			x = DrawHudNumber( x, y, pPlayer->GetAmmoCount( pActiveWeapon->GetPrimaryAmmoType() ), clrAmmo );		
		}
		else
		{
			// SPR_Draw a bullets only line
			x = nHudElemWidth - 4 * nFontWidth - nIconWidth;
			x = DrawHudNumber( x, y, pPlayer->GetAmmoCount( pActiveWeapon->GetPrimaryAmmoType() ), clrAmmo );
		}

		// Draw the ammo Icon
		icon_ammo->DrawSelf( x, y, clrAmmo );

		hudlcd->SetGlobalStat( "(ammo_primary)", VarArgs( "%d", pPlayer->GetAmmoCount( pActiveWeapon->GetPrimaryAmmoType() ) ) );
	}
	else
	{
		hudlcd->SetGlobalStat( "(ammo_primary)", "n/a" );
	}

	// Does weapon have seconday ammo?
	if ( pActiveWeapon->GetSecondaryAmmoType() != -1 )
	{
		CHudTexture	*icon_ammo = gWR.GetAmmoIconFromWeapon( pActiveWeapon->GetSecondaryAmmoType() );

		if ( !icon_ammo )
		{
			return;
		}

		int nIconWidth	= icon_ammo->Width();

		// Do we have secondary ammo?
		if ( pPlayer->GetAmmoCount( pActiveWeapon->GetSecondaryAmmoType() ) > 0 )
		{
			y -= ( nFontHeight * 1.25 );
			x = nHudElemWidth - 4 * nFontWidth - nIconWidth;
			x = DrawHudNumber( x, y, pPlayer->GetAmmoCount( pActiveWeapon->GetSecondaryAmmoType() ), clrAmmo );

			// Draw the ammo Icon
			icon_ammo->DrawSelf( x, y, clrAmmo );
		}

		hudlcd->SetGlobalStat( "(ammo_secondary)", VarArgs( "%d", pPlayer->GetAmmoCount( pActiveWeapon->GetSecondaryAmmoType() ) ) );
	}
	else
	{
		hudlcd->SetGlobalStat( "(ammo_secondary)", "n/a" );
	}

}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CDebugOverlay::OnTick( void )
{
	SetVisible( ShouldDraw() );
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CMessageCharsPanel::OnTick( void )
{
	SetVisible( ShouldDraw() );
}