void CHudVguiScreenCursor::Paint( void )
{
	if ( !m_pCursor )
		return;

	float x, y;
	x = ScreenWidth()/2;
	y = ScreenHeight()/2;

	C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer )
		return;

	if ( pPlayer->IsInViewModelVGuiInputMode() )
	{
		int iX, iY;
		vgui::input()->GetCursorPos(iX, iY);
		x = (float)iX;
		y = (float)iY;
	}

	m_pCursor->DrawSelf( 
		x - 0.5f * m_pCursor->Width(), 
		y - 0.5f * m_pCursor->Height(),
		m_clrCrosshair );
}
//-----------------------------------------------------------------------------
// 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 CHudVguiScreenCursor::ShouldDraw( void )
{
	C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer )
		return false;

	if ( pPlayer->IsInViewModelVGuiInputMode() )
	{
		return false;
	}

	if ( !pPlayer->IsInVGuiInputMode() )
	{
		return false;
	}

	return CHudElement::ShouldDraw();
}
//-----------------------------------------------------------------------------
// Purpose: Think used for selection of weapon menu item.
//-----------------------------------------------------------------------------
void CBaseHudWeaponSelection::ProcessInput()
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer )
		return;

	// Check to see if the player is in VGUI mode...
	if ( pPlayer->IsInVGuiInputMode() && !pPlayer->IsInViewModelVGuiInputMode() )
	{
		// If so, close weapon selection when they press fire
		if ( gHUD.m_iKeyBits & IN_ATTACK )
		{
			if ( HUDTYPE_PLUS != hud_fastswitch.GetInt() )
			{
				// Swallow the button
				gHUD.m_iKeyBits &= ~IN_ATTACK;
				input->ClearInputButton( IN_ATTACK );
			}

			engine->ClientCmd( "cancelselect\n" );
		}
		return;
	}

	// Has the player selected a weapon?
	if ( gHUD.m_iKeyBits & (IN_ATTACK | IN_ATTACK2) )
	{
		if ( IsWeaponSelectable() )
		{
#ifndef TF_CLIENT_DLL
			if ( HUDTYPE_PLUS != hud_fastswitch.GetInt() )
#endif
			{
				// Swallow the button
				gHUD.m_iKeyBits &= ~(IN_ATTACK | IN_ATTACK2);
				input->ClearInputButton( IN_ATTACK );
				input->ClearInputButton( IN_ATTACK2 );
			}

			// select weapon
			SelectWeapon();
		}
	}
}