Options
All
  • Public
  • Public/Protected
  • All
Menu

The Texture object allows games built in Excalibur to load image resources. Texture is an Loadable which means it can be passed to a Loader to pre-load before starting a level or game.

Hierarchy

  • Texture

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Texture(path: string, bustCache?: boolean): Texture
  • Parameters

    • path: string

      Path to the image resource or a base64 string representing an image "data:image/png;base64,iVB..."

    • Default value bustCache: boolean = true

      Optionally load texture with cache busting

    Returns Texture

Properties

bustCache

bustCache: boolean

Optionally load texture with cache busting

data

data: HTMLImageElement

Populated once loading is complete

height

height: number

The height of the texture in pixels

loaded

loaded: Promise<HTMLImageElement> = new Promise<HTMLImageElement>(resolve => {this._loadedResolve = resolve;})

path

path: string

Path to the image resource or a base64 string representing an image "data:image/png;base64,iVB..."

width

width: number

The width of the texture in pixels

Accessors

image

  • get image(): HTMLImageElement

Methods

asSprite

isLoaded

  • isLoaded(): boolean

load

  • load(): Promise<HTMLImageElement>