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.

73 lines
2.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef HUD_NUMERICDISPLAY_H
  7. #define HUD_NUMERICDISPLAY_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <vgui_controls/Panel.h>
  12. //-----------------------------------------------------------------------------
  13. // Purpose: Base class for all the hud elements that are just a numeric display
  14. // with some options for text and icons
  15. //-----------------------------------------------------------------------------
  16. class CHudNumericDisplay : public vgui::Panel
  17. {
  18. DECLARE_CLASS_SIMPLE( CHudNumericDisplay, vgui::Panel );
  19. public:
  20. CHudNumericDisplay(vgui::Panel *parent, const char *name);
  21. void SetDisplayValue(int value);
  22. void SetSecondaryValue(int value);
  23. void SetShouldDisplayValue(bool state);
  24. void SetShouldDisplaySecondaryValue(bool state);
  25. void SetLabelText(const wchar_t *text);
  26. void SetIndent(bool state);
  27. void SetIsTime(bool state);
  28. bool ShouldDisplayValue( void ) { return m_bDisplayValue; }
  29. bool ShouldDisplaySecondaryValue( void ) { return m_bDisplaySecondaryValue; }
  30. virtual void Reset();
  31. protected:
  32. // vgui overrides
  33. virtual void Paint();
  34. virtual void PaintLabel();
  35. virtual void PaintNumbers(vgui::HFont font, int xpos, int ypos, int value);
  36. protected:
  37. int m_iValue;
  38. int m_iSecondaryValue;
  39. wchar_t m_LabelText[32];
  40. bool m_bDisplayValue, m_bDisplaySecondaryValue;
  41. bool m_bIndent;
  42. bool m_bIsTime;
  43. CPanelAnimationVar( float, m_flBlur, "Blur", "0" );
  44. CPanelAnimationVar( Color, m_TextColor, "TextColor", "FgColor" );
  45. CPanelAnimationVar( Color, m_Ammo2Color, "Ammo2Color", "FgColor" );
  46. CPanelAnimationVar( vgui::HFont, m_hNumberFont, "NumberFont", "HudNumbers" );
  47. CPanelAnimationVar( vgui::HFont, m_hNumberGlowFont, "NumberGlowFont", "HudNumbersGlow" );
  48. CPanelAnimationVar( vgui::HFont, m_hSmallNumberFont, "SmallNumberFont", "HudNumbersSmall" );
  49. CPanelAnimationVar( vgui::HFont, m_hTextFont, "TextFont", "Default" );
  50. CPanelAnimationVarAliasType( float, text_xpos, "text_xpos", "8", "proportional_float" );
  51. CPanelAnimationVarAliasType( float, text_ypos, "text_ypos", "20", "proportional_float" );
  52. CPanelAnimationVarAliasType( float, digit_xpos, "digit_xpos", "50", "proportional_float" );
  53. CPanelAnimationVarAliasType( float, digit_ypos, "digit_ypos", "2", "proportional_float" );
  54. CPanelAnimationVarAliasType( float, digit2_xpos, "digit2_xpos", "98", "proportional_float" );
  55. CPanelAnimationVarAliasType( float, digit2_ypos, "digit2_ypos", "16", "proportional_float" );
  56. };
  57. #endif // HUD_NUMERICDISPLAY_H