![]() |
Flecs v3.2
A fast entity component system (ECS) for C & C++
|
Save & restore world. More...
Typedefs | |
typedef struct ecs_snapshot_t | ecs_snapshot_t |
A snapshot stores the state of a world in a particular point in time. More... | |
Functions | |
FLECS_API ecs_snapshot_t * | ecs_snapshot_take (ecs_world_t *world) |
Create a snapshot. More... | |
FLECS_API ecs_snapshot_t * | ecs_snapshot_take_w_iter (ecs_iter_t *iter) |
Create a filtered snapshot. More... | |
FLECS_API void | ecs_snapshot_restore (ecs_world_t *world, ecs_snapshot_t *snapshot) |
Restore a snapshot. More... | |
FLECS_API ecs_iter_t | ecs_snapshot_iter (ecs_snapshot_t *snapshot) |
Obtain iterator to snapshot data. More... | |
FLECS_API bool | ecs_snapshot_next (ecs_iter_t *iter) |
Progress snapshot iterator. More... | |
FLECS_API void | ecs_snapshot_free (ecs_snapshot_t *snapshot) |
Free snapshot resources. More... | |
Save & restore world.
typedef struct ecs_snapshot_t ecs_snapshot_t |
A snapshot stores the state of a world in a particular point in time.
Definition at line 31 of file snapshot.h.
FLECS_API void ecs_snapshot_free | ( | ecs_snapshot_t * | snapshot | ) |
Free snapshot resources.
This frees resources associated with a snapshot without restoring it.
snapshot | The snapshot to free. |
FLECS_API ecs_iter_t ecs_snapshot_iter | ( | ecs_snapshot_t * | snapshot | ) |
Obtain iterator to snapshot data.
snapshot | The snapshot to iterate over. |
FLECS_API bool ecs_snapshot_next | ( | ecs_iter_t * | iter | ) |
Progress snapshot iterator.
iter | The snapshot iterator. |
FLECS_API void ecs_snapshot_restore | ( | ecs_world_t * | world, |
ecs_snapshot_t * | snapshot | ||
) |
Restore a snapshot.
This operation restores the world to the state it was in when the specified snapshot was taken. A snapshot can only be used once for restoring, as its data replaces the data that is currently in the world. This operation also resets the last issued entity handle, so any calls to ecs_new may return entity ids that have been issued before restoring the snapshot.
The world in which the snapshot is restored must be the same as the world in which the snapshot is taken.
world | The world to restore the snapshot to. |
snapshot | The snapshot to restore. |
FLECS_API ecs_snapshot_t * ecs_snapshot_take | ( | ecs_world_t * | world | ) |
Create a snapshot.
This operation makes a copy of the current state of the world.
world | The world to snapshot. |
FLECS_API ecs_snapshot_t * ecs_snapshot_take_w_iter | ( | ecs_iter_t * | iter | ) |
Create a filtered snapshot.
This operation is the same as ecs_snapshot_take, but accepts an iterator so an application can control what is stored by the snapshot.
iter | An iterator to the data to be stored by the snapshot. |