Files
Seele/src/Engine/Actor/Entity.h
T

25 lines
821 B
C++
Raw Normal View History

#pragma once
#include "MinimalEngine.h"
#include "Scene/Scene.h"
2024-06-09 12:20:04 +02:00
#include <entt/entt.hpp>
namespace Seele {
// An entity describes a part of a scene
// It is just a wrapper the ID of a registry
2024-06-09 12:20:04 +02:00
class Entity {
public:
Entity(PScene scene);
virtual ~Entity();
2024-06-09 12:20:04 +02:00
template <typename Component, typename... Args> Component& attachComponent(Args&&... args) {
2023-01-21 18:43:21 +01:00
return scene->attachComponent<Component>(identifier, std::forward<Args>(args)...);
}
2024-06-09 12:20:04 +02:00
template <typename Component> Component& accessComponent() { return scene->accessComponent<Component>(identifier); }
template <typename Component> const Component& accessComponent() const { return scene->accessComponent<Component>(identifier); }
protected:
PScene scene;
entt::entity identifier;
};
DEFINE_REF(Entity)
} // namespace Seele