ecs_commit

Function ecs_commit 

Source
pub unsafe extern "C" fn ecs_commit(
    world: *mut ecs_world_t,
    entity: ecs_entity_t,
    record: *mut ecs_record_t,
    table: *mut ecs_table_t,
    added: *const ecs_type_t,
    removed: *const ecs_type_t,
) -> bool
Expand description

Commit (move) entity to a table. This operation moves an entity from its current table to the specified table. This may cause the following actions:

  • Ctor for each component in the target table
  • Move for each overlapping component
  • Dtor for each component in the source table.
  • OnAdd triggers for non-overlapping components in the target table
  • OnRemove triggers for non-overlapping components in the source table.

This operation is a faster than adding/removing components individually.

The application must explicitly provide the difference in components between tables as the added/removed parameters. This can usually be derived directly from the result of ecs_table_add_id and esc_table_remove_id. These arrays are required to properly execute OnAdd/OnRemove triggers.

@param world The world. @param entity The entity to commit. @param record The entity’s record (optional, providing it saves a lookup). @param table The table to commit the entity to. @return True if the entity got moved, false otherwise.