// Copyright (C) 2017 Jérôme Leclercq // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp #pragma once #ifndef NDK_LUABINDING_HPP #define NDK_LUABINDING_HPP #include #include #include #include namespace Ndk { class NDK_API LuaBinding { friend class LuaBinding_SDK; public: LuaBinding(); ~LuaBinding() = default; template void BindComponent(const Nz::String& name); void RegisterClasses(Nz::LuaInstance& instance); std::unique_ptr core; std::unique_ptr math; std::unique_ptr network; std::unique_ptr sdk; std::unique_ptr utility; #ifndef NDK_SERVER std::unique_ptr audio; std::unique_ptr graphics; std::unique_ptr renderer; #endif private: template static int AddComponentOfType(Nz::LuaInstance& lua, EntityHandle& handle); template static int PushComponentOfType(Nz::LuaInstance& lua, BaseComponent& component); using AddComponentFunc = int(*)(Nz::LuaInstance&, EntityHandle&); using GetComponentFunc = int(*)(Nz::LuaInstance&, BaseComponent&); struct ComponentBinding { AddComponentFunc adder; ComponentIndex index; GetComponentFunc getter; Nz::String name; }; ComponentBinding* QueryComponentIndex(Nz::LuaInstance& lua, int argIndex = 2); std::vector m_componentBinding; std::unordered_map m_componentBindingByName; }; } #include #endif // NDK_LUABINDING_HPP