Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
Snapshot
Collaboration diagram for Snapshot:

Typedefs

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

Functions

FLECS_API ecs_snapshot_tecs_snapshot_take (ecs_world_t *world)
 Create a snapshot.
 
FLECS_API ecs_snapshot_tecs_snapshot_take_w_iter (ecs_iter_t *iter)
 Create a filtered snapshot.
 
FLECS_API void ecs_snapshot_restore (ecs_world_t *world, ecs_snapshot_t *snapshot)
 Restore a snapshot.
 
FLECS_API ecs_iter_t ecs_snapshot_iter (ecs_snapshot_t *snapshot)
 Obtain iterator to snapshot data.
 
FLECS_API bool ecs_snapshot_next (ecs_iter_t *iter)
 Progress snapshot iterator.
 
FLECS_API void ecs_snapshot_free (ecs_snapshot_t *snapshot)
 Free snapshot resources.
 

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.

Parameters
snapshotThe snapshot to free.

◆ ecs_snapshot_iter()

FLECS_API ecs_iter_t ecs_snapshot_iter ( ecs_snapshot_t * snapshot)

Obtain iterator to snapshot data.

Parameters
snapshotThe snapshot to iterate over.
Returns
Iterator to snapshot data.

◆ ecs_snapshot_next()

FLECS_API bool ecs_snapshot_next ( ecs_iter_t * iter)

Progress snapshot iterator.

Parameters
iterThe snapshot iterator.
Returns
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.

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

Parameters
worldThe world to snapshot.
Returns
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.

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