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.

66 lines
1.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef TF_HUD_AMMOSTATUS_H
  8. #define TF_HUD_AMMOSTATUS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #define TF_MAX_GRENADES 4
  13. #define TF_MAX_FILENAME_LENGTH 128
  14. //-----------------------------------------------------------------------------
  15. // Purpose: Displays weapon ammo data
  16. //-----------------------------------------------------------------------------
  17. class CTFHudWeaponAmmo : public CHudElement, public vgui::EditablePanel
  18. {
  19. DECLARE_CLASS_SIMPLE( CTFHudWeaponAmmo, vgui::EditablePanel );
  20. public:
  21. CTFHudWeaponAmmo( const char *pElementName );
  22. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  23. virtual void Reset();
  24. virtual bool ShouldDraw( void );
  25. protected:
  26. virtual void OnThink();
  27. private:
  28. void UpdateAmmoLabels( bool bPrimary, bool bReserve, bool bNoClip );
  29. void ShowLowAmmoIndicator( void );
  30. void SizeLowAmmoIndicator( float flCurrentAmount, float flMaxAmount );
  31. void HideLowAmmoIndicator( void );
  32. private:
  33. float m_flNextThink;
  34. CHandle<C_BaseCombatWeapon> m_hCurrentActiveWeapon;
  35. int m_nAmmo;
  36. int m_nAmmo2;
  37. int m_nLowAmmoImageOrigX;
  38. int m_nLowAmmoImageOrigY;
  39. int m_nLowAmmoImageOrigW;
  40. int m_nLowAmmoImageOrigH;
  41. CExLabel *m_pInClip;
  42. CExLabel *m_pInClipShadow;
  43. CExLabel *m_pInReserve;
  44. CExLabel *m_pInReserveShadow;
  45. CExLabel *m_pNoClip;
  46. CExLabel *m_pNoClipShadow;
  47. vgui::ImagePanel *m_pLowAmmoImage;
  48. };
  49. #endif // TF_HUD_AMMOSTATUS_H