Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
Constraint Traits

Traits that enforce constraints on entities, components and relationships. More...

Collaboration diagram for Constraint Traits:

Variables

FLECS_API const ecs_entity_t EcsFinal
 Ensure that an entity or component cannot be used as a target in an IsA relationship.
 
FLECS_API const ecs_entity_t EcsSymmetric
 Mark relationship as commutative.
 
FLECS_API const ecs_entity_t EcsAcyclic
 Mark a relationship as acyclic.
 
FLECS_API const ecs_entity_t EcsOneOf
 Ensure that a relationship target is a child of the specified entity.
 
FLECS_API const ecs_entity_t EcsTrait
 Can be added to components to indicate it is a trait.
 
FLECS_API const ecs_entity_t EcsRelationship
 Ensure that an entity is always used in a pair as a relationship.
 
FLECS_API const ecs_entity_t EcsTarget
 Ensure that an entity is always used in a pair as a target.
 
FLECS_API const ecs_entity_t EcsSingleton
 Mark component as singleton.
 

Detailed Description

Traits that enforce constraints on entities, components and relationships.

Variable Documentation

◆ EcsAcyclic

FLECS_API const ecs_entity_t EcsAcyclic
extern

Mark a relationship as acyclic.

Acyclic relationships may not form cycles.

◆ EcsFinal

FLECS_API const ecs_entity_t EcsFinal
extern

Ensure that an entity or component cannot be used as a target in an IsA relationship.

Final can improve the performance of queries as they will not attempt to substitute a final component with its subsets.

Behavior:

if IsA(X, Y) and Final(Y) throw error

◆ EcsOneOf

FLECS_API const ecs_entity_t EcsOneOf
extern

Ensure that a relationship target is a child of the specified entity.

Behavior:

If OneOf(R, O) and R(X, Y), Y must be a child of O
If OneOf(R) and R(X, Y), Y must be a child of R

◆ EcsRelationship

FLECS_API const ecs_entity_t EcsRelationship
extern

Ensure that an entity is always used in a pair as a relationship.

Behavior:

e.add(R) panics
e.add(X, R) panics, unless X has the "Trait" trait

◆ EcsSingleton

FLECS_API const ecs_entity_t EcsSingleton
extern

Mark component as singleton.

Singleton components may only be added to themselves.

◆ EcsSymmetric

FLECS_API const ecs_entity_t EcsSymmetric
extern

Mark relationship as commutative.

Behavior:

if R(X, Y) then R(Y, X)

◆ EcsTarget

FLECS_API const ecs_entity_t EcsTarget
extern

Ensure that an entity is always used in a pair as a target.

Behavior:

e.add(T) panics
e.add(T, X) panics

◆ EcsTrait

FLECS_API const ecs_entity_t EcsTrait
extern

Can be added to components to indicate it is a trait.

Traits are components and/or tags that are added to other components to modify their behavior.