29 MCNAPI uint64
operator()(::EntityContext
const& entity)
const;
34 [[nodiscard]]
inline entt::basic_registry<EntityId>& getRegistry() noexcept {
return mEnTTRegistry; }
36 [[nodiscard]]
inline entt::basic_registry<EntityId>
const& getRegistry() const noexcept {
return mEnTTRegistry; }
39 [[nodiscard]]
inline optional_ref<T const> tryGetComponent()
const {
40 return getRegistry().try_get<T>(mEntity);
44 [[nodiscard]]
inline optional_ref<T> tryGetComponent() {
45 return const_cast<T*
>(std::as_const(getRegistry()).try_get<T>(mEntity));
49 [[nodiscard]]
inline bool hasComponent()
const {
50 return getRegistry().all_of<T>(mEntity);
54 inline bool removeComponent() {
55 return getRegistry().remove<T>(mEntity);
58 template <
class T,
typename... Args>
59 [[nodiscard]]
inline T& getOrAddComponent(Args&&... args) {
60 return getRegistry().get_or_emplace<T>(mEntity, std::forward<Args>(args)...);
66 ::EntityRegistry& mRegistry;
67 ::entt::basic_registry<::EntityId>& mEnTTRegistry;
68 ::EntityId
const mEntity;
75 MCAPI EntityContext(::EntityRegistry& registry, ::StrictEntityContext
const& entity);
78 MCAPI EntityContext(::EntityRegistry& registry, ::EntityId entity);
80 MCAPI ::EntityId _getEntityId()
const;
82 MCFOLD ::EntityRegistry& _registry()
const;
84 MCAPI ::WeakRef<::EntityContext> getWeakRef()
const;
86 MCAPI
bool isValid()
const;
88 MCAPI
bool operator==(::EntityContext
const& other)
const;
95 MCAPI
void* $ctor(::EntityRegistry& registry, ::StrictEntityContext
const& entity);
98 MCAPI
void* $ctor(::EntityRegistry& registry, ::EntityId entity);
Definition StrictEntityContext.h:14
Definition EntityContext.h:25
MCAPI uint64 operator()(::EntityContext const &entity) const