28 lines
424 B
C++
28 lines
424 B
C++
#pragma once
|
|
#include <entt/entt.hpp>
|
|
class Scene;
|
|
|
|
class Entity {
|
|
public:
|
|
Entity() = default;
|
|
Entity(entt::entity e, Scene* scene);
|
|
Entity(const Entity& other) = default;
|
|
|
|
|
|
template<class T >
|
|
T& AddComponent() {
|
|
return m_scene->m_registry.emplace<T>(m_entity);
|
|
}
|
|
|
|
template<class T>
|
|
T* GetComponent() {
|
|
return m_scene->m_registry.try_get<T>(m_entity);
|
|
}
|
|
|
|
private:
|
|
entt::entity m_entity;
|
|
Scene* m_scene;
|
|
|
|
};
|
|
|