#pragma once #include #include #include #include #if defined(OS_WINDOWS) #include #else #include #endif namespace hex::script::loader { class ScriptLoader; struct Script { std::string name; std::fs::path path; bool background; std::function entryPoint; const ScriptLoader *loader; }; class ScriptLoader { public: ScriptLoader(std::string typeName) : m_typeName(std::move(typeName)) {} virtual ~ScriptLoader() = default; virtual bool initialize() = 0; virtual bool loadAll() = 0; virtual void clearScripts() = 0; void addScript(std::string name, std::fs::path path, bool background, std::function entryPoint) { m_scripts.emplace_back(std::move(name), std::move(path), background, std::move(entryPoint), this); } const auto& getScripts() const { return m_scripts; } const std::string& getTypeName() const { return m_typeName; } protected: auto& getScripts() { return m_scripts; } private: std::vector