ecsalt (ecsalt v2.0.0)

View Source

Entity Component System

Summary

Functions

Stop the ECS and delete the ETS tables

Create a new ECS world with default ETS options. Returns an opaque world record used by all other API functions.

For every registered system, trigger the proc callback with some extra data specified by Data and gather results.

Convert the component list for a given entity ID to a map. Warning: this can potentially create an unbounded number of atoms!

Types

component()

-type component() :: {term(), term()}.

entity()

-type entity() :: {term(), [component()]}.

world()

-opaque world()

Functions

delete/1

-spec delete(world()) -> ok.

Stop the ECS and delete the ETS tables

new()

-spec new() -> world().

Create a new ECS world with default ETS options. Returns an opaque world record used by all other API functions.

See also new/1, especially if you need to start ECSalt with public tables for multi-process access.

proc(Data, World)

-spec proc(term(), world()) -> [any()].

For every registered system, trigger the proc callback with some extra data specified by Data and gather results.

to_map/1

-spec to_map(entity()) -> map().

Convert the component list for a given entity ID to a map. Warning: this can potentially create an unbounded number of atoms!