Archetype

data class Archetype(val type: EntityType, val id: Int)

Archetypes store a list of entities with the same EntityType, and provide functions to quickly move them between archetypes.

An example use case: If a query matches an archetype, it will also match all entities inside which gives a large performance boost to system iteration.

Constructors

Link copied to clipboard
constructor(type: EntityType, id: Int)

Functions

Link copied to clipboard
fun addEventHandler(handler: Handler)

Adds an event handler that listens to certain events relating to entities in this archetype.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
operator fun contains(componentId: ComponentId): Boolean
Link copied to clipboard
operator fun get(row: Int, componentId: ComponentId): Component?
Link copied to clipboard
fun getEntity(row: Int): Entity
Link copied to clipboard
operator fun minus(componentId: ComponentId): Archetype

Returns the archetype associated with removing componentId to this archetype's type.

Link copied to clipboard
operator fun plus(componentId: ComponentId): Archetype

Returns the archetype associated with adding componentId to this archetype's type.

Link copied to clipboard
fun removeEntity(row: Int)

Removes the entity at a row in this archetype, notifying running archetype iterators.

Properties

Link copied to clipboard
Link copied to clipboard

A map of event class type to a set of event handlers which fire on that event.

Link copied to clipboard
val id: Int
Link copied to clipboard
val size: Int

The amount of entities stored in this archetype.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard