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/vgui_entitypanel.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/vgui_entitypanel.h')
| -rw-r--r-- | game/client/vgui_entitypanel.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/game/client/vgui_entitypanel.h b/game/client/vgui_entitypanel.h new file mode 100644 index 0000000..69cfbb3 --- /dev/null +++ b/game/client/vgui_entitypanel.h @@ -0,0 +1,84 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: This is a panel which is rendered on top of an entity +// +// $Revision: $ +// $NoKeywords: $ +//=============================================================================// + +#ifndef VGUI_ENTITYPANEL_H +#define VGUI_ENTITYPANEL_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "c_baseentity.h" +#include <vgui/MouseCode.h> +#include "vgui_basepanel.h" + +// forward declarations +class KeyValues; + + +//----------------------------------------------------------------------------- +// This is a base class for a panel which always is rendered on top of an entity +//----------------------------------------------------------------------------- +class CEntityPanel : public CBasePanel +{ +public: + DECLARE_CLASS( CEntityPanel, CBasePanel ); + + // constructor + CEntityPanel( vgui::Panel *pParent, const char *panelName ); + + virtual void ComputeParent( void ); + virtual void ComputeAndSetSize( void ); + + // Initialize from key values + bool Init( KeyValues* pKeyValues, C_BaseEntity* pEntity ); + + // Determine where our entity is in screen space. + void GetEntityPosition( int& sx, int& sy ); + + // Base implementation of ShouldDraw + bool ShouldDraw(); + + // called when we're ticked (updates our position)... + virtual void OnTick( void ); + + virtual void OnCursorEntered(); + virtual void OnCursorExited(); + + const char *GetMouseOverText( void ); + + C_BaseEntity* GetEntity() { return (C_BaseEntity*)m_pBaseEntity; } + + // Attach to a new entity + void SetEntity( C_BaseEntity* pEntity ); + +public: + enum + { + MAX_ENTITY_MOUSEOVER = 256 + }; + + // Offset from entity that we should draw + int m_OffsetX, m_OffsetY; + + char m_szMouseOverText[ MAX_ENTITY_MOUSEOVER ]; + + bool m_bShowInNormal; + + int m_iOrgWidth; + int m_iOrgHeight; + int m_iOrgOffsetX; + int m_iOrgOffsetY; + float m_flScale; + +private: + // This is the entity to which we're attached + EHANDLE m_pBaseEntity; +}; + +#endif // VGUI_ENTITYPANEL_H
\ No newline at end of file |