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.

145 lines
4.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Defines the interface that the GameUI dll exports
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef VGUI_BASEUI_INTERFACE_H
  8. #define VGUI_BASEUI_INTERFACE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "ienginevgui.h"
  13. #include "inputsystem/ButtonCode.h"
  14. #if !defined( _X360 )
  15. #include "xbox/xboxstubs.h"
  16. #endif
  17. //-----------------------------------------------------------------------------
  18. // Foward declarations
  19. //-----------------------------------------------------------------------------
  20. class IMatSystemSurface;
  21. class Color;
  22. struct InputEvent_t;
  23. //-----------------------------------------------------------------------------
  24. // Global singleton interfaces related to VGUI
  25. //-----------------------------------------------------------------------------
  26. extern IMatSystemSurface *g_pMatSystemSurface;
  27. // enumeration of level loading progress bar spots
  28. enum LevelLoadingProgress_e
  29. {
  30. PROGRESS_NONE,
  31. PROGRESS_CHANGELEVEL,
  32. PROGRESS_SPAWNSERVER,
  33. PROGRESS_LOADWORLDMODEL,
  34. PROGRESS_CRCMAP,
  35. PROGRESS_CRCCLIENTDLL,
  36. PROGRESS_CREATENETWORKSTRINGTABLES,
  37. PROGRESS_PRECACHEWORLD,
  38. PROGRESS_CLEARWORLD,
  39. PROGRESS_LEVELINIT,
  40. PROGRESS_PRECACHE,
  41. PROGRESS_ACTIVATESERVER,
  42. PROGRESS_BEGINCONNECT,
  43. PROGRESS_SIGNONCHALLENGE,
  44. PROGRESS_SIGNONCONNECT,
  45. PROGRESS_SIGNONCONNECTED,
  46. PROGRESS_PROCESSSERVERINFO,
  47. PROGRESS_PROCESSSTRINGTABLE,
  48. PROGRESS_SIGNONNEW,
  49. PROGRESS_SENDCLIENTINFO,
  50. PROGRESS_SENDSIGNONDATA,
  51. PROGRESS_SIGNONSPAWN,
  52. PROGRESS_FULLYCONNECTED,
  53. PROGRESS_READYTOPLAY,
  54. PROGRESS_HIGHESTITEM, // must be last item in list
  55. };
  56. //-----------------------------------------------------------------------------
  57. // Purpose: Centerpoint for handling all user interface in the engine
  58. //-----------------------------------------------------------------------------
  59. abstract_class IEngineVGuiInternal : public IEngineVGui
  60. {
  61. public:
  62. virtual void Init() = 0;
  63. virtual void Connect() = 0;
  64. virtual void Shutdown() = 0;
  65. virtual bool SetVGUIDirectories() = 0;
  66. virtual bool IsInitialized() const = 0;
  67. virtual CreateInterfaceFn GetGameUIFactory() = 0;
  68. virtual bool Key_Event( const InputEvent_t &event ) = 0;
  69. virtual void BackwardCompatibility_Paint() = 0;
  70. virtual void UpdateButtonState( const InputEvent_t &event ) = 0;
  71. virtual void PostInit() = 0;
  72. virtual void Paint( PaintMode_t mode ) = 0;
  73. // handlers for game UI (main menu)
  74. virtual void ActivateGameUI() = 0;
  75. virtual bool HideGameUI() = 0;
  76. virtual bool IsGameUIVisible() = 0;
  77. // console
  78. virtual void ShowConsole() = 0;
  79. virtual void HideConsole() = 0;
  80. virtual bool IsConsoleVisible() = 0;
  81. virtual void ClearConsole() = 0;
  82. virtual void HideDebugSystem() = 0;
  83. // level loading
  84. virtual void OnLevelLoadingStarted() = 0;
  85. virtual void OnLevelLoadingFinished() = 0;
  86. virtual void NotifyOfServerConnect(const char *game, int IP, int connectionPort, int queryPort) = 0;
  87. virtual void NotifyOfServerDisconnect() = 0;
  88. virtual void EnabledProgressBarForNextLoad() = 0;
  89. virtual void UpdateProgressBar(LevelLoadingProgress_e progress) = 0;
  90. virtual void UpdateCustomProgressBar( float progress, const wchar_t *desc ) = 0;
  91. virtual void StartCustomProgress() = 0;
  92. virtual void FinishCustomProgress() = 0;
  93. virtual void ShowErrorMessage() = 0;
  94. // Should pause?
  95. virtual bool ShouldPause() = 0;
  96. virtual void SetGameDLLPanelsVisible( bool show ) = 0;
  97. virtual void ShowNewGameDialog( int chapter ) = 0;
  98. virtual void Simulate() = 0;
  99. virtual void SetNotAllowedToHideGameUI( bool bNotAllowedToHide ) = 0;
  100. virtual void SetNotAllowedToShowGameUI( bool bNotAllowedToShow ) = 0;
  101. // Xbox 360
  102. virtual void SessionNotification( const int notification, const int param = 0 ) = 0;
  103. virtual void SystemNotification( const int notification ) = 0;
  104. virtual void ShowMessageDialog( const uint nType, vgui::Panel *pOwner = NULL ) = 0;
  105. virtual void UpdatePlayerInfo( uint64 nPlayerId, const char *pName, int nTeam, byte cVoiceState, int nPlayersNeeded, bool bHost ) = 0;
  106. virtual void SessionSearchResult( int searchIdx, void *pHostData, XSESSION_SEARCHRESULT *pResult, int ping ) = 0;
  107. virtual void OnCreditsFinished( void ) = 0;
  108. // Storage device validation:
  109. // returns true right away if storage device has been previously selected.
  110. // otherwise returns false and will set the variable pointed by pStorageDeviceValidated to 1
  111. // once the storage device is selected by user.
  112. virtual bool ValidateStorageDevice( int *pStorageDeviceValidated ) = 0;
  113. virtual void ConfirmQuit( void ) = 0;
  114. };
  115. // Purpose: singleton accessor
  116. extern IEngineVGuiInternal *EngineVGui();
  117. // Purpose: Play a sound
  118. void VGui_PlaySound(const char *pFileName);
  119. #endif // VGUI_BASEUI_INTERFACE_H