#pragma once #include #include #include namespace lt { class Entity { public: Entity(entt::entity handle = entt::null, Scene *scene = nullptr); template auto add_component(Args &&...args) -> t & { return m_scene->m_registry.emplace(m_handle, std::forward(args)...); } template auto get_component() -> t & { return m_scene->m_registry.get(m_handle); } template auto has_component() -> bool { return m_scene->m_registry.any_of(m_handle); } template void remove_component() { m_scene->m_registry.remove(m_handle); } auto get_uuid() -> uint64_t { return get_component().uuid; } [[nodiscard]] auto is_valid() const -> bool { return m_handle != entt::null && m_scene != nullptr; } operator uint32_t() { return (uint32_t)m_handle; } private: entt::entity m_handle; Scene *m_scene; }; } // namespace lt