Skip to main content

Function: addSpriteComponent()

addSpriteComponent(world, entity, options): SpriteEcsComponent

Defined in: rendering/components/sprite-component.ts:107

Attaches a SpriteEcsComponent to entity.

Parameters

world

EcsWorld

The ECS world entity belongs to.

entity

number

The entity to attach the component to.

options

SpriteRequiredOptions & Partial<SpriteEcsComponent>

Options for configuring the sprite. width, height, and renderable have no sensible default and must always be provided.

Returns

SpriteEcsComponent

The attached component, for further tuning or runtime changes.