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.

90 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef DOD_HUD_PLAYERSTATUS_STAMINA_H
  8. #define DOD_HUD_PLAYERSTATUS_STAMINA_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //-----------------------------------------------------------------------------
  13. // Purpose: Stamina progress bar
  14. //-----------------------------------------------------------------------------
  15. class CDoDHudStaminaProgressBar : public vgui::Panel
  16. {
  17. DECLARE_CLASS_SIMPLE( CDoDHudStaminaProgressBar, vgui::Panel );
  18. public:
  19. CDoDHudStaminaProgressBar( vgui::Panel *parent, const char *name ) : vgui::Panel( parent, name ){}
  20. virtual void Paint();
  21. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  22. void SetPercentage( float flPercentage ){ m_flPercentage = flPercentage; }
  23. private:
  24. float m_flPercentage;
  25. Color m_clrActive;
  26. Color m_clrActiveLow;
  27. Color m_clrInactive;
  28. Color m_clrInactiveLow;
  29. CPanelAnimationVarAliasType( float, m_flSliceWidth, "slice_width", "5", "proportional_float" );
  30. CPanelAnimationVarAliasType( float, m_flSliceSpacer, "slice_spacer", "2", "proportional_float" );
  31. CPanelAnimationVar( float, m_flWarningLevel, "warning_level", "0.25" );
  32. };
  33. //-----------------------------------------------------------------------------
  34. // Purpose: Stamina icon
  35. //-----------------------------------------------------------------------------
  36. class CDoDHudStaminaIcon : public vgui::ImagePanel
  37. {
  38. DECLARE_CLASS_SIMPLE( CDoDHudStaminaIcon, vgui::ImagePanel );
  39. public:
  40. CDoDHudStaminaIcon( vgui::Panel *parent, const char *name );
  41. virtual void Paint();
  42. virtual void ApplySettings( KeyValues *inResourceData );
  43. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  44. void SetPercentage( float flPercentage ){ m_flPercentage = flPercentage; }
  45. private:
  46. float m_flPercentage;
  47. CHudTexture *m_icon;
  48. CPanelAnimationVar( float, m_flWarningLevel, "warning_level", "0.25" );
  49. char m_szIcon[128];
  50. Color m_clrActive;
  51. Color m_clrActiveLow;
  52. };
  53. //-----------------------------------------------------------------------------
  54. // Purpose: Stamina panel
  55. //-----------------------------------------------------------------------------
  56. class CDoDHudStamina : public vgui::EditablePanel
  57. {
  58. DECLARE_CLASS_SIMPLE( CDoDHudStamina, vgui::EditablePanel );
  59. public:
  60. CDoDHudStamina( vgui::Panel *parent, const char *name );
  61. virtual void OnThink();
  62. virtual void OnScreenSizeChanged( int iOldWide, int iOldTall );
  63. private:
  64. CDoDCutEditablePanel *m_pBackground;
  65. CDoDHudStaminaIcon *m_pIcon;
  66. CDoDHudStaminaProgressBar *m_pProgressBar;
  67. };
  68. #endif // DOD_HUD_PLAYERSTATUS_STAMINA_H