Macro in ldk_entity.h

LDK_ENTITY_MAX_COMPONENTS

#define LDK_ENTITY_MAX_COMPONENTS 16
Macro in ldk_entity.h

LDK_ENTITY_NAME_MAX_LEN

#define LDK_ENTITY_NAME_MAX_LEN 32
Macro in ldk_entity.h

LDK_ENTITY_INVALID_COMPONENT_INDEX

#define LDK_ENTITY_INVALID_COMPONENT_INDEX UINT32_MAX
Typedef in ldk_entity.h

LDKEntity

typedef XHandle LDKEntity;
Enum in ldk_entity.h

LDKEntityInternalFlags

typedef enum LDKEntityInternalFlags{
  LDK_ENTITY_INTERNAL_NONE=0,
  LDK_ENTITY_INTERNAL_PENDING_DELETE=1<<0,
  LDK_ENTITY_INTERNAL_HAS_TRANSFORM=1<<1,
  LDK_ENTITY_INTERNAL_HAS_CAMERA=1<<2,
  LDK_ENTITY_INTERNAL_HAS_RENDERABLE=1<<3,
  LDK_ENTITY_INTERNAL_HAS_LIGHT=1<<4,
  LDK_ENTITY_INTERNAL_EDITOR=1<<5
}LDKEntityInternalFlags;
Enum in ldk_entity.h

LDKComponentInstanceFlags

Serialized IDs of engine-owned components. These values are persistent: once assigned, a retired ID must not be reused for another component. User component IDs must stay below the engine-reserved high-ID range.

typedef enum LDKComponentInstanceFlags{
  LDK_COMPONENT_INSTANCE_FLAG_NONE=0,
  LDK_COMPONENT_INSTANCE_FLAG_HIDE_IN_EDITOR=1<<0,
  LDK_COMPONENT_INSTANCE_FLAG_DISABLED=1<<1
}LDKComponentInstanceFlags;
Enum in ldk_entity.h

LDKBuiltinComponentType

typedef enum LDKBuiltinComponentType{
  LDK_COMPONENT_TYPE_TRANSFORM=UINT32_MAX-1,
  LDK_COMPONENT_TYPE_CAMERA=UINT32_MAX-2,
  LDK_COMPONENT_TYPE_MESH_SOURCE=UINT32_MAX-3,
  LDK_COMPONENT_TYPE_POINT_LIGHT=UINT32_MAX-4,
  LDK_COMPONENT_TYPE_SPOT_LIGHT=UINT32_MAX-5,
  LDK_COMPONENT_TYPE_DIRECTIONAL_LIGHT=UINT32_MAX-6,
  LDK_COMPONENT_TYPE_INSTANCED_MESH_SOURCE=UINT32_MAX-7,
  LDK_COMPONENT_TYPE_PARTICLE_EMITTER=UINT32_MAX-8,
  LDK_COMPONENT_TYPE_POST_PROCESSING=UINT32_MAX-9,
  LDK_COMPONENT_TYPE_TEXT3D=UINT32_MAX-10,
  LDK_COMPONENT_TYPE_AUDIO_SOURCE=UINT32_MAX-11,
  LDK_COMPONENT_TYPE_GRASS_INTERACT=UINT32_MAX-12,
  LDK_COMPONENT_TYPE_TERRAIN_FOLLOWER=UINT32_MAX-14,
  LDK_COMPONENT_TYPE_KEYFRAME_ANIMATION_SOURCE=UINT32_MAX-15,
  LDK_COMPONENT_TYPE_MATERIAL_INSTANCE=UINT32_MAX-16,
}LDKBuiltinComponentType;
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;
Typedef in ldk_entity.h

LDKEntityIterFn

Callback visiting an entity during iteration.

typedef bool(*LDKEntityIterFn)(LDKEntity entity, LDKEntityInfo *info, void *user);

Parameters

entity
Entity to inspect or modify.
info
Info used by this operation.
user
Opaque caller-supplied data passed to the callback.

Returns

True if the operation succeeds; false otherwise.

Struct in ldk_entity.h

LDKEntityRegistry

typedef struct LDKEntityRegistry{
  XHPool pool;
  void(*component_state_changed)(void *user, LDKEntity entity);
  void *component_state_user;
}LDKEntityRegistry;
Function in ldk_entity.h

ldk_entity_module_initialize

Initialize the entity module.

LDK_API bool ldk_entity_module_initialize(
 LDKEntityRegistry *system,
 u32 page_capacity,
 u32 initial_pages
);

Parameters

LDKEntityRegistry *system
System used by this operation.
u32 page_capacity
Number of entries per allocation page.
u32 initial_pages
Number of pages initially allocated.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_entity.h

ldk_entity_is_alive

Check whether the entity refers to a live resource.

LDK_API bool ldk_entity_is_alive(
 LDKEntityRegistry *system,
 LDKEntity entity
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.

Returns

True when the queried condition holds; false otherwise.

Function in ldk_entity.h

ldk_entity_get_info_const

Get read-only information about an entity.

LDK_API const LDKEntityInfo * ldk_entity_get_info_const(
 LDKEntityRegistry *system,
 LDKEntity entity
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.

Returns

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

Function in ldk_entity.h

ldk_entity_flags_has

Check whether an entity has the requested flags.

LDK_API bool ldk_entity_flags_has(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u16 flags
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u16 flags
Bitmask of options controlling this operation.

Returns

True when the queried condition holds; false otherwise.

Function in ldk_entity.h

ldk_entity_internal_flags_has

Check whether an entity has the requested internal flags.

LDK_API bool ldk_entity_internal_flags_has(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u16 flags
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u16 flags
Bitmask of options controlling this operation.

Returns

True when the queried condition holds; false otherwise.

Function in ldk_entity.h

ldk_entity_name_set

Set the entity name.

LDK_API bool ldk_entity_name_set(
 LDKEntityRegistry *system,
 LDKEntity entity,
 const char *name
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
const char *name
Name identifying the object or setting.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_entity.h

ldk_entity_name_hash

Compute an entity name hash.

LDK_API u64 ldk_entity_name_hash(const char *name);

Parameters

const char *name
Name identifying the object or setting.

Returns

Computed identifier or hash.

Function in ldk_entity.h

ldk_entity_name_hash_set

Set the entity name hash.

LDK_API bool ldk_entity_name_hash_set(
 LDKEntityRegistry *registry,
 LDKEntity entity,
 u64 hash
);

Parameters

LDKEntityRegistry *registry
Registry on which the operation is performed.
LDKEntity entity
Entity to inspect or modify.
u64 hash
Hash used by this operation.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_entity.h

ldk_entity_transform_get_const

Get read-only access to the entity transform.

LDK_API const LDKTransform * ldk_entity_transform_get_const(
 LDKEntityRegistry *entity_module,
 LDKComponentRegistry *component_module,
 LDKEntity entity
);

Parameters

LDKEntityRegistry *entity_module
Entity module used by this operation.
LDKComponentRegistry *component_module
Component module used by this operation.
LDKEntity entity
Entity to inspect or modify.

Returns

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

Function in ldk_entity.h

ldk_entity_component_has

Check whether an entity owns a specific component.

LDK_API bool ldk_entity_component_has(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u32 component_type
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.

Returns

True when the queried condition holds; false otherwise.

Function in ldk_entity.h

ldk_entity_component_flags_get

Get the entity component flags.

LDK_API u16 ldk_entity_component_flags_get(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u32 component_type
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.

Returns

The requested value.

Function in ldk_entity.h

ldk_entity_component_flags_set

Set the entity component flags.

LDK_API bool ldk_entity_component_flags_set(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u32 component_type,
 u16 flags
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.
u16 flags
Bitmask of options controlling this operation.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_entity.h

ldk_entity_component_flags_add

Add the entity component flags.

LDK_API bool ldk_entity_component_flags_add(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u32 component_type,
 u16 flags
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.
u16 flags
Bitmask of options controlling this operation.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_entity.h

ldk_entity_component_flags_remove

Remove the entity component flags.

LDK_API bool ldk_entity_component_flags_remove(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u32 component_type,
 u16 flags
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.
u16 flags
Bitmask of options controlling this operation.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_entity.h

ldk_entity_component_flags_has

Check whether a component instance has requested flags.

LDK_API bool ldk_entity_component_flags_has(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u32 component_type,
 u16 flags
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.
u16 flags
Bitmask of options controlling this operation.

Returns

True when the queried condition holds; false otherwise.

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.

Function in ldk_entity.h

ldk_entity_component_find

Find the entity component.

LDK_API bool ldk_entity_component_find(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u32 component_type,
 u32 *out_slot,
 u32 *out_component_index
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.
u32 *out_slot
Receives the resulting slot.
u32 *out_component_index
Receives the resulting component index.

Returns

True if the operation succeeds; false otherwise.

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_add

Add the entity component.

LDK_API void * ldk_entity_component_add(
 LDKEntityRegistry *entity_module,
 LDKComponentRegistry *component_module,
 LDKEntity entity,
 u32 component_type,
 const void *initial_value
);

Parameters

LDKEntityRegistry *entity_module
Entity module used by this operation.
LDKComponentRegistry *component_module
Component module used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.
const void *initial_value
Initial value used by this operation.

Returns

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

Function in ldk_entity.h

ldk_entity_component_get

Get the entity component.

LDK_API void * ldk_entity_component_get(
 LDKEntityRegistry *entity_module,
 LDKComponentRegistry *component_module,
 LDKEntity entity,
 u32 component_type
);

Parameters

LDKEntityRegistry *entity_module
Entity module used by this operation.
LDKComponentRegistry *component_module
Component module used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.

Returns

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

Function in ldk_entity.h

ldk_entity_component_remove

Remove the entity component.

LDK_API bool ldk_entity_component_remove(
 LDKEntityRegistry *entity_module,
 LDKComponentRegistry *component_module,
 LDKEntity entity,
 u32 component_type
);

Parameters

LDKEntityRegistry *entity_module
Entity module used by this operation.
LDKComponentRegistry *component_module
Component module used by this operation.
LDKEntity entity
Entity to inspect or modify.
u32 component_type
Registered ECS component type identifier.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_entity.h

ldk_entity_iterator_next

Advance an entity iterator to the next entity.

LDK_API bool ldk_entity_iterator_next(
 LDKEntityIterator *iterator,
 LDKEntity *out_entity
);

Parameters

LDKEntityIterator *iterator
Iterator used by this operation.
LDKEntity *out_entity
Receives the resulting entity.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_entity.h

ldk_entity_internal_flags_set

Set the entity internal flags.

LDK_API void ldk_entity_internal_flags_set(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u16 flags
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u16 flags
Bitmask of options controlling this operation.
Function in ldk_entity.h

ldk_entity_internal_flags_add

Add the entity internal flags.

LDK_API void ldk_entity_internal_flags_add(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u16 flags
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u16 flags
Bitmask of options controlling this operation.
Function in ldk_entity.h

ldk_entity_internal_flags_remove

Remove the entity internal flags.

LDK_API void ldk_entity_internal_flags_remove(
 LDKEntityRegistry *system,
 LDKEntity entity,
 u16 flags
);

Parameters

LDKEntityRegistry *system
System used by this operation.
LDKEntity entity
Entity to inspect or modify.
u16 flags
Bitmask of options controlling this operation.