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.

116 lines
3.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. //
  9. // Train.cpp
  10. //
  11. // implementation of CHudAmmo class
  12. //
  13. #include "cbase.h"
  14. #include "hudelement.h"
  15. #include "hud_macros.h"
  16. #include "iclientmode.h"
  17. #include <vgui_controls/Controls.h>
  18. #include <vgui_controls/Panel.h>
  19. #include <vgui/ISurface.h>
  20. // memdbgon must be the last include file in a .cpp file!!!
  21. #include "tier0/memdbgon.h"
  22. using namespace vgui;
  23. class CHudTrain: public CHudElement, public vgui::Panel
  24. {
  25. DECLARE_CLASS_SIMPLE( CHudTrain, vgui::Panel );
  26. public:
  27. explicit CHudTrain( const char *pElementName );
  28. void Init( void );
  29. void VidInit( void );
  30. bool ShouldDraw( void );
  31. virtual void ApplySchemeSettings( vgui::IScheme *scheme );
  32. virtual void Paint( void );
  33. bool MsgFunc_Train(const CCSUsrMsg_Train &msg);
  34. CUserMessageBinder m_UMCMsgTrain;
  35. private:
  36. int m_iPos;
  37. };
  38. //
  39. //-----------------------------------------------------
  40. //
  41. DECLARE_HUDELEMENT( CHudTrain );
  42. DECLARE_HUD_MESSAGE( CHudTrain, Train )
  43. //-----------------------------------------------------------------------------
  44. // Purpose:
  45. //-----------------------------------------------------------------------------
  46. CHudTrain::CHudTrain( const char *pElementName ) :
  47. CHudElement( pElementName ), BaseClass( NULL, "HudTrain" )
  48. {
  49. vgui::Panel *pParent = GetClientMode()->GetViewport();
  50. SetParent( pParent );
  51. SetHiddenBits( HIDEHUD_MISCSTATUS );
  52. }
  53. //-----------------------------------------------------------------------------
  54. // Purpose:
  55. // Input : *scheme -
  56. //-----------------------------------------------------------------------------
  57. void CHudTrain::ApplySchemeSettings( IScheme *scheme )
  58. {
  59. BaseClass::ApplySchemeSettings( scheme );
  60. SetPaintBackgroundEnabled( false );
  61. }
  62. //-----------------------------------------------------------------------------
  63. // Purpose:
  64. //-----------------------------------------------------------------------------
  65. void CHudTrain::Init(void)
  66. {
  67. HOOK_HUD_MESSAGE( CHudTrain, Train );
  68. m_iPos = 0;
  69. }
  70. //-----------------------------------------------------------------------------
  71. // Purpose:
  72. //-----------------------------------------------------------------------------
  73. void CHudTrain::VidInit(void)
  74. {
  75. }
  76. //-----------------------------------------------------------------------------
  77. // Purpose:
  78. //-----------------------------------------------------------------------------
  79. bool CHudTrain::ShouldDraw( void )
  80. {
  81. return ( CHudElement::ShouldDraw() && m_iPos );
  82. }
  83. //-----------------------------------------------------------------------------
  84. // Purpose:
  85. //-----------------------------------------------------------------------------
  86. void CHudTrain::Paint()
  87. {
  88. // FIXME: Rewrite using vgui materials if we still do this type of train UI!!!
  89. }
  90. //-----------------------------------------------------------------------------
  91. // Purpose:
  92. //-----------------------------------------------------------------------------
  93. bool CHudTrain::MsgFunc_Train( const CCSUsrMsg_Train &msg )
  94. {
  95. // update Train data
  96. m_iPos = msg.train();
  97. return true;
  98. }