Pixi

NodeRegistry

Renderer nodes keyed by ECS entity.

Hosts mirror ECS entities into renderer objects (sprites, containers, meshes). The registry owns the bookkeeping every game repeats: one node per entity, attaching new nodes to the scene, detaching and destroying them when the entity loses its renderable or is despawned, and teardown.

Nodes are keyed by the entity's numeric value, so an EntityId, a query match's entity.id, or a stored Handle all address the same node.

Examples

const sprites = NodeRegistry.inContainer<Sprite>(actorLayer)
sprites.ensure(match.entity.id, () => new Sprite(texture))
sprites.remove(despawnedId)
sprites.clear()

Functions

make

Source

Creates a registry with explicit attach/detach behavior, for nodes that are not plain containers (for example a wrapper holding a sprite and metadata).

inContainer

Source

Creates a registry whose nodes are children of one container and are destroyed (with their children) when removed.