BsScriptManager.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 "BsModule.h"
  6. namespace BansheeEngine
  7. {
  8. /** @addtogroup Script-Internal
  9. * @{
  10. */
  11. /** Abstraction that handles a specific set of script libraries. */
  12. class BS_EXPORT ScriptLibrary
  13. {
  14. public:
  15. virtual ~ScriptLibrary() { }
  16. /** Called when the script system is being activated. */
  17. virtual void initialize() = 0;
  18. /** Called when the script libraries should be reloaded (for example when they are recompiled). */
  19. virtual void reload() = 0;
  20. /** Called when the script system is being destroyed. */
  21. virtual void destroy() = 0;
  22. };
  23. /** Handles initialization of a scripting system. */
  24. class BS_EXPORT ScriptManager : public Module<ScriptManager>
  25. {
  26. public:
  27. ScriptManager() { }
  28. ~ScriptManager() { }
  29. /** Initializes the currently active script library loading the scripts contained within. */
  30. void initialize();
  31. /**
  32. * Reloads any scripts in the currently active library. Should be called after some change to the scripts was made
  33. * (for example project was changed, or scripts were recompiled).
  34. */
  35. void reload();
  36. /** Sets the active script library that controls what kind and which scripts are loaded. */
  37. void _setScriptLibrary(const SPtr<ScriptLibrary>& library);
  38. private:
  39. /** @copydoc ScriptManager::onShutDown */
  40. void onShutDown() override;
  41. SPtr<ScriptLibrary> mScriptLibrary;
  42. };
  43. /** @} */
  44. }