本文整理汇总了C++中C_BaseCombatWeapon::ShouldDrawCrosshair方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseCombatWeapon::ShouldDrawCrosshair方法的具体用法?C++ C_BaseCombatWeapon::ShouldDrawCrosshair怎么用?C++ C_BaseCombatWeapon::ShouldDrawCrosshair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseCombatWeapon
的用法示例。
在下文中一共展示了C_BaseCombatWeapon::ShouldDrawCrosshair方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShouldDraw
//-----------------------------------------------------------------------------
// Purpose: Save CPU cycles by letting the HUD system early cull
// costly traversal. Called per frame, return true if thinking and
// painting need to occur.
//-----------------------------------------------------------------------------
bool CHudCrosshair::ShouldDraw( void )
{
bool bNeedsDraw;
if ( m_bHideCrosshair )
return false;
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
if ( !pPlayer )
return false;
C_BaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
if ( pWeapon && !pWeapon->ShouldDrawCrosshair() )
return false;
/* disabled to avoid assuming it's an HL2 player.
// suppress crosshair in zoom.
if ( pPlayer->m_HL2Local.m_bZooming )
return false;
*/
// draw a crosshair only if alive or spectating in eye
bNeedsDraw = m_pCrosshair &&
crosshair.GetInt() &&
!engine->IsDrawingLoadingImage() &&
!engine->IsPaused() &&
g_pClientMode->ShouldDrawCrosshair() &&
!( pPlayer->GetFlags() & FL_FROZEN ) &&
( pPlayer->entindex() == render->GetViewEntity() ) &&
//!pPlayer->IsInVGuiInputMode() &&
( pPlayer->IsAlive() || ( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE ) || ( cl_observercrosshair.GetBool() && pPlayer->GetObserverMode() == OBS_MODE_ROAMING ) );
return ( bNeedsDraw && CHudElement::ShouldDraw() );
}
示例2: ShouldDraw
//-----------------------------------------------------------------------------
// Purpose: Save CPU cycles by letting the HUD system early cull
// costly traversal. Called per frame, return true if thinking and
// painting need to occur.
//-----------------------------------------------------------------------------
bool CHudCrosshair::ShouldDraw( void )
{
bool bNeedsDraw;
if ( m_bHideCrosshair )
return false;
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
if ( !pPlayer )
return false;
C_BaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
if ( pWeapon && !pWeapon->ShouldDrawCrosshair() )
return false;
#ifdef PORTAL
// C_Portal_Player *portalPlayer = ToPortalPlayer(pPlayer);
// if ( portalPlayer && portalPlayer->IsSuppressingCrosshair() )
// return false;
#endif // PORTAL
/* disabled to avoid assuming it's an HL2 player.
// suppress crosshair in zoom.
if ( pPlayer->m_HL2Local.m_bZooming )
return false;
*/
// draw a crosshair only if alive or spectating in eye
if ( IsX360() )
{
bNeedsDraw = m_pCrosshair &&
!engine->IsDrawingLoadingImage() &&
!engine->IsPaused() &&
( !pPlayer->IsSuitEquipped() || g_pGameRules->IsMultiplayer() ) &&
g_pClientMode->ShouldDrawCrosshair() &&
!( pPlayer->GetFlags() & FL_FROZEN ) &&
( pPlayer->entindex() == render->GetViewEntity() ) &&
( pPlayer->IsAlive() || ( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE ) || ( cl_observercrosshair.GetBool() && pPlayer->GetObserverMode() == OBS_MODE_ROAMING ) );
}
else
{
bNeedsDraw = m_pCrosshair &&
crosshair.GetInt() &&
!engine->IsDrawingLoadingImage() &&
!engine->IsPaused() &&
g_pClientMode->ShouldDrawCrosshair() &&
!( pPlayer->GetFlags() & FL_FROZEN ) &&
( pPlayer->entindex() == render->GetViewEntity() ) &&
!pPlayer->IsInVGuiInputMode() &&
( pPlayer->IsAlive() || ( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE ) || ( cl_observercrosshair.GetBool() && pPlayer->GetObserverMode() == OBS_MODE_ROAMING ) );
}
return ( bNeedsDraw && CHudElement::ShouldDraw() );
}
示例3: ShouldDraw
//-----------------------------------------------------------------------------
// Purpose: Save CPU cycles by letting the HUD system early cull
// costly traversal. Called per frame, return true if thinking and
// painting need to occur.
//-----------------------------------------------------------------------------
bool CDAHudCrosshair::ShouldDraw( void )
{
// OnThink isn't called when the thing isn't visible so force it to update.
CalculateCrosshair();
bool bNeedsDraw;
if ( m_bHideCrosshair )
return false;
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
if ( !pPlayer )
return false;
C_BaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
if ( pWeapon && !pWeapon->ShouldDrawCrosshair() )
return false;
ConVarRef cl_observercrosshair("cl_observercrosshair");
// draw a crosshair only if alive or spectating in eye
if ( IsX360() )
{
bNeedsDraw = m_pCrosshair &&
!engine->IsDrawingLoadingImage() &&
!engine->IsPaused() &&
( !pPlayer->IsSuitEquipped() || g_pGameRules->IsMultiplayer() ) &&
g_pClientMode->ShouldDrawCrosshair() &&
!( pPlayer->GetFlags() & FL_FROZEN ) &&
( pPlayer->entindex() == render->GetViewEntity() ) &&
( pPlayer->IsAlive() || ( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE ) || ( cl_observercrosshair.GetBool() && pPlayer->GetObserverMode() == OBS_MODE_ROAMING ) );
}
else
{
bNeedsDraw = m_pCrosshair &&
da_crosshair.GetInt() &&
!engine->IsDrawingLoadingImage() &&
!engine->IsPaused() &&
g_pClientMode->ShouldDrawCrosshair() &&
!( pPlayer->GetFlags() & FL_FROZEN ) &&
( pPlayer->entindex() == render->GetViewEntity() ) &&
!pPlayer->IsInVGuiInputMode() &&
( pPlayer->IsAlive() || ( pPlayer->GetObserverMode() == OBS_MODE_IN_EYE ) || ( cl_observercrosshair.GetBool() && pPlayer->GetObserverMode() == OBS_MODE_ROAMING ) );
}
return ( bNeedsDraw && CHudElement::ShouldDraw() );
}