Class SpriteImage

Texture that references a part of a larger texture by specifying an UV subset. When the sprite texture is rendererd only the portion of the texture specified by the UV subset will be rendered. This allows you to use the same texture for multiple sprites (texture atlasing). Sprite textures also allow you to specify sprite sheet animation by varying which portion of the UV is selected over time.

Hierarchy (view full)

Constructors

  • Creates a new sprite texture that references the entire area of the provided texture.

    Parameters

    Returns SpriteImage

Accessors

  • get frameHeight(): number
  • Returns height of a single animation frame sprite texture in pixels. If the texture has no animation this is the same as getHeight().

    Returns number

  • get frameWidth(): number
  • Returns width of a single animation frame sprite texture in pixels. If the texture has no animation this is the same as getWidth().

    Returns number

  • get height(): number
  • Returns height of the image texture in pixels.

    Returns number

  • get isDestroyed(): boolean
  • Determines if the resource is destroyed.

    Returns boolean

    This can happen when the Resource was forcefully unloaded or reverted. For this reason, it is safer to hold on to a instead of directly referencing a resource pointer, as the current Resource can always be retrieved via .value.

  • get name(): string
  • Name of the resource. Use primarily for easier identification and not important to the engine itself.

    Returns string

  • get offset(): Immutable<Vector2>
  • Determines the offset into the referenced texture where the texture sprite starts. The offset is in UV coordinates, in range [0, 1].

    Returns Immutable<Vector2>

  • set offset(value): void
  • Parameters

    Returns void

  • get referenceHeight(): number
  • Returns reference height of the image texture in pixels.

    Returns number

  • get referenceWidth(): number
  • Returns reference width of the image in pixels.

    Returns number

  • get texture(): Texture
  • Determines the internal texture that the image references.

    Returns Texture

  • set texture(value): void
  • Parameters

    Returns void

  • get uuid(): UUID
  • Returns a universally unique identifier of this resource.

    Returns UUID

  • get width(): number
  • Returns width of the image texture in pixels.

    Returns number

Methods

  • Duplicates the resource and creates a unique UUID for the duplicated resource.

    Returns Resource

    The duplicated resource or null, if the duplication failed.

  • Virtual

    Method called by RSX to perform actions required after the creation of the resource.

    Returns void

  • Virtual

    Method called by RSX to perform any operations needed after deserialization.

    Returns void

    Use this API to restore your serializable data into live objects.

  • Virtual

    Method called by RSX to disable the resource.

    Returns void

    Use this API to deactivate the resource before it is serialized.

  • Virtual

    Method called by RSX to enable the resource.

    Returns void

    Use this API to activate the resource after it has been disabled by serialization.

  • Virtual

    Method called by RSX to perform initialization of the resource.

    Returns void

    Use this API to initialize data and default construct all fields.

  • Virtual

    Method called by RSX to perform any operations before serialization.

    Returns void

    Use this API to bake your live data into serializable data.

  • Reverts the resource to the on-disk representation.

    Returns boolean

    This is a potentially expensive call, as it needs to deserialize and replace all existing in-memory resource handles.

  • Forcefully unloads the resource.

    Returns void