ecsalt_system behaviour (ecsalt v2.0.1)

View Source

Register, list, and unregister callbacks

Summary

Functions

List all registered systems and their relative priority

Register a callback of the form {module, fun, 2} or fun(M,N) that will accept Data as the first argument and the World reference as the second argument.

The same as register/2, but priority may also be specified. Negative values are higher priority.

Remove a system from the ECS world.

Types

component()

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

entity()

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

system()

-type system() :: {mfa() | fun()}.

world()

-opaque world()

Callbacks

proc(Data, World)

-callback proc(Data :: term(), World :: ecsalt:world()) -> term().

Functions

list/1

-spec list(world()) -> [tuple()].

List all registered systems and their relative priority

register(Callback, World)

-spec register(system(), world()) -> world().

Register a callback of the form {module, fun, 2} or fun(M,N) that will accept Data as the first argument and the World reference as the second argument.

register(Callback, Priority, World)

-spec register(system(), integer(), world()) -> world().

The same as register/2, but priority may also be specified. Negative values are higher priority.

unregister(Callback, World)

-spec unregister(system(), world()) -> world().

Remove a system from the ECS world.