// Copyright (C) 2019 Jérôme Leclercq // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequisites.hpp #pragma once #ifndef NDK_COMPONENTS_CONSTRAINTCOMPONENT2D_HPP #define NDK_COMPONENTS_CONSTRAINTCOMPONENT2D_HPP #include #include #include #include #include #include namespace Ndk { class ConstraintComponent2D; using ConstraintComponent2DHandle = Nz::ObjectHandle; class NDK_API ConstraintComponent2D : public Component { public: ConstraintComponent2D() = default; ConstraintComponent2D(const ConstraintComponent2D& joint); ConstraintComponent2D(ConstraintComponent2D&& joint) = default; template T* CreateConstraint(const Ndk::EntityHandle& first, const Ndk::EntityHandle& second, Args&&... args); bool RemoveConstraint(Nz::Constraint2D* constraint); static ComponentIndex componentIndex; private: struct ConstraintData { std::unique_ptr constraint; NazaraSlot(Ndk::Entity, OnEntityDestruction, onBodyADestruction); NazaraSlot(Ndk::Entity, OnEntityDestruction, onBodyBDestruction); }; std::vector m_constraints; }; } #include #endif// NDK_COMPONENTS_CONSTRAINTCOMPONENT2D_HPP