Options
All
  • Public
  • Public/Protected
  • All
Menu

Base resource class for textures that manages validation and uploading, depending on its type.

Uploading of a base texture to the GPU is required.

memberof

PIXI

Hierarchy

Index

Constructors

constructor

  • new Resource(width?: number, height?: number): Resource
  • Parameters

    • Optional width: number
    • Optional height: number

    Returns Resource

Properties

Protected _height

_height: number

Protected _width

_width: number

destroyed

destroyed: boolean

internal

internal: boolean

Protected onError

onError: Runner

Protected onResize

onResize: Runner

Protected onUpdate

onUpdate: Runner

Accessors

height

  • get height(): number
  • The height of the resource.

    member

    {number}

    readonly

    Returns number

valid

  • get valid(): boolean
  • Has been validated

    readonly
    member

    {boolean}

    Returns boolean

width

  • get width(): number
  • The width of the resource.

    member

    {number}

    readonly

    Returns number

Methods

bind

destroy

  • destroy(): void
  • Call when destroying resource, unbind any BaseTexture object before calling this method, as reference counts are maintained internally.

    Returns void

Protected dispose

  • dispose(): void
  • Clean up anything, this happens when destroying is ready.

    Returns void

Protected load

  • This can be overridden to start preloading a resource or do any other prepare step.

    Returns Promise<Resource>

    Handle the validate event

resize

  • resize(width: number, height: number): void
  • Trigger a resize event

    Parameters

    • width: number

      X dimension

    • height: number

      Y dimension

    Returns void

style

unbind

update

  • update(): void
  • Has been updated trigger event

    Returns void

Abstract upload

  • Uploads the texture or returns false if it cant for some reason. Override this.

    Parameters

    Returns boolean

    true is success

Static test

  • test(_source: unknown, _extension?: string): boolean
  • Abstract, used to auto-detect resource type

    static

    Parameters

    • _source: unknown
    • Optional _extension: string

    Returns boolean

Generated using TypeDoc