Team Fortress 2 Source Code as on 22/4/2020
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.

78 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef DOD_HUD_PLAYERSTATUS_HEALTH_H
  8. #define DOD_HUD_PLAYERSTATUS_HEALTH_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. class C_DODPlayer;
  13. //-----------------------------------------------------------------------------
  14. // Purpose: Health playerclass image (with red transparency)
  15. //-----------------------------------------------------------------------------
  16. class CDoDHudHealthBar : public vgui::ImagePanel
  17. {
  18. DECLARE_CLASS_SIMPLE( CDoDHudHealthBar, vgui::ImagePanel );
  19. public:
  20. CDoDHudHealthBar( vgui::Panel *parent, const char *name );
  21. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  22. virtual void OnThink();
  23. virtual void Paint( void );
  24. void SetHealthDelegatePlayer( C_DODPlayer *pPlayer );
  25. C_DODPlayer *GetHealthDelegatePlayer( void );
  26. private:
  27. float m_flPercentage;
  28. int m_iMaterialIndex;
  29. Color m_clrHealthHigh;
  30. Color m_clrHealthMed;
  31. Color m_clrHealthLow;
  32. Color m_clrBackground;
  33. Color m_clrBorder;
  34. EHANDLE m_hHealthDelegatePlayer;
  35. CPanelAnimationVar( float, m_flFirstWarningLevel, "FirstWarning", "0.50" );
  36. CPanelAnimationVar( float, m_flSecondWarningLevel, "SecondWarning", "0.25" );
  37. };
  38. //-----------------------------------------------------------------------------
  39. // Purpose: Health panel
  40. //-----------------------------------------------------------------------------
  41. class CDoDHudHealth : public vgui::EditablePanel
  42. {
  43. DECLARE_CLASS_SIMPLE( CDoDHudHealth, vgui::EditablePanel );
  44. public:
  45. CDoDHudHealth( vgui::Panel *parent, const char *name );
  46. virtual void OnThink();
  47. virtual void OnScreenSizeChanged(int iOldWide, int iOldTall);
  48. void SetHealthDelegatePlayer( C_DODPlayer *pPlayer );
  49. C_DODPlayer *GetHealthDelegatePlayer( void );
  50. private:
  51. int m_nPrevClass; // used to store the player's class so we don't have to keep setting the image
  52. int m_nPrevTeam;
  53. CDoDHudHealthBar *m_pHealthBar;
  54. vgui::ImagePanel *m_pClassImage; // draws the class image and the red "damage taken" part
  55. vgui::ImagePanel *m_pClassImageBG; // draws the class image outline
  56. EHANDLE m_hHealthDelegatePlayer;
  57. };
  58. #endif // DOD_HUD_PLAYERSTATUS_HEALTH_H