LDKGroupingDesc
typedef struct LDKGroupingDesc{
u64 id;
const char *name;
const u32 *component_types;
u32 component_count;
}LDKGroupingDesc;
ECS facade module.
Thin convenience facade over Entity, Component and System modules. This module is prefered to be used on user code while the direct submodule access is reserved for internal engine use.
typedef struct LDKGroupingDesc{
u64 id;
const char *name;
const u32 *component_types;
u32 component_count;
}LDKGroupingDesc;
typedef struct LDKECS{
LDKEntityRegistry entity;
LDKComponentRegistry component;
LDKSystemRegistry system;
void *grouping_internal;
}LDKECS;
Initialize the ECS.
LDK_API bool ldk_ecs_initialize(
LDKECS *context,
u32 entity_page_capacity,
u32 entity_initial_pages
);
LDKECS *contextu32 entity_page_capacityu32 entity_initial_pagesTrue if the operation succeeds; false otherwise.
Shut down the ECS.
LDK_API void ldk_ecs_terminate(void);
Create the ECS entity.
LDK_API LDKEntity ldk_ecs_entity_create(void);
The requested value.
Destroy the ECS entity.
LDK_API void ldk_ecs_entity_destroy(LDKEntity entity);
LDKEntity entityAdd the ECS component.
LDK_API void * ldk_ecs_component_add(
LDKEntity entity,
u32 component_type,
const void *initial_value
);
LDKEntity entityu32 component_typeconst void *initial_valuePointer to the requested object or data; NULL when unavailable.
Get the ECS component.
LDK_API void * ldk_ecs_component_get(
LDKEntity entity,
u32 component_type
);
LDKEntity entityu32 component_typePointer to the requested object or data; NULL when unavailable.
Get read-only access to the ECS component.
LDK_API const void * ldk_ecs_component_get_const(
LDKEntity entity,
u32 component_type
);
LDKEntity entityu32 component_typePointer to the requested object or data; NULL when unavailable.
Remove the ECS component.
LDK_API bool ldk_ecs_component_remove(
LDKEntity entity,
u32 component_type
);
LDKEntity entityu32 component_typeTrue if the operation succeeds; false otherwise.
Register the ECS component.
LDK_API bool ldk_ecs_component_register(const LDKComponentDesc *desc);
const LDKComponentDesc *descTrue if the operation succeeds; false otherwise.
Zero means an empty requirement set (or an invalid declaration). Hashes count and sorted unique u32 IDs in fixed little-endian byte order.
LDK_API u64 ldk_ecs_grouping_id(
const u32 *component_types,
u32 component_count
);
const u32 *component_typesu32 component_countComputed identifier or hash.
Check whether the ECS component is enabled.
LDK_API bool ldk_ecs_component_is_enabled(
LDKEntity entity,
u32 component_type
);
LDKEntity entityu32 component_typeTrue when the queried condition holds; false otherwise.
Enable or disable one component instance.
LDK_API bool ldk_ecs_component_enabled_set(
LDKEntity entity,
u32 component_type,
bool enabled
);
LDKEntity entityu32 component_typebool enabledTrue if the operation succeeds; false otherwise.
Register the ECS grouping.
LDK_API bool ldk_ecs_grouping_register(const LDKGroupingDesc *desc);
const LDKGroupingDesc *descTrue if the operation succeeds; false otherwise.
Unregister the ECS grouping.
LDK_API bool ldk_ecs_grouping_unregister(u64 id);
u64 idTrue if the operation succeeds; false otherwise.
Find a registered ECS grouping by its stable ID.
LDK_API bool ldk_ecs_grouping_find_by_id(
u64 id,
LDKGroupingDesc *out
);
u64 idLDKGroupingDesc *outTrue if the operation succeeds; false otherwise.
Count the registered ECS group descriptions.
LDK_API u32 ldk_ecs_grouping_count(void);
Number of matching entries.
Get a registered ECS grouping by index.
LDK_API bool ldk_ecs_grouping_at(
u32 index,
LDKGroupingDesc *out
);
u32 indexLDKGroupingDesc *outTrue if the operation succeeds; false otherwise.
Get the runtime entity group matching a registered grouping ID.
LDK_API const LDKEntityGroup * ldk_ecs_grouping_get(u64 id);
u64 idPointer to the requested object or data; NULL when unavailable.
Legacy compatibility no-op. Project [groupings] sections are ignored.
LDK_API bool ldk_ecs_grouping_configure_file(const char *ini_path);
const char *ini_pathTrue if the operation succeeds; false otherwise.
True when a grouping originated in the current configuration file.
LDK_API bool ldk_ecs_grouping_is_config_defined(u64 id);
u64 idTrue when the queried condition holds; false otherwise.
Register the ECS system.
LDK_API bool ldk_ecs_system_register(const LDKSystemDesc *desc);
const LDKSystemDesc *descTrue if the operation succeeds; false otherwise.
Unregister the ECS system.
LDK_API bool ldk_ecs_system_unregister(u64 id);
u64 idTrue if the operation succeeds; false otherwise.
Start/stop an individual registered system without changing the catalog.
LDK_API bool ldk_ecs_system_start(u64 id);
u64 idTrue if the operation succeeds; false otherwise.
Stop the ECS system.
LDK_API bool ldk_ecs_system_stop(u64 id);
u64 idTrue if the operation succeeds; false otherwise.
Check whether the ECS system is started.
LDK_API bool ldk_ecs_system_is_started(u64 id);
u64 idTrue when the queried condition holds; false otherwise.
Suspend/resume execution without destroying individual system state.
LDK_API bool ldk_ecs_system_pause(void);
True if the operation succeeds; false otherwise.
Resume the ECS system.
LDK_API bool ldk_ecs_system_resume(void);
True if the operation succeeds; false otherwise.
Check whether the ECS system is paused.
LDK_API bool ldk_ecs_system_is_paused(void);
True when the queried condition holds; false otherwise.
Callback visiting an ECS entity during iteration.
typedef bool(*LDKECSEntityIterFn)(LDKEntity entity, void *user);
entityuserTrue if the operation succeeds; false otherwise.
Visit active ECS entities using a caller-provided callback.
LDK_API bool ldk_ecs_entity_foreach(
LDKECSEntityIterFn fn,
void *user
);
LDKECSEntityIterFn fnvoid *userTrue if the operation succeeds; false otherwise.
Count components attached to an ECS entity.
LDK_API u32 ldk_ecs_entity_component_count(LDKEntity entity);
LDKEntity entityNumber of matching entries.
Read the type ID of an entity component by index.
LDK_API bool ldk_ecs_entity_component_type_at(
LDKEntity entity,
u32 component_index,
u32 *out_component_type
);
LDKEntity entityu32 component_indexu32 *out_component_typeTrue if the operation succeeds; false otherwise.
Get the ECS entity name.
LDK_API const char * ldk_ecs_entity_name_get(LDKEntity entity);
LDKEntity entityPointer to the requested object or data; NULL when unavailable.
Set the ECS entity name.
LDK_API bool ldk_ecs_entity_name_set(
LDKEntity entity,
const char *name
);
LDKEntity entityconst char *nameTrue if the operation succeeds; false otherwise.
Get the stored hash of an entity name.
LDK_API u64 ldk_ecs_entity_name_hash_get(LDKEntity entity);
LDKEntity entityComputed identifier or hash.
Assign the stored hash of an entity name.
LDK_API bool ldk_ecs_entity_name_hash_set(
LDKEntity entity,
u64 hash
);
LDKEntity entityu64 hashTrue if the operation succeeds; false otherwise.
Get the ECS entity registry.
LDK_API LDKEntityRegistry * ldk_ecs_entity_registry_get(void);
Pointer to the requested object or data; NULL when unavailable.
Get the ECS component registry.
LDK_API LDKComponentRegistry * ldk_ecs_component_registry_get(void);
Pointer to the requested object or data; NULL when unavailable.
Get the ECS system registry.
LDK_API LDKSystemRegistry * ldk_ecs_system_registry_get(void);
Pointer to the requested object or data; NULL when unavailable.
Start the ECS system registry.
LDK_API bool ldk_ecs_system_registry_start(LDKECS *context);
LDKECS *contextTrue if the operation succeeds; false otherwise.
Execute the ECS system bucket.
LDK_API bool ldk_ecs_system_bucket_run(
LDKECS *context,
LDKSystemBucket bucket,
float delta_time
);
LDKECS *contextLDKSystemBucket bucketfloat delta_timeTrue if the operation succeeds; false otherwise.
Stop the ECS system registry.
LDK_API bool ldk_ecs_system_registry_stop(LDKECS *context);
LDKECS *contextTrue if the operation succeeds; false otherwise.
Clear all runtime membership state for registered Entity Groups while preserving their definitions. Intended for full scene/ECS entity resets.
LDK_API bool ldk_ecs_grouping_runtime_reset(void);
True if the operation succeeds; false otherwise.