BsApplication.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsPrerequisites.h"
  5. #include "BsCoreApplication.h"
  6. #include "BsEvent.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup Application-Engine
  10. * @{
  11. */
  12. /** Types of available render systems. */
  13. enum class RenderAPIPlugin
  14. {
  15. DX11,
  16. DX9,
  17. OpenGL
  18. };
  19. /** Types of available renderers. */
  20. enum class RendererPlugin
  21. {
  22. Default
  23. };
  24. /** Types of available audio systems. */
  25. enum class AudioPlugin
  26. {
  27. OpenAudio, /**< Open-source audio implementation using OpenAL. */
  28. FMOD /**< Audio system implementation using FMOD. */
  29. };
  30. /** Primary entry point for Banshee engine. Handles startup and shutdown. */
  31. class BS_EXPORT Application : public CoreApplication
  32. {
  33. public:
  34. Application(RENDER_WINDOW_DESC primaryWindowDesc, RenderAPIPlugin renderAPI, RendererPlugin renderer,
  35. AudioPlugin audio, const Vector<String>& importers);
  36. virtual ~Application();
  37. /**
  38. * Starts the Banshee engine.
  39. *
  40. * @param[in] primaryWindowDesc Description of the primary render window that will be created on startup.
  41. * @param[in] renderAPI Render API plugin to use.
  42. * @param[in] renderer Renderer plugin to use.
  43. * @param[in] audio Audio plugin to use.
  44. * @param[in] importers A list of importer plugins to load on startup.
  45. */
  46. static void startUp(RENDER_WINDOW_DESC& primaryWindowDesc, RenderAPIPlugin renderAPI,
  47. RendererPlugin renderer = RendererPlugin::Default, AudioPlugin audio = AudioPlugin::OpenAudio,
  48. const Vector<String>& importers = Vector<String>());
  49. /** Returns the absolute path to the builtin managed engine assembly file. */
  50. Path getEngineAssemblyPath() const;
  51. /** Returns the absolute path to the game managed assembly file. */
  52. Path getGameAssemblyPath() const;
  53. /** Returns the absolute path to the folder where script assemblies are located in. */
  54. virtual Path getScriptAssemblyFolder() const;
  55. protected:
  56. /** @copydoc Module::onStartUp */
  57. virtual void onStartUp() override;
  58. /** @copydoc Module::onShutDown */
  59. virtual void onShutDown() override;
  60. /** @copydoc CoreApplication::preUpdate */
  61. virtual void preUpdate() override;
  62. /** @copydoc CoreApplication::postUpdate */
  63. virtual void postUpdate() override;
  64. /** @copydoc CoreApplication::startUpRenderer */
  65. virtual void startUpRenderer() override;
  66. /** @copydoc CoreApplication::getShaderIncludeHandler */
  67. SPtr<IShaderIncludeHandler> getShaderIncludeHandler() const override;
  68. /** Loads the script system and all script libraries. */
  69. virtual void loadScriptSystem();
  70. /** Unloads script libraries and shuts down the script system. */
  71. virtual void unloadScriptSystem();
  72. /** Returns the absolute path to the folder where built-in assemblies are located in. */
  73. virtual Path getBuiltinAssemblyFolder() const;
  74. /** Translates render system type into library name. */
  75. static String getLibNameForRenderAPI(RenderAPIPlugin plugin);
  76. /** Translates renderer type into library name. */
  77. static String getLibNameForRenderer(RendererPlugin plugin);
  78. /** Translates audio system type into library name. */
  79. static String getLibNameForAudio(AudioPlugin plugin);
  80. DynLib* mMonoPlugin;
  81. DynLib* mSBansheeEnginePlugin;
  82. };
  83. /** Easy way to access Application. */
  84. BS_EXPORT Application& gApplication();
  85. /** @} */
  86. }