Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AssetLoader

Upgrade to Pixi's resource loader capable of handling all types of assets commonly used in games and importing them for easy use.

Hierarchy

  • AssetLoader

Index

Constructors

constructor

Properties

textureStore

textureStore: TextureStore

Methods

load

  • load(loader: Loader): Promise<boolean>
  • Loads the queued assets and registers them in the appropriate stores.

    throws

    {Error} Thrown when loading was already started.

    Parameters

    • loader: Loader

      Loader instance to use. In most cases you just want to pass the static PIXI Loader.

    Returns Promise<boolean>

    A promise that resolves when all of the operations are finishes successfully. Value of the promise will always be true.

queuePixiAutoFont

  • queuePixiAutoFont(name: string, fontXmlUrl: string): void
  • Parameters

    • name: string
    • fontXmlUrl: string

    Returns void

queueSheet

  • queueSheet(imageUrl: string, sheetJson: ObjectKeymap, prefix?: string): void
  • Queues a spritesheet to be loaded. Every sprite in the sheet will be registered in the TextureStore with the name of the sprite, optionally prefixed.

    throws

    {Error} Thrown when loading was already started.

    Parameters

    • imageUrl: string

      URL pointing to the image to load for the spritesheet.

    • sheetJson: ObjectKeymap

      PIXI.SpriteSheet's format of data

    • Default value prefix: string = ""

      Optional prefix which is added before every frame's name when loading it into TextureStore.

    Returns void

queueTexture

  • queueTexture(name: string, imageUrl: string): void
  • Queues a texture to be loaded and registered in the TextureStore.

    throws

    {Error} Thrown when loading was already started.

    Parameters

    • name: string

      Name by which the texture will be registered in TextureStore.

    • imageUrl: string

      URL pointing to the image to load.

    Returns void

queueTileset

  • Queues a tileset to be registed in TextureStore.

    throws

    {Error} Thrown when loading was already started.

    Parameters

    • name: string

      Name of the texture to use as a base for the tileset - it may be a separately loaded texture or one of spritesheet's frames.

    • config: TilesetTextureConfig

      Tileset configuration.

    Returns void

Generated using TypeDoc