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.

57 lines
1.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "materialsystem/imesh.h"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. // -------------------------------------------------------------------------------- //
  12. // An entity used to access overlays (and change their texture)
  13. // -------------------------------------------------------------------------------- //
  14. class C_InfoOverlayAccessor : public C_BaseEntity
  15. {
  16. public:
  17. DECLARE_CLASS( C_InfoOverlayAccessor, C_BaseEntity );
  18. DECLARE_CLIENTCLASS();
  19. C_InfoOverlayAccessor();
  20. virtual void OnDataChanged( DataUpdateType_t updateType );
  21. private:
  22. int m_iOverlayID;
  23. };
  24. // Expose it to the engine.
  25. IMPLEMENT_CLIENTCLASS(C_InfoOverlayAccessor, DT_InfoOverlayAccessor, CInfoOverlayAccessor);
  26. BEGIN_RECV_TABLE_NOBASE(C_InfoOverlayAccessor, DT_InfoOverlayAccessor)
  27. RecvPropInt(RECVINFO(m_iTextureFrameIndex)),
  28. RecvPropInt(RECVINFO(m_iOverlayID)),
  29. END_RECV_TABLE()
  30. // -------------------------------------------------------------------------------- //
  31. // Functions.
  32. // -------------------------------------------------------------------------------- //
  33. C_InfoOverlayAccessor::C_InfoOverlayAccessor()
  34. {
  35. }
  36. void C_InfoOverlayAccessor::OnDataChanged( DataUpdateType_t updateType )
  37. {
  38. if ( updateType == DATA_UPDATE_CREATED )
  39. {
  40. // Update overlay's bind proxy
  41. engine->SetOverlayBindProxy( m_iOverlayID, GetClientRenderable() );
  42. }
  43. }