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.

137 lines
4.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Defines the interface that the GameUI dll exports
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef GAMEUI_INTERFACE_H
  8. #define GAMEUI_INTERFACE_H
  9. #pragma once
  10. #include "GameUI/IGameUI.h"
  11. #include "vgui_controls/Panel.h"
  12. #include "vgui_controls/PHandle.h"
  13. #include "convar.h"
  14. #if defined ( CSTRIKE15 )
  15. #error "DEPRICIATED: Use the gameui_interface in the cstrike15 folder"
  16. #endif
  17. class IGameClientExports;
  18. class CCommand;
  19. int GetGameUIActiveSplitScreenPlayerSlot();
  20. void SetGameUIActiveSplitScreenPlayerSlot( int nSlot );
  21. //-----------------------------------------------------------------------------
  22. // Purpose: Implementation of GameUI's exposed interface
  23. //-----------------------------------------------------------------------------
  24. class CGameUI : public IGameUI
  25. {
  26. public:
  27. CGameUI();
  28. ~CGameUI();
  29. virtual void Initialize( CreateInterfaceFn appFactory );
  30. virtual void Connect( CreateInterfaceFn gameFactory );
  31. virtual void Start();
  32. virtual void Shutdown();
  33. virtual void RunFrame();
  34. virtual void PostInit();
  35. // plays the startup mp3 when GameUI starts
  36. void PlayGameStartupSound();
  37. // Engine wrappers for activating / hiding the gameUI
  38. void ActivateGameUI();
  39. void HideGameUI();
  40. // Toggle allowing the engine to hide the game UI with the escape key
  41. void PreventEngineHideGameUI();
  42. void AllowEngineHideGameUI();
  43. virtual void SetLoadingBackgroundDialog( vgui::VPANEL panel );
  44. // notifications
  45. virtual void OnGameUIActivated();
  46. virtual void OnGameUIHidden();
  47. virtual void OLD_OnConnectToServer( const char *game, int IP, int port ); // OLD: use OnConnectToServer2
  48. virtual void OnConnectToServer2( const char *game, int IP, int connectionPort, int queryPort );
  49. virtual void OnDisconnectFromServer( uint8 eSteamLoginFailure );
  50. virtual void OnLevelLoadingStarted( const char *levelName, bool bShowProgressDialog );
  51. virtual void OnLevelLoadingFinished( bool bError, const char *failureReason, const char *extendedReason );
  52. virtual void OnDisconnectFromServer_OLD( uint8 eSteamLoginFailure, const char *username ) { OnDisconnectFromServer( eSteamLoginFailure ); }
  53. // progress
  54. virtual bool UpdateProgressBar(float progress, const char *statusText);
  55. // Shows progress desc, returns previous setting... (used with custom progress bars )
  56. virtual bool SetShowProgressText( bool show );
  57. // Allows the level loading progress to show map-specific info
  58. virtual void SetProgressLevelName( const char *levelName );
  59. virtual void NeedConnectionProblemWaitScreen();
  60. virtual void ShowPasswordUI( char const *pchCurrentPW );
  61. virtual void SetProgressOnStart();
  62. #if defined( _GAMECONSOLE ) && defined( _DEMO )
  63. virtual void OnDemoTimeout();
  64. #endif
  65. // state
  66. bool IsInLevel();
  67. bool IsInBackgroundLevel();
  68. bool IsInMultiplayer();
  69. bool HasSavedThisMenuSession();
  70. void SetSavedThisMenuSession( bool bState );
  71. void ShowLoadingBackgroundDialog();
  72. void HideLoadingBackgroundDialog();
  73. bool HasLoadingBackgroundDialog();
  74. private:
  75. void SendConnectedToGameMessage();
  76. virtual void StartProgressBar();
  77. virtual bool ContinueProgressBar(float progressFraction);
  78. virtual void StopProgressBar(bool bError, const char *failureReason, const char *extendedReason = NULL);
  79. virtual bool SetProgressBarStatusText(const char *statusText);
  80. //!! these functions currently not implemented
  81. virtual void SetSecondaryProgressBar(float progress /* range [0..1] */);
  82. virtual void SetSecondaryProgressBarText(const char *statusText);
  83. bool FindPlatformDirectory(char *platformDir, int bufferSize);
  84. void GetUpdateVersion( char *pszProd, char *pszVer);
  85. void ValidateCDKey();
  86. CreateInterfaceFn m_GameFactory;
  87. bool m_bTryingToLoadFriends : 1;
  88. bool m_bActivatedUI : 1;
  89. bool m_bHasSavedThisMenuSession : 1;
  90. bool m_bOpenProgressOnStart : 1;
  91. int m_iGameIP;
  92. int m_iGameConnectionPort;
  93. int m_iGameQueryPort;
  94. int m_iFriendsLoadPauseFrames;
  95. int m_iPlayGameStartupSound;
  96. char m_szPreviousStatusText[128];
  97. char m_szPlatformDir[MAX_PATH];
  98. vgui::DHANDLE<class CCDKeyEntryDialog> m_hCDKeyEntryDialog;
  99. };
  100. // Purpose: singleton accessor
  101. extern CGameUI &GameUI();
  102. // expose client interface
  103. extern IGameClientExports *GameClientExports();
  104. #endif // GAMEUI_INTERFACE_H