PokéRogue
    Preparing search index...

    Interface Texture

    Provides methods used for setting the texture and frame of a Game Object.

    This component is mixed in to Game Objects that support texture-based rendering, such as Sprites and Images. It allows a Game Object to reference a texture stored in the Texture Manager by key, and optionally a specific frame within that texture, as used with texture atlases and sprite sheets. Changing the texture or frame will automatically update the Game Object's size and origin to match.

    interface Texture {
        frame: Frame;
        texture: Texture | CanvasTexture;
        setFrame(
            frame: string | number | Frame,
            updateSize?: boolean,
            updateOrigin?: boolean,
        ): this;
        setTexture(
            key: string | Texture,
            frame?: string | number,
            updateSize?: boolean,
            updateOrigin?: boolean,
        ): this;
    }

    Implemented by

    Index
    frame: Frame

    The Texture Frame this Game Object is using to render with.

    The Texture this Game Object is using to render with.

    • Sets the frame this Game Object will use to render with.

      If you pass a string or index then the Frame has to belong to the current Texture being used by this Game Object.

      If you pass a Frame instance, then the Texture being used by this Game Object will also be updated.

      Calling setFrame will modify the width and height properties of your Game Object.

      It will also change the origin if the Frame has a custom pivot point, as exported from packages like Texture Packer.

      Parameters

      • frame: string | number | Frame

        The name or index of the frame within the Texture, or a Frame instance.

      • OptionalupdateSize: boolean

        Should this call adjust the size of the Game Object? Default true.

      • OptionalupdateOrigin: boolean

        Should this call adjust the origin of the Game Object? Default true.

      Returns this

      This Game Object instance.

    • Sets the texture and frame this Game Object will use to render with.

      Textures are referenced by their string-based keys, as stored in the Texture Manager.

      Calling this method will modify the width and height properties of your Game Object.

      It will also change the origin if the Frame has a custom pivot point, as exported from packages like Texture Packer.

      Parameters

      • key: string | Texture

        The key of the texture to be used, as stored in the Texture Manager, or a Texture instance.

      • Optionalframe: string | number

        The name or index of the frame within the Texture.

      • OptionalupdateSize: boolean

        Should this call adjust the size of the Game Object? Default true.

      • OptionalupdateOrigin: boolean

        Should this call change the origin of the Game Object? Default true.

      Returns this

      This Game Object instance.