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.

88 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: This is an entity that represents a vgui screen
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef VGUISCREEN_H
  8. #define VGUISCREEN_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //-----------------------------------------------------------------------------
  13. // This is an entity that represents a vgui screen
  14. //-----------------------------------------------------------------------------
  15. class CVGuiScreen : public CBaseEntity
  16. {
  17. public:
  18. DECLARE_CLASS( CVGuiScreen, CBaseEntity );
  19. DECLARE_SERVERCLASS();
  20. DECLARE_DATADESC();
  21. CVGuiScreen();
  22. virtual void Precache();
  23. virtual bool KeyValue( const char *szKeyName, const char *szValue );
  24. virtual void Spawn();
  25. virtual void Activate();
  26. virtual void OnRestore();
  27. const char *GetPanelName() const;
  28. // Sets the screen size + resolution
  29. void SetActualSize( float flWidth, float flHeight );
  30. // Activates/deactivates the screen
  31. bool IsActive() const;
  32. void SetActive( bool bActive );
  33. // Is this screen only visible to teammates?
  34. bool IsVisibleOnlyToTeammates() const;
  35. void MakeVisibleOnlyToTeammates( bool bActive );
  36. bool IsVisibleToTeam( int nTeam );
  37. // Sets the overlay material
  38. void SetOverlayMaterial( const char *pMaterial );
  39. void SetAttachedToViewModel( bool bAttached );
  40. bool IsAttachedToViewModel() const;
  41. void SetTransparency( bool bTransparent );
  42. virtual int UpdateTransmitState( void );
  43. virtual int ShouldTransmit( const CCheckTransmitInfo *pInfo );
  44. void SetPlayerOwner( CBasePlayer *pPlayer, bool bOwnerOnlyInput = false );
  45. private:
  46. void SetAttachmentIndex( int nIndex );
  47. void SetPanelName( const char *pPanelName );
  48. void InputSetActive( inputdata_t &inputdata );
  49. void InputSetInactive( inputdata_t &inputdata );
  50. string_t m_strOverlayMaterial;
  51. CNetworkVar( float, m_flWidth );
  52. CNetworkVar( float, m_flHeight );
  53. CNetworkVar( int, m_nPanelName ); // The name of the panel
  54. CNetworkVar( int, m_nAttachmentIndex );
  55. CNetworkVar( int, m_nOverlayMaterial );
  56. CNetworkVar( int, m_fScreenFlags );
  57. CNetworkVar( EHANDLE, m_hPlayerOwner );
  58. friend CVGuiScreen *CreateVGuiScreen( const char *pScreenClassname, const char *pScreenType, CBaseEntity *pAttachedTo, CBaseEntity *pOwner, int nAttachmentIndex );
  59. };
  60. void PrecacheVGuiScreen( const char *pScreenType );
  61. void PrecacheVGuiScreenOverlayMaterial( const char *pMaterialName );
  62. CVGuiScreen *CreateVGuiScreen( const char *pScreenClassname, const char *pScreenType, CBaseEntity *pAttachedTo, CBaseEntity *pOwner, int nAttachmentIndex );
  63. void DestroyVGuiScreen( CVGuiScreen *pVGuiScreen );
  64. #endif // VGUISCREEN_H