xecs.EntityId#

class xecs.EntityId[source]#

Bases: Component

A component that stores the entity id.

Methods

create_pool

Create a preallocated pool of components.

Attributes

component_ids

Maps each component type to a unique ID.

value

The entity id.

classmethod create_pool(capacity)#

Create a preallocated pool of components.

Parameters:

capacity (int) – The maximum number of components the pool can hold.

Returns:

The component pool.

Return type:

ComponentPool[Self]

component_ids: ClassVar[dict[type[Component], ComponentId]] = {<class 'xecs._internal.entity_id.EntityId'>: 0, <class 'xecs._internal.transform2.Transform2'>: 1}#

Maps each component type to a unique ID. This is automatically populated by subclasses.

value: UInt32#

The entity id.