diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/cstrike/cs_hud_playerhealth.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/cstrike/cs_hud_playerhealth.h')
| -rw-r--r-- | game/client/cstrike/cs_hud_playerhealth.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/game/client/cstrike/cs_hud_playerhealth.h b/game/client/cstrike/cs_hud_playerhealth.h new file mode 100644 index 0000000..6009dc9 --- /dev/null +++ b/game/client/cstrike/cs_hud_playerhealth.h @@ -0,0 +1,77 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: To display the player's health with the use of one graphic over another. A cross in this case +// Currently this is only used on the freeze cam panel +// +// $NoKeywords: $ +//=============================================================================// + + +#ifndef CS_HUD_HEALTHPANEL_H +#define CS_HUD_HEALTHPANEL_H +#ifdef _WIN32 +#pragma once +#endif + +#include <KeyValues.h> +#include <vgui/IScheme.h> +#include <vgui/ISurface.h> +#include <vgui/ISystem.h> +#include <vgui_controls/AnimationController.h> +#include <vgui_controls/EditablePanel.h> +#include "vgui/ILocalize.h" +#include "hud.h" +#include "hudelement.h" + +//----------------------------------------------------------------------------- +// Purpose: Clips the health image to the appropriate percentage +//----------------------------------------------------------------------------- +class CCSHealthPanel : public vgui::Panel +{ +public: + DECLARE_CLASS_SIMPLE( CCSHealthPanel, vgui::Panel ); + + CCSHealthPanel( vgui::Panel *parent, const char *name ); + virtual void Paint(); + void SetHealth( float flHealth ){ m_flHealth = ( flHealth <= 1.0 ) ? flHealth : 1.0f; } + +private: + + float m_flHealth; // percentage from 0.0 -> 1.0 + int m_iMaterialIndex; + int m_iDeadMaterialIndex; +}; + +//----------------------------------------------------------------------------- +// Purpose: Displays player health data +//----------------------------------------------------------------------------- +class CCSHudPlayerHealth : public vgui::EditablePanel +{ + DECLARE_CLASS_SIMPLE( CCSHudPlayerHealth, EditablePanel ); + +public: + + CCSHudPlayerHealth( Panel *parent, const char *name ); + + virtual const char *GetResFilename( void ) { return "resource/UI/FreezePanelKillerHealth.res"; } + virtual void ApplySchemeSettings( vgui::IScheme *pScheme ); + virtual void Reset(); + + void SetHealth( int iNewHealth, int iMaxHealth, int iMaxBuffedHealth ); + void HideHealthBonusImage( void ); + +protected: + //virtual void OnThink(); + +protected: + float m_flNextThink; + +private: + CCSHealthPanel *m_pHealthImage; + vgui::ImagePanel *m_pHealthImageBG; + + int m_nHealth; + int m_nMaxHealth; +}; + +#endif
\ No newline at end of file |