本文整理汇总了C++中C_BaseCombatWeapon::GetWeaponCrosshairScale方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseCombatWeapon::GetWeaponCrosshairScale方法的具体用法?C++ C_BaseCombatWeapon::GetWeaponCrosshairScale怎么用?C++ C_BaseCombatWeapon::GetWeaponCrosshairScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseCombatWeapon
的用法示例。
在下文中一共展示了C_BaseCombatWeapon::GetWeaponCrosshairScale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Paint
void CHudCrosshair::Paint( void )
{
if ( !m_pCrosshair )
return;
if ( !IsCurrentViewAccessAllowed() )
return;
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
if ( !pPlayer )
return;
float x, y;
bool bBehindCamera;
GetDrawPosition ( &x, &y, &bBehindCamera, m_vecCrossHairOffsetAngle );
if( bBehindCamera )
return;
float flWeaponScale = 1.f;
int iTextureW = m_pCrosshair->Width();
int iTextureH = m_pCrosshair->Height();
C_BaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
if ( pWeapon )
{
pWeapon->GetWeaponCrosshairScale( flWeaponScale );
}
float flPlayerScale = 1.0f;
#ifdef TF_CLIENT_DLL
Color clr( cl_crosshair_red.GetInt(), cl_crosshair_green.GetInt(), cl_crosshair_blue.GetInt(), 255 );
flPlayerScale = cl_crosshair_scale.GetFloat() / 32.0f; // the player can change the scale in the options/multiplayer tab
#else
Color clr = m_clrCrosshair;
#endif
float flWidth = flWeaponScale * flPlayerScale * (float)iTextureW;
float flHeight = flWeaponScale * flPlayerScale * (float)iTextureH;
int iWidth = (int)( flWidth + 0.5f );
int iHeight = (int)( flHeight + 0.5f );
int iX = (int)( x + 0.5f );
int iY = (int)( y + 0.5f );
if (pPlayer->IsInVGuiInputMode() && m_pVGUIHoverIcon)
m_pVGUIHoverIcon->DrawSelf(
iX - (m_pVGUIHoverIcon->Width() / 2),
iY - (m_pVGUIHoverIcon->Height() / 2),
m_pVGUIHoverIcon->Width(),
m_pVGUIHoverIcon->Height(),
Color(0, 255, 0, 255));
else
{
m_pCrosshair->DrawSelfCropped(
iX - (iWidth / 2), iY - (iHeight + 2),
0, 0,
iTextureW, iTextureH,
iWidth, iHeight,
clr);
}
}
示例2: Paint
void CHudCrosshair::Paint( void )
{
if ( !m_pCrosshair )
return;
if ( !IsCurrentViewAccessAllowed() )
return;
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
if ( !pPlayer )
return;
float x, y;
bool bBehindCamera;
GetDrawPosition ( &x, &y, &bBehindCamera, m_vecCrossHairOffsetAngle );
if( bBehindCamera )
return;
float flWeaponScale = 1.f;
int iTextureW = m_pCrosshair->Width();
int iTextureH = m_pCrosshair->Height();
C_BaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
if ( pWeapon )
{
pWeapon->GetWeaponCrosshairScale( flWeaponScale );
}
float flPlayerScale = 1.0f;
Color clr = m_clrCrosshair;
float flWidth = flWeaponScale * flPlayerScale * (float)iTextureW;
float flHeight = flWeaponScale * flPlayerScale * (float)iTextureH;
int iWidth = (int)( flWidth + 0.5f );
int iHeight = (int)( flHeight + 0.5f );
int iX = (int)( x + 0.5f );
int iY = (int)( y + 0.5f );
m_pCrosshair->DrawSelfCropped (
iX-(iWidth/2), iY-(iHeight/2),
0, 0,
iTextureW, iTextureH,
iWidth, iHeight,
clr );
}