Systems module

Structures

ecs_dbg_system_t
EcsContext

Mentioned in

EcsIterAction
EcsQuery
EcsSignature
EcsSignatureExpr
EcsTickSource
FlecsSystem

Functions

ecs_dbg_get_active_table
ecs_dbg_get_column_type
ecs_dbg_get_inactive_table
ecs_dbg_match_entity
ecs_dbg_system
ecs_get_queryGet the query object for a system
ecs_runRun a specific system manually
ecs_run_w_filterRun system with offset/limit and type filter
ecs_run_workerSame as ecs_run, but subdivides entities across number of provided stages.
ecs_set_system_status_actionSet system status action
ecs_type overload
FlecsSystemImport

Enums

ecs_system_status_tSystem status change callback

Defines

Defines (system.h)

FLECS_SYSTEMS_H

ECS_SYSTEM(world,name,kind,...)
ecs_iter_action_t ecs_iter_action(name) = name;
ecs_entity_t name = ecs_new_system(world, 0, #name, kind, #__VA_ARGS__, ecs_iter_action(name));
(void)ecs_iter_action(name);
(void)name;

Declare a systen. This macro declares a system with the specified function, kind and signature. Systems are matched with entities that match the system signature. The system signature is specified as a comma-separated list of column expressions, where a column expression can be any of the following:

  • A simple component identifier ('Position')
  • An OR expression ('Position | Velocity')
  • An optional expression ('?Position')
  • A NOT expression ('!Position')
  • An OWNED expression ('OWNED:Position')
  • A SHARED expression ('SHARED:Position')
  • A PARENT expression ('PARENT:Position')
  • A CASCADE expression ('CASCADE:Position')
  • An entity expression ('MyEntity:Position')
  • An empty expression (':Position')

The systen kind specifies the phase in which the system is ran.

Examples: ECS_SYSTEM(world, Move, EcsOnUpdate, Position, Velocity, !AngularVelocity); ECS_SYSTEM(world, Transform, EcsPostUpdate, PARENT:Transform, Transform);

In these examples, 'Move' and 'Transform' must be valid identifiers to a C function of the following signature:

void Move(ecs_iter_t *it) { ... }

Inside this function the system can access the data from the signature with the ECS_COLUMN macro:

ECS_COLUMN(it, Position, p, 1); ECS_COLUMN(it, Velocity, v, 2);

For more details on system signatures and phases see the Flecs manual.

Mentioned in:

Readme / Example

FAQ / How do I attach resources to a system?

Quickstart / Systems

Quickstart / Traits

Manual / Naming conventions

Manual / Idempotence

Manual / Switchable tags

Manual / SYSTEM

Manual / Systems

Manual / Monitors

Manual / OnSet Systems

Manual / Modules

Manual / Paths and signatures

Manual / Staging

Manual / Pipelines

MigrationGuide / Merging

MigrationGuide / API changes

ECS_TRIGGER(world,name,kind,component)
ecs_entity_t __F##name = ecs_new_trigger(world, 0, #name, kind, #component, name);
ecs_entity_t name = __F##name;
(void)__F##name;
(void)name;

Mentioned in:

FlecsSystemImportHandles(handles)

Typedefs

Typedefs (system.h)

typedef void(* ecs_system_status_action_t)(ecs_world_t *world, ecs_entity_t system, ecs_system_status_t status, void *ctx)