Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
ecs_type_t Struct Reference

A type is a list of (component) ids. More...

#include <flecs.h>

Public Attributes

ecs_id_tarray
 Array with ids.
 
int32_t count
 Number of elements in array.
 

Detailed Description

A type is a list of (component) ids.

Types are used to communicate the "type" of an entity. In most type systems a typeof operation returns a single type. In ECS however, an entity can have multiple components, which is why an ECS type consists of a vector of ids.

The component ids of a type are sorted, which ensures that it doesn't matter in which order components are added to an entity. For example, if adding Position then Velocity would result in type [Position, Velocity], first adding Velocity then Position would also result in type [Position, Velocity].

Entities are grouped together by type in the ECS storage in tables. The storage has exactly one table per unique type that is created by the application that stores all entities and components for that type. This is also referred to as an archetype.

Definition at line 364 of file flecs.h.

Member Data Documentation

◆ array

ecs_id_t* ecs_type_t::array

Array with ids.

Definition at line 365 of file flecs.h.

◆ count

int32_t ecs_type_t::count

Number of elements in array.

Definition at line 366 of file flecs.h.


The documentation for this struct was generated from the following file: