- defineComponent ⇒
object
Defines a new component store.
- registerComponent
Registers a component with a world.
- registerComponents
Registers multiple components with a world.
- hasComponent ⇒
boolean
Checks if an entity has a component.
- addComponent
Adds a component to an entity
- removeComponent
Removes a component from an entity and resets component state unless otherwise specified.
- setDefaultSize
Sets the default maximum number of entities for worlds and component stores.
- setRemovedRecycleThreshold
Sets the number of entities that must be removed before removed entity ids begin to be recycled. This should be set to as a % (0-1) of
defaultSize
that you would never likely remove/add on a single frame.- addEntity ⇒
number
Adds a new entity to the specified world.
- removeEntity
Removes an existing entity from the specified world.
- getEntityComponents
Returns an array of components that an entity possesses.
- entityExists
Checks the existence of an entity in a world
- enterQuery ⇒
function
Given an existing query, returns a new function which returns entities who have been added to the given query since the last call of the function.
- exitQuery ⇒
function
Given an existing query, returns a new function which returns entities who have been removed from the given query since the last call of the function.
- defineQuery ⇒
function
Defines a query function which returns a matching set of entities when called on a world.
- resetChangedQuery
Resets a Changed-based query, clearing the underlying list of changed entities.
- removeQuery
Removes a query from a world.
- defineSerializer ⇒
function
Defines a new serializer which targets the given components to serialize the data of when called on a world or array of EIDs.
- defineDeserializer ⇒
function
Defines a new deserializer which targets the given components to deserialize onto a given world.
- defineSystem ⇒
function
Defines a new system function.
- createWorld ⇒
object
Creates a new world.
- resetWorld ⇒
object
Resets a world.
- deleteWorld
Deletes a world.
- getWorldComponents ⇒
Returns all components registered to a world
- getAllEntities ⇒
Returns all existing entities in a world
Defines a new component store.
Param | Type |
---|---|
schema | object |
Registers a component with a world.
Param | Type |
---|---|
world | World |
component | Component |
Registers multiple components with a world.
Param | Type |
---|---|
world | World |
components | Component |
Checks if an entity has a component.
Param | Type |
---|---|
world | World |
component | Component |
eid | number |
Adds a component to an entity
Param | Type | Default |
---|---|---|
world | World |
|
component | Component |
|
eid | number |
|
[reset] | boolean |
false |
Removes a component from an entity and resets component state unless otherwise specified.
Param | Type | Default |
---|---|---|
world | World |
|
component | Component |
|
eid | number |
|
[reset] | boolean |
true |
Sets the default maximum number of entities for worlds and component stores.
Param | Type |
---|---|
newSize | number |
Sets the number of entities that must be removed before removed entity ids begin to be recycled. This should be set to as a % (0-1) of
defaultSize
that you would never likely remove/add on a single frame.
Param | Type |
---|---|
newThreshold | number |
Adds a new entity to the specified world.
Returns: number
- eid
Param | Type |
---|---|
world | World |
Removes an existing entity from the specified world.
Param | Type |
---|---|
world | World |
eid | number |
Returns an array of components that an entity possesses.
Param | Type |
---|---|
world | * |
eid | * |
Checks the existence of an entity in a world
Param | Type |
---|---|
world | World |
eid | number |
Given an existing query, returns a new function which returns entities who have been added to the given query since the last call of the function.
Returns: function
- enteredQuery
Param | Type |
---|---|
query | function |
Given an existing query, returns a new function which returns entities who have been removed from the given query since the last call of the function.
Returns: function
- enteredQuery
Param | Type |
---|---|
query | function |
Defines a query function which returns a matching set of entities when called on a world.
Returns: function
- query
Param | Type |
---|---|
components | array |
Resets a Changed-based query, clearing the underlying list of changed entities.
Param | Type |
---|---|
world | World |
query | function |
Removes a query from a world.
Param | Type |
---|---|
world | World |
query | function |
Defines a new serializer which targets the given components to serialize the data of when called on a world or array of EIDs.
Returns: function
- serializer
Param | Type | Default |
---|---|---|
target | object , array |
|
[maxBytes] | number |
20000000 |
Defines a new deserializer which targets the given components to deserialize onto a given world.
Returns: function
- deserializer
Param | Type |
---|---|
target | object , array |
Defines a new system function.
Param | Type |
---|---|
update | function |
Creates a new world.
Resets a world.
Param | Type |
---|---|
world | World |
Deletes a world.
Param | Type |
---|---|
world | World |
Returns all components registered to a world
Returns: Array
Param | Type |
---|---|
world | World |
Returns all existing entities in a world
Returns: Array
Param | Type |
---|---|
world | World |