Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.5 KiB

  1. //========= Copyright 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef HUD_CROSSHAIR_H
  8. #define HUD_CROSSHAIR_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "hudelement.h"
  13. #include <vgui_controls/Panel.h>
  14. namespace vgui
  15. {
  16. class IScheme;
  17. };
  18. //-----------------------------------------------------------------------------
  19. // Purpose:
  20. //-----------------------------------------------------------------------------
  21. class CHudCrosshair : public CHudElement, public vgui::Panel
  22. {
  23. DECLARE_CLASS_SIMPLE( CHudCrosshair, vgui::Panel );
  24. public:
  25. explicit CHudCrosshair( const char *pElementName );
  26. void SetCrosshairAngle( const QAngle& angle );
  27. void SetCrosshair( CHudTexture *texture, const Color& clr );
  28. void ResetCrosshair();
  29. void DrawCrosshair( void );
  30. bool HasCrosshair( void ) { return ( m_pCrosshair != NULL ); }
  31. bool ShouldDraw();
  32. protected:
  33. virtual void ApplySchemeSettings( vgui::IScheme *scheme );
  34. virtual void Paint();
  35. private:
  36. // Crosshair sprite and colors
  37. CHudTexture *m_pCrosshair;
  38. CHudTexture *m_pDefaultCrosshair;
  39. Color m_clrCrosshair;
  40. QAngle m_vecCrossHairOffsetAngle;
  41. QAngle m_curViewAngles;
  42. Vector m_curViewOrigin;
  43. CPanelAnimationVar( bool, m_bHideCrosshair, "never_draw", "false" );
  44. };
  45. #if !defined( CSTRIKE15 )
  46. // Enable/disable crosshair rendering.
  47. extern ConVar crosshair;
  48. #endif
  49. #endif // HUD_CROSSHAIR_H