Component to manage drawings, using with the position component

Hierarchy

Constructors

Properties

anchor: Vector = Vector.Half

Anchor to apply to graphics by default

copyGraphics: boolean = false

If set to true graphics added to the component will be copied. This can affect performance

dependencies?: ComponentCtor<Component<string>>[]

Optionally list any component types this component depends on If the owner entity does not have these components, new components will be added to the entity

Only components with zero-arg constructors are supported as automatic component dependencies

offset: Vector = Vector.Zero

Offset to apply to graphics by default

onPostDraw: ((ctx: ExcaliburGraphicsContext, elapsedMilliseconds: number) => void)

Type declaration

    • (ctx: ExcaliburGraphicsContext, elapsedMilliseconds: number): void
    • Draws after the entity transform has been applied, and after graphics component graphics has been drawn

      Parameters

      Returns void

onPreDraw: ((ctx: ExcaliburGraphicsContext, elapsedMilliseconds: number) => void)

Type declaration

    • (ctx: ExcaliburGraphicsContext, elapsedMilliseconds: number): void
    • Draws after the entity transform has bene applied, but before graphics component graphics have been drawn

      Parameters

      Returns void

opacity: number = 1

Sets or gets wither all drawings should have an opacity applied

optional?: ComponentCtor<Component<string>>[]
owner?: Entity = null

Current owning Entity, if any, of this component. Null if not added to any Entity

type: "ex.graphics" = 'ex.graphics'

Type of this component, must be a unique type among component types in you game.

visible: boolean = true

Sets or gets wether any drawing should be visible in this component

Accessors

Methods

  • Internal

    Update underlying graphics if necesary, called internally

    Parameters

    • elapsed: number
    • idempotencyToken: number = 0

    Returns void