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.

139 lines
4.4 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. class IGameClientExports;
  15. class CCommand;
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Implementation of GameUI's exposed interface
  18. //-----------------------------------------------------------------------------
  19. class CGameUI : public IGameUI
  20. {
  21. public:
  22. CGameUI();
  23. ~CGameUI();
  24. virtual void Initialize( CreateInterfaceFn appFactory );
  25. virtual void Connect( CreateInterfaceFn gameFactory );
  26. virtual void Start();
  27. virtual void Shutdown();
  28. virtual void RunFrame();
  29. virtual void PostInit();
  30. // plays the startup mp3 when GameUI starts
  31. void PlayGameStartupSound();
  32. // Engine wrappers for activating / hiding the gameUI
  33. void ActivateGameUI();
  34. void HideGameUI();
  35. // Toggle allowing the engine to hide the game UI with the escape key
  36. void PreventEngineHideGameUI();
  37. void AllowEngineHideGameUI();
  38. virtual void SetLoadingBackgroundDialog( vgui::VPANEL panel );
  39. // notifications
  40. virtual void OnGameUIActivated();
  41. virtual void OnGameUIHidden();
  42. virtual void OLD_OnConnectToServer( const char *game, int IP, int port ); // OLD: use OnConnectToServer2
  43. virtual void OnConnectToServer2( const char *game, int IP, int connectionPort, int queryPort );
  44. virtual void OnDisconnectFromServer( uint8 eSteamLoginFailure );
  45. virtual void OnLevelLoadingStarted( const char *levelName, bool bShowProgressDialog );
  46. virtual void OnLevelLoadingFinished( bool bError, const char *failureReason, const char *extendedReason );
  47. virtual void OnDisconnectFromServer_OLD( uint8 eSteamLoginFailure, const char *username ) { OnDisconnectFromServer( eSteamLoginFailure ); }
  48. // progress
  49. virtual bool UpdateProgressBar(float progress, const char *statusText);
  50. // Shows progress desc, returns previous setting... (used with custom progress bars )
  51. virtual bool SetShowProgressText( bool show );
  52. // Allows the level loading progress to show map-specific info
  53. virtual void SetProgressLevelName( const char *levelName );
  54. virtual void NeedConnectionProblemWaitScreen();
  55. virtual void ShowPasswordUI( char const *pchCurrentPW );
  56. virtual void SetProgressOnStart();
  57. #if defined( _GAMECONSOLE ) && defined( _DEMO )
  58. virtual void OnDemoTimeout();
  59. #endif
  60. // state
  61. bool IsInLevel();
  62. bool IsInBackgroundLevel();
  63. bool IsInMultiplayer();
  64. bool IsConsoleUI();
  65. bool HasSavedThisMenuSession();
  66. void SetSavedThisMenuSession( bool bState );
  67. void ShowLoadingBackgroundDialog();
  68. void HideLoadingBackgroundDialog();
  69. bool HasLoadingBackgroundDialog();
  70. virtual bool LoadingProgressWantsIsolatedRender( bool bContextValid );
  71. virtual bool IsPlayingFullScreenVideo();
  72. virtual bool IsTransitionEffectEnabled();
  73. private:
  74. void SendConnectedToGameMessage();
  75. virtual void StartProgressBar();
  76. virtual bool ContinueProgressBar(float progressFraction);
  77. virtual void StopProgressBar(bool bError, const char *failureReason, const char *extendedReason = NULL);
  78. virtual bool SetProgressBarStatusText(const char *statusText);
  79. //!! these functions currently not implemented
  80. virtual void SetSecondaryProgressBar(float progress /* range [0..1] */);
  81. virtual void SetSecondaryProgressBarText(const char *statusText);
  82. bool FindPlatformDirectory(char *platformDir, int bufferSize);
  83. void GetUpdateVersion( char *pszProd, char *pszVer);
  84. void ValidateCDKey();
  85. CreateInterfaceFn m_GameFactory;
  86. bool m_bTryingToLoadFriends : 1;
  87. bool m_bActivatedUI : 1;
  88. bool m_bIsConsoleUI : 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