当前位置: 首页>>代码示例>>C++>>正文


C++ C_BaseCombatWeapon::GetWeaponCrosshairScale方法代码示例

本文整理汇总了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);
	}
}
开发者ID:TalonBraveInfo,项目名称:InvasionSource,代码行数:59,代码来源:hud_crosshair.cpp

示例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 );
}
开发者ID:Yosam02,项目名称:game,代码行数:44,代码来源:hud_crosshair.cpp


注:本文中的C_BaseCombatWeapon::GetWeaponCrosshairScale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。