Flecs v3.2
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
c_types.hpp
Go to the documentation of this file.
1
6#pragma once
7
8namespace flecs {
9
18using world_t = ecs_world_t;
19using world_info_t = ecs_world_info_t;
20using query_group_info_t = ecs_query_group_info_t;
21using id_t = ecs_id_t;
22using entity_t = ecs_entity_t;
23using type_t = ecs_type_t;
24using table_t = ecs_table_t;
25using filter_t = ecs_filter_t;
26using observer_t = ecs_observer_t;
27using query_t = ecs_query_t;
28using rule_t = ecs_rule_t;
29using ref_t = ecs_ref_t;
30using iter_t = ecs_iter_t;
31using type_info_t = ecs_type_info_t;
32using type_hooks_t = ecs_type_hooks_t;
33using flags32_t = ecs_flags32_t;
34
35enum inout_kind_t {
36 InOutDefault = EcsInOutDefault,
37 InOutNone = EcsInOutNone,
38 InOut = EcsInOut,
39 In = EcsIn,
40 Out = EcsOut
41};
42
43enum oper_kind_t {
44 And = EcsAnd,
45 Or = EcsOr,
46 Not = EcsNot,
47 Optional = EcsOptional,
48 AndFrom = EcsAndFrom,
49 OrFrom = EcsOrFrom,
50 NotFrom = EcsNotFrom
51};
52
54static const flecs::entity_t Pair = ECS_PAIR;
55static const flecs::entity_t Override = ECS_OVERRIDE;
56static const flecs::entity_t Toggle = ECS_TOGGLE;
57
61
62/* Builtin components */
63using Component = EcsComponent;
64using Identifier = EcsIdentifier;
65using Iterable = EcsIterable;
66using Poly = EcsPoly;
67using FlattenTarget = EcsFlattenTarget;
68
69/* Builtin tags */
70static const flecs::entity_t Query = EcsQuery;
71static const flecs::entity_t Observer = EcsObserver;
72static const flecs::entity_t Private = EcsPrivate;
73static const flecs::entity_t Module = EcsModule;
74static const flecs::entity_t Prefab = EcsPrefab;
75static const flecs::entity_t Disabled = EcsDisabled;
76static const flecs::entity_t Empty = EcsEmpty;
77static const flecs::entity_t Monitor = EcsMonitor;
78static const flecs::entity_t System = EcsSystem;
79static const flecs::entity_t Pipeline = ecs_id(EcsPipeline);
80static const flecs::entity_t Phase = EcsPhase;
81
82/* Builtin event tags */
83static const flecs::entity_t OnAdd = EcsOnAdd;
84static const flecs::entity_t OnRemove = EcsOnRemove;
85static const flecs::entity_t OnSet = EcsOnSet;
86static const flecs::entity_t UnSet = EcsUnSet;
87static const flecs::entity_t OnTableCreate = EcsOnTableCreate;
88static const flecs::entity_t OnTableDelete = EcsOnTableDelete;
89
90/* Builtin term flags */
91static const uint32_t Self = EcsSelf;
92static const uint32_t Up = EcsUp;
93static const uint32_t Down = EcsDown;
94static const uint32_t Cascade = EcsCascade;
95static const uint32_t Desc = EcsDesc;
96static const uint32_t Parent = EcsParent;
97static const uint32_t IsVariable = EcsIsVariable;
98static const uint32_t IsEntity = EcsIsEntity;
99static const uint32_t Filter = EcsFilter;
100static const uint32_t TraverseFlags = EcsTraverseFlags;
101
102/* Builtin entity ids */
103static const flecs::entity_t Flecs = EcsFlecs;
104static const flecs::entity_t FlecsCore = EcsFlecsCore;
105static const flecs::entity_t World = EcsWorld;
106
107/* Relationship properties */
108static const flecs::entity_t Wildcard = EcsWildcard;
109static const flecs::entity_t Any = EcsAny;
110static const flecs::entity_t This = EcsThis;
111static const flecs::entity_t Transitive = EcsTransitive;
112static const flecs::entity_t Reflexive = EcsReflexive;
113static const flecs::entity_t Final = EcsFinal;
114static const flecs::entity_t DontInherit = EcsDontInherit;
115static const flecs::entity_t AlwaysOverride = EcsAlwaysOverride;
116static const flecs::entity_t Tag = EcsTag;
117static const flecs::entity_t Union = EcsUnion;
118static const flecs::entity_t Exclusive = EcsExclusive;
119static const flecs::entity_t Acyclic = EcsAcyclic;
120static const flecs::entity_t Traversable = EcsTraversable;
121static const flecs::entity_t Symmetric = EcsSymmetric;
122static const flecs::entity_t With = EcsWith;
123static const flecs::entity_t OneOf = EcsOneOf;
124static const flecs::entity_t Trait = EcsTrait;
125static const flecs::entity_t Relationship = EcsRelationship;
126static const flecs::entity_t Target = EcsTarget;
127
128/* Builtin relationships */
129static const flecs::entity_t IsA = EcsIsA;
130static const flecs::entity_t ChildOf = EcsChildOf;
131static const flecs::entity_t DependsOn = EcsDependsOn;
132static const flecs::entity_t SlotOf = EcsSlotOf;
133
134/* Builtin identifiers */
135static const flecs::entity_t Name = EcsName;
136static const flecs::entity_t Symbol = EcsSymbol;
137
138/* Cleanup policies */
139static const flecs::entity_t OnDelete = EcsOnDelete;
140static const flecs::entity_t OnDeleteTarget = EcsOnDeleteTarget;
141static const flecs::entity_t Remove = EcsRemove;
142static const flecs::entity_t Delete = EcsDelete;
143static const flecs::entity_t Panic = EcsPanic;
144
145/* Misc */
146static const flecs::entity_t Flatten = EcsFlatten;
147static const flecs::entity_t DefaultChildComponent = EcsDefaultChildComponent;
148
149/* Builtin predicates for comparing entity ids in queries. Only supported by rules */
150static const flecs::entity_t PredEq = EcsPredEq;
151static const flecs::entity_t PredMatch = EcsPredMatch;
152static const flecs::entity_t PredLookup = EcsPredLookup;
153
154/* Builtin marker entities for query scopes */
155static const flecs::entity_t ScopeOpen = EcsScopeOpen;
156static const flecs::entity_t ScopeClose = EcsScopeClose;
157
160}
struct EcsIdentifier EcsIdentifier
A (string) identifier.
ecs_iterable_t EcsIterable
Component for iterable entities.
Definition flecs.h:1333
struct EcsPoly EcsPoly
Component for storing a poly object.
struct EcsFlattenTarget EcsFlattenTarget
Target data for flattened relationships.
struct EcsComponent EcsComponent
Component information.
const ecs_entity_t EcsOnRemove
Event that triggers when an id is removed from an entity.
const ecs_entity_t EcsThis
This entity.
const ecs_entity_t EcsWildcard
Wildcard entity ("*").
const ecs_entity_t EcsName
Tag to indicate name identifier.
const ecs_entity_t EcsAcyclic
Marks a relationship as acyclic.
const ecs_entity_t EcsSymmetric
Marks relationship as commutative.
const ecs_entity_t EcsOnSet
Event that triggers when a component is set for an entity.
const ecs_entity_t EcsReflexive
Marks a relationship as reflexive.
const ecs_entity_t EcsTrait
Can be added to components to indicate it is a trait.
const ecs_entity_t EcsEmpty
Tag used to indicate query is empty.
const ecs_entity_t EcsOneOf
Ensure that relationship target is child of specified entity.
const ecs_entity_t EcsOnTableDelete
Event that triggers when a table is deleted.
const ecs_entity_t EcsOnTableCreate
Event that triggers when a table is created.
const ecs_entity_t EcsRelationship
Ensure that an entity is always used in pair as relationship.
const ecs_entity_t EcsTraversable
Marks a relationship as traversable.
const ecs_entity_t EcsUnSet
Event that triggers when a component is unset for an entity.
const ecs_entity_t EcsIsA
Used to express inheritance relationships.
const ecs_entity_t EcsExclusive
Can be added to relationship to indicate that the relationship can only occur once on an entity.
const ecs_entity_t EcsSymbol
Tag to indicate symbol identifier.
const ecs_entity_t EcsDependsOn
Used to express dependency relationships.
const ecs_entity_t EcsAlwaysOverride
Ensures a component is always overridden.
const ecs_entity_t EcsTransitive
Marks a relationship as transitive.
const ecs_entity_t EcsDelete
Delete cleanup policy.
const ecs_entity_t EcsChildOf
Used to express parent-child relationships.
const ecs_entity_t EcsFlecsCore
Core module scope.
const ecs_entity_t EcsMonitor
Event that triggers observer when an entity starts/stops matching a query.
const ecs_entity_t EcsWorld
Entity associated with world (used for "attaching" components to world)
const ecs_entity_t EcsPrivate
Tag to indicate an entity/component/system is private to a module.
const ecs_entity_t EcsRemove
Remove cleanup policy.
const ecs_entity_t EcsSlotOf
Used to express a slot (used with prefab inheritance)
const ecs_entity_t EcsModule
Tag added to module entities.
const ecs_entity_t EcsOnAdd
Event that triggers when an id is added to an entity.
const ecs_entity_t EcsPrefab
Tag added to prefab entities.
const ecs_entity_t EcsUnion
Tag to indicate that relationship is stored as union.
const ecs_entity_t EcsAny
Any entity ("_").
const ecs_entity_t EcsTarget
Ensure that an entity is always used in pair as target.
const ecs_entity_t EcsWith
Ensure that a component always is added together with another component.
const ecs_entity_t EcsTag
Can be added to relationship to indicate that it should never hold data, even when it or the relation...
const ecs_entity_t EcsOnDelete
Relationship used for specifying cleanup behavior.
const ecs_entity_t EcsOnDeleteTarget
Relationship used to define what should happen when a target entity (second element of a pair) is del...
const ecs_entity_t EcsFlecs
Root scope for builtin flecs entities.
const ecs_entity_t EcsDisabled
When this tag is added to an entity it is skipped by queries, unless EcsDisabled is explicitly querie...
const ecs_entity_t EcsDontInherit
Ensures that component is never inherited from an IsA target.
const ecs_entity_t EcsPanic
Panic cleanup policy.
const ecs_entity_t EcsDefaultChildComponent
Used like (EcsDefaultChildComponent, Component).
const ecs_entity_t EcsFinal
Ensures that entity/component cannot be used as target in IsA relationship.
const ecs_entity_t EcsFlatten
Tag added to root entity to indicate its subtree should be flattened.
struct ecs_type_info_t ecs_type_info_t
Type information.
Definition flecs.h:468
struct ecs_observer_t ecs_observer_t
An observer is a system that is invoked when an event matches its query.
Definition flecs.h:436
struct ecs_ref_t ecs_ref_t
A ref is a fast way to fetch a component for a specific entity.
Definition flecs.h:458
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:318
struct ecs_rule_t ecs_rule_t
A rule is a query with advanced graph traversal features.
Definition flecs.h:416
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:362
struct ecs_filter_t ecs_filter_t
A filter is an iterable data structure that describes a query.
Definition flecs.h:374
struct ecs_type_hooks_t ecs_type_hooks_t
Type hooks are callbacks associated with component lifecycle events.
Definition flecs.h:463
uint64_t ecs_id_t
Ids are the things that can be added to an entity.
Definition flecs.h:311
struct ecs_query_t ecs_query_t
A query that caches its results.
Definition flecs.h:394
struct ecs_table_t ecs_table_t
A table stores entities and components for a specific type.
Definition flecs.h:365
const ecs_id_t ECS_PAIR
Indicates that the id is a pair.
const ecs_id_t ECS_OVERRIDE
Automatically override component when it is inherited.
const ecs_id_t ECS_TOGGLE
Adds bitset to storage which allows component to be enabled/disabled.
struct ecs_world_info_t ecs_world_info_t
Type that contains information about the world.
struct ecs_query_group_info_t ecs_query_group_info_t
Type that contains information about a query group.
#define EcsParent
Short for up(ChildOf)
Definition flecs.h:713
#define EcsIsEntity
Term id is an entity.
Definition flecs.h:715
#define EcsIsVariable
Term id is a variable.
Definition flecs.h:714
#define EcsDesc
Iterate groups in descending order
Definition flecs.h:712
#define EcsCascade
Sort results breadth first.
Definition flecs.h:711
#define EcsDown
Match by traversing downwards (derived, cannot be set)
Definition flecs.h:709
#define EcsFilter
Prevent observer from triggering on term.
Definition flecs.h:717
#define EcsUp
Match by traversing upwards.
Definition flecs.h:708
#define EcsSelf
Match on self.
Definition flecs.h:707
@ EcsOut
Term is only written.
Definition flecs.h:692
@ EcsInOut
Term is both read and written.
Definition flecs.h:690
@ EcsInOutDefault
InOut for regular terms, In for shared terms.
Definition flecs.h:688
@ EcsInOutNone
Term is neither read nor written.
Definition flecs.h:689
@ EcsIn
Term is only read.
Definition flecs.h:691
@ EcsNot
The term must not match.
Definition flecs.h:699
@ EcsOptional
The term may match.
Definition flecs.h:700
@ EcsOr
One of the terms in an or chain must match.
Definition flecs.h:698
@ EcsOrFrom
Term must match at least one component from term id.
Definition flecs.h:702
@ EcsAnd
The term must match.
Definition flecs.h:697
@ EcsNotFrom
Term must match none of the components from term id.
Definition flecs.h:703
@ EcsAndFrom
Term must match all components from term id.
Definition flecs.h:701
A type is a list of (component) ids.
Definition flecs.h:335