26 [[nodiscard]]
inline entt::basic_registry<EntityId>& getRegistry() noexcept {
return mEnTTRegistry; }
28 [[nodiscard]]
inline entt::basic_registry<EntityId>
const& getRegistry() const noexcept {
return mEnTTRegistry; }
31 [[nodiscard]]
inline optional_ref<T const> tryGetComponent()
const {
32 return getRegistry().try_get<T>(mEntity);
36 [[nodiscard]]
inline optional_ref<T> tryGetComponent() {
37 return const_cast<T*
>(std::as_const(getRegistry()).try_get<T>(mEntity));
41 [[nodiscard]]
inline bool hasComponent()
const {
42 return getRegistry().all_of<T>(mEntity);
46 inline bool removeComponent() {
47 return getRegistry().remove<T>(mEntity);
50 template <
class T,
typename... Args>
51 [[nodiscard]]
inline T& getOrAddComponent(Args&&... args) {
52 return getRegistry().get_or_emplace<T>(mEntity, std::forward<Args>(args)...);
55 LLNDAPI WeakEntityRef getWeakRef()
const;
60 ::EntityRegistry& mRegistry;
61 ::entt::basic_registry<::EntityId>& mEnTTRegistry;
62 ::EntityId
const mEntity;
67 EntityContext& operator=(EntityContext
const&);
68 EntityContext(EntityContext
const&) =
default;
Definition EntityContext.h:23