Flecs v4.0
A fast entity component system (ECS) for C & C++
|
Functions for enabling/disabling entities and components. More...
Functions | |
void | ecs_enable (ecs_world_t *world, ecs_entity_t entity, bool enabled) |
Enable or disable entity. | |
void | ecs_enable_id (ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool enable) |
Enable or disable component. | |
bool | ecs_is_enabled_id (const ecs_world_t *world, ecs_entity_t entity, ecs_id_t id) |
Test if component is enabled. | |
Functions for enabling/disabling entities and components.
void ecs_enable | ( | ecs_world_t * | world, |
ecs_entity_t | entity, | ||
bool | enabled ) |
Enable or disable entity.
This operation enables or disables an entity by adding or removing the EcsDisabled tag. A disabled entity will not be matched with any systems, unless the system explicitly specifies the EcsDisabled tag.
world | The world. |
entity | The entity to enable or disable. |
enabled | true to enable the entity, false to disable. |
void ecs_enable_id | ( | ecs_world_t * | world, |
ecs_entity_t | entity, | ||
ecs_id_t | id, | ||
bool | enable ) |
Enable or disable component.
Enabling or disabling a component does not add or remove a component from an entity, but prevents it from being matched with queries. This operation can be useful when a component must be temporarily disabled without destroying its value. It is also a more performant operation for when an application needs to add/remove components at high frequency, as enabling/disabling is cheaper than a regular add or remove.
world | The world. |
entity | The entity. |
id | The component. |
enable | True to enable the component, false to disable. |
bool ecs_is_enabled_id | ( | const ecs_world_t * | world, |
ecs_entity_t | entity, | ||
ecs_id_t | id ) |
Test if component is enabled.
Test whether a component is currently enabled or disabled. This operation will return true when the entity has the component and if it has not been disabled by ecs_enable_component().
world | The world. |
entity | The entity. |
id | The component. |