Flecs v3.2
A fast entity component system (ECS) for C & C++
No Matches

Save & restore world. More...


typedef struct ecs_snapshot_t ecs_snapshot_t
 A snapshot stores the state of a world in a particular point in time. More...


FLECS_API ecs_snapshot_tecs_snapshot_take (ecs_world_t *world)
 Create a snapshot. More...
FLECS_API ecs_snapshot_tecs_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...

Detailed Description

Save & restore world.

Typedef Documentation

◆ 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.

Function Documentation

◆ ecs_snapshot_free()

FLECS_API void ecs_snapshot_free ( ecs_snapshot_t snapshot)

Free snapshot resources.

This frees resources associated with a snapshot without restoring it.

snapshotThe snapshot to free.

◆ ecs_snapshot_iter()

FLECS_API ecs_iter_t ecs_snapshot_iter ( ecs_snapshot_t snapshot)

Obtain iterator to snapshot data.

snapshotThe snapshot to iterate over.
Iterator to snapshot data.

◆ ecs_snapshot_next()

FLECS_API bool ecs_snapshot_next ( ecs_iter_t *  iter)

Progress snapshot iterator.

iterThe snapshot iterator.
True if more data is available, otherwise false.

◆ ecs_snapshot_restore()

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.

worldThe world to restore the snapshot to.
snapshotThe snapshot to restore.

◆ ecs_snapshot_take()

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.

worldThe world to snapshot.
The snapshot.

◆ ecs_snapshot_take_w_iter()

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.

iterAn iterator to the data to be stored by the snapshot.
The snapshot.