Struct in ldk_entity.h

LDKComponentRef

Stable reference to a component through its owning entity.

typedef struct LDKComponentRef{
  LDKEntity entity;
  u16 version;
  u16 slot_index;
}LDKComponentRef;
Function in ldk_entity.h

ldk_component_ref_get

Resolve a component reference to its data.

LDK_API void * ldk_component_ref_get(
 LDKEntityRegistry *entity_system,
 struct LDKComponentRegistry *component_registry,
 LDKComponentRef ref
);

Parameters

LDKEntityRegistry *entity_system
Entity system used by this operation.
struct LDKComponentRegistry *component_registry
Component registry used by this operation.
LDKComponentRef ref
Ref used by this operation.

Returns

Pointer to the requested object or data; NULL when unavailable.

Function in ldk_entity.h

ldk_component_ref_get_const

Resolve a component reference as read-only data.

LDK_API const void * ldk_component_ref_get_const(
 LDKEntityRegistry *entity_system,
 struct LDKComponentRegistry *component_registry,
 LDKComponentRef ref
);

Parameters

LDKEntityRegistry *entity_system
Entity system used by this operation.
struct LDKComponentRegistry *component_registry
Component registry used by this operation.
LDKComponentRef ref
Ref used by this operation.

Returns

Pointer to the requested object or data; NULL when unavailable.

Function in ldk_entity.h

ldk_entity_component_ref_get

Get the entity component ref.

LDK_API bool ldk_entity_component_ref_get(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u32 component_type,
 LDKComponentRef *out_ref
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.
LDKComponentRef *out_ref
Receives the resulting ref.

Returns

True if the operation succeeds; false otherwise.