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/c_info_overlay_accessor.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/c_info_overlay_accessor.cpp')
| -rw-r--r-- | game/client/c_info_overlay_accessor.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/game/client/c_info_overlay_accessor.cpp b/game/client/c_info_overlay_accessor.cpp new file mode 100644 index 0000000..ca75541 --- /dev/null +++ b/game/client/c_info_overlay_accessor.cpp @@ -0,0 +1,57 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#include "cbase.h" +#include "materialsystem/imesh.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +// -------------------------------------------------------------------------------- // +// An entity used to access overlays (and change their texture) +// -------------------------------------------------------------------------------- // +class C_InfoOverlayAccessor : public C_BaseEntity +{ +public: + + DECLARE_CLASS( C_InfoOverlayAccessor, C_BaseEntity ); + DECLARE_CLIENTCLASS(); + + C_InfoOverlayAccessor(); + + virtual void OnDataChanged( DataUpdateType_t updateType ); + +private: + + int m_iOverlayID; +}; + +// Expose it to the engine. +IMPLEMENT_CLIENTCLASS(C_InfoOverlayAccessor, DT_InfoOverlayAccessor, CInfoOverlayAccessor); + +BEGIN_RECV_TABLE_NOBASE(C_InfoOverlayAccessor, DT_InfoOverlayAccessor) + RecvPropInt(RECVINFO(m_iTextureFrameIndex)), + RecvPropInt(RECVINFO(m_iOverlayID)), +END_RECV_TABLE() + + +// -------------------------------------------------------------------------------- // +// Functions. +// -------------------------------------------------------------------------------- // + +C_InfoOverlayAccessor::C_InfoOverlayAccessor() +{ +} + +void C_InfoOverlayAccessor::OnDataChanged( DataUpdateType_t updateType ) +{ + if ( updateType == DATA_UPDATE_CREATED ) + { + // Update overlay's bind proxy + engine->SetOverlayBindProxy( m_iOverlayID, GetClientRenderable() ); + } +} |