Skip to content

File ColliderPlugin.hpp

File List > Engine > include > Plugins > ColliderPlugin.hpp

Go to the documentation of this file

#ifndef ENGINE_PLUGINS_COLLISIONPLUGIN_HPP_
#define ENGINE_PLUGINS_COLLISIONPLUGIN_HPP_

#include "Components/ColliderComponent.hpp"
#include "Components/CollisionEvents.hpp"
#include "ECS/Entity.hpp"
#include "ECS/Registry.hpp"
#include "Plugins/IPlugin.hpp"
#include "Systems/CollisionSystem.hpp"
#include <raylib.h>

namespace Engine {
class ColliderPlugin : public IPlugin {
  public:
    void Init(Registry& registry) override;

    static void AttachToEntity(Registry& registry, Entity entity,
                               const std::optional<ShapeComponent>& shape = std::nullopt,
                               bool enabled = true, bool isTrigger = false);

    static void AttachToEntity(Registry& registry, Entity entity,
                               const ColliderComponent& collider);

    static bool EntityHasShape(Registry& registry, Entity entity);

    static std::optional<ShapeComponent> ResolveShape(Registry& registry, Entity entity,
                                                      const ColliderComponent& collider);
};
} // namespace Engine

#endif // ENGINE_PLUGINS_COLLISIONPLUGIN_HPP_