BsScriptManager.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #pragma once
  2. #include "BsPrerequisites.h"
  3. #include "BsModule.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Abstraction of a specific scripting system.
  8. */
  9. class BS_EXPORT ScriptSystem
  10. {
  11. public:
  12. virtual ~ScriptSystem() { }
  13. /**
  14. * @brief Called when the script system is being activated.
  15. */
  16. virtual void initialize() = 0;
  17. /**
  18. * @brief Called when the script system is being destryoed.
  19. */
  20. virtual void destroy() = 0;
  21. };
  22. /**
  23. * @brief Handles initialization of a scripting system.
  24. */
  25. class BS_EXPORT ScriptManager : public Module<ScriptManager>
  26. {
  27. public:
  28. ScriptManager() { }
  29. ~ScriptManager() { }
  30. /**
  31. * @brief Initializes the script managed with the specified script system,
  32. * making it active. Should be called right after construction.
  33. */
  34. void initialize(const std::shared_ptr<ScriptSystem>& scriptSystem);
  35. /**
  36. * @brief Destroys the currently active script system. Must be called just
  37. * before shutdown.
  38. */
  39. void destroy();
  40. private:
  41. /**
  42. * @copydoc ScriptManager::onShutDown
  43. */
  44. void onShutDown();
  45. std::shared_ptr<ScriptSystem> mScriptSystem;
  46. };
  47. }