Files
Seele/src/Engine/Actor/Entity.h
T
2023-01-21 18:43:21 +01:00

35 lines
860 B
C++

#pragma once
#include <entt/entt.hpp>
#include "MinimalEngine.h"
#include "Scene/Scene.h"
namespace Seele
{
// An entity describes a part of a scene
// It is just a wrapper the ID of a registry
class Entity
{
public:
Entity(PScene scene);
virtual ~Entity();
template<typename Component, typename... Args>
Component& attachComponent(Args&&... args)
{
return scene->attachComponent<Component>(identifier, std::forward<Args>(args)...);
}
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