Counter Strike : Global Offensive Source Code
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.

148 lines
4.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Revision: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef ICLIENTMODE_H
  9. #define ICLIENTMODE_H
  10. #include <vgui/vgui.h>
  11. class CViewSetup;
  12. class C_BaseEntity;
  13. class C_BasePlayer;
  14. class CUserCmd;
  15. namespace vgui
  16. {
  17. class Panel;
  18. class AnimationController;
  19. }
  20. // Message mode types
  21. enum
  22. {
  23. MM_NONE = 0,
  24. MM_SAY,
  25. MM_SAY_TEAM,
  26. };
  27. abstract_class IClientMode
  28. {
  29. // Misc.
  30. public:
  31. virtual ~IClientMode() {}
  32. // Called before the HUD is initialized.
  33. virtual void InitViewport()=0;
  34. // One time init when .dll is first loaded.
  35. virtual void Init()=0;
  36. // Called when vgui is shutting down.
  37. virtual void VGui_Shutdown() = 0;
  38. // One time call when dll is shutting down
  39. virtual void Shutdown()=0;
  40. // Called when switching from one IClientMode to another.
  41. // This can re-layout the view and such.
  42. // Note that Enable and Disable are called when the DLL initializes and shuts down.
  43. virtual void Enable()=0;
  44. virtual void EnableWithRootPanel( vgui::VPANEL pRoot )=0;
  45. // Called when it's about to go into another client mode.
  46. virtual void Disable()=0;
  47. // Called when initializing or when the view changes.
  48. // This should move the viewport into the correct position.
  49. virtual void Layout( bool bForce = false )=0;
  50. // Gets at the viewport, if there is one...
  51. virtual vgui::Panel *GetViewport() = 0;
  52. // Gets a panel hierarchically below the viewport by name like so "ASWHudInventoryMode/SuitAbilityPanel/ItemPanel1"...
  53. virtual vgui::Panel *GetPanelFromViewport( const char *pchNamePath ) = 0;
  54. // Gets at the viewports vgui panel animation controller, if there is one...
  55. virtual vgui::AnimationController *GetViewportAnimationController() = 0;
  56. // called every time shared client dll/engine data gets changed,
  57. // and gives the cdll a chance to modify the data.
  58. virtual void ProcessInput( bool bActive ) = 0;
  59. // The mode can choose to draw/not draw entities.
  60. virtual bool ShouldDrawDetailObjects( ) = 0;
  61. virtual bool ShouldDrawEntity(C_BaseEntity *pEnt) = 0;
  62. virtual bool ShouldDrawLocalPlayer( C_BasePlayer *pPlayer ) = 0;
  63. virtual bool ShouldDrawParticles( ) = 0;
  64. // The mode can choose to not draw fog
  65. virtual bool ShouldDrawFog( void ) = 0;
  66. virtual void OverrideView( CViewSetup *pSetup ) = 0;
  67. virtual void OverrideAudioState( AudioState_t *pAudioState ) = 0;
  68. virtual int KeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding ) = 0;
  69. virtual void StartMessageMode( int iMessageModeType ) = 0;
  70. virtual vgui::Panel *GetMessagePanel() = 0;
  71. virtual void OverrideMouseInput( float *x, float *y ) = 0;
  72. virtual bool CreateMove( float flInputSampleTime, CUserCmd *cmd ) = 0;
  73. virtual void LevelInit( const char *newmap ) = 0;
  74. virtual void LevelShutdown( void ) = 0;
  75. // Certain modes hide the view model
  76. virtual bool ShouldDrawViewModel( void ) = 0;
  77. virtual bool ShouldDrawCrosshair( void ) = 0;
  78. // Let mode override viewport for engine
  79. virtual void AdjustEngineViewport( int& x, int& y, int& width, int& height ) = 0;
  80. // Called before rendering a view.
  81. virtual void PreRender( CViewSetup *pSetup ) = 0;
  82. // Called after everything is rendered.
  83. virtual void PostRender( void ) = 0;
  84. virtual void PostRenderVGui() = 0;
  85. virtual void ActivateInGameVGuiContext( vgui::Panel *pPanel ) = 0;
  86. virtual void DeactivateInGameVGuiContext() = 0;
  87. virtual float GetViewModelFOV( void ) = 0;
  88. virtual bool CanRecordDemo( char *errorMsg, int length ) const = 0;
  89. virtual wchar_t* GetServerName( void ) = 0;
  90. virtual void SetServerName( wchar_t *name ) = 0;
  91. virtual wchar_t* GetMapName( void ) = 0;
  92. virtual void SetMapName( wchar_t *name ) = 0;
  93. virtual void OnColorCorrectionWeightsReset( void ) = 0;
  94. virtual float GetColorCorrectionScale( void ) const = 0;
  95. virtual int HudElementKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding ) = 0;
  96. virtual void DoPostScreenSpaceEffects( const CViewSetup *pSetup ) = 0;
  97. virtual void UpdateCameraManUIState( int iType, int nOptionalParam, uint64 xuid ) = 0;
  98. virtual void ScoreboardOff( void ) = 0;
  99. virtual void GraphPageChanged( void ) = 0;
  100. // Updates.
  101. public:
  102. // Called every frame.
  103. virtual void Update()=0;
  104. virtual void SetBlurFade( float scale ) = 0;
  105. virtual float GetBlurFade( void ) = 0;
  106. };
  107. extern IClientMode *GetClientMode();
  108. extern IClientMode *GetFullscreenClientMode();
  109. #endif