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.

121 lines
3.4 KiB

  1. //=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. ===========
  2. //
  3. // The copyright to the contents herein is the property of Valve, L.L.C.
  4. // The contents may be used and/or copied only with the written permission of
  5. // Valve, L.L.C., or in accordance with the terms and conditions stipulated in
  6. // the agreement/contract under which the contents have been supplied.
  7. //
  8. // $Header: $
  9. // $NoKeywords: $
  10. //
  11. // Used for material system apps
  12. //=============================================================================
  13. #ifndef MATERIALSYSTEM2APP_H
  14. #define MATERIALSYSTEM2APP_H
  15. #ifdef _WIN32
  16. #pragma once
  17. #endif
  18. #include "appframework/tier2app.h"
  19. #include "tier0/platwindow.h"
  20. #include "rendersystem/irenderdevice.h"
  21. //-----------------------------------------------------------------------------
  22. // Forward declarations
  23. //-----------------------------------------------------------------------------
  24. FORWARD_DECLARE_HANDLE( SwapChainHandle_t );
  25. //-----------------------------------------------------------------------------
  26. // The application object
  27. //-----------------------------------------------------------------------------
  28. class CMaterialSystem2App : public CTier2SteamApp, public IRenderDeviceSetup
  29. {
  30. typedef CTier2SteamApp BaseClass;
  31. public:
  32. enum RenderSystemDLL_t
  33. {
  34. RENDER_SYSTEM_DX9 = 0,
  35. RENDER_SYSTEM_DX11,
  36. RENDER_SYSTEM_GL,
  37. RENDER_SYSTEM_X360,
  38. };
  39. public:
  40. CMaterialSystem2App();
  41. // Methods of IApplication
  42. virtual bool Create();
  43. virtual bool PreInit();
  44. virtual bool PostInit();
  45. virtual void PreShutdown();
  46. virtual void Destroy();
  47. // Returns the window handle
  48. PlatWindow_t GetAppWindow();
  49. // Gets the render system we're running on
  50. RenderSystemDLL_t GetRenderSystem() const;
  51. // Returns the number of threads our thread pool is using
  52. int GetThreadCount() const;
  53. // Creates a 3D-capable window
  54. SwapChainHandle_t Create3DWindow( const char *pTitle, int nWidth, int nHeight, bool bResizing, bool bFullscreen, bool bAcceptsInput );
  55. protected:
  56. void AppPumpMessages();
  57. // Sets up the game path
  58. bool SetupSearchPaths( const char *pStartingDir, bool bOnlyUseStartingDir, bool bIsTool );
  59. private:
  60. // Inherited from IRenderDeviceSetup
  61. virtual bool CreateRenderDevice();
  62. private:
  63. // Returns the app name
  64. virtual const char *GetAppName() = 0;
  65. virtual bool IsConsoleApp() { return false; }
  66. bool AddRenderSystem();
  67. void ApplyModSettings( );
  68. bool CreateMainWindow( bool bResizing );
  69. bool CreateMainConsoleWindow();
  70. SwapChainHandle_t m_hSwapChain;
  71. int m_nThreadCount;
  72. RenderSystemDLL_t m_nRenderSystem;
  73. CreateInterfaceFn m_RenderFactory;
  74. };
  75. //-----------------------------------------------------------------------------
  76. // Inline methods
  77. //-----------------------------------------------------------------------------
  78. //-----------------------------------------------------------------------------
  79. // Gets the render system we're running on
  80. //-----------------------------------------------------------------------------
  81. inline CMaterialSystem2App::RenderSystemDLL_t CMaterialSystem2App::GetRenderSystem() const
  82. {
  83. return m_nRenderSystem;
  84. }
  85. //-----------------------------------------------------------------------------
  86. // Returns the number of threads our thread pool is using
  87. //-----------------------------------------------------------------------------
  88. inline int CMaterialSystem2App::GetThreadCount() const
  89. {
  90. return m_nThreadCount;
  91. }
  92. #endif // MATERIALSYSTEM2APP_H