Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

Hierarchy

Index

Constructors

constructor

  • new TextureBase<type>(type: "image", dataType: DataType, texture: HTMLImageElement, w: number, h: number): TextureBase<type>
  • new TextureBase<type>(type: "color", dataType: DataType, texture: string, w: number, h: number): TextureBase<type>
  • new TextureBase<type>(type: "either", dataType: DataType, texture: string | HTMLImageElement, w: number, h: number): TextureBase<type>

Properties

Readonly dataType

dataType: DataType
memberof

TextureBase

description

The data type of texture, 'sheet' | 'base' | 'atlas' | 'list'

since

2.1.0

Readonly id

id: string
memberof

TextureBase

description

The unique identifier for the texture

since

2.1.0

scale

scale: Vector2
memberof

Texture

description

The scale of the texture

since

2.1.0

texture

texture: type extends "image" ? HTMLImageElement : type extends "either" ? string | HTMLImageElement : string
memberof

TextureBase

description

The texture itself, can be an image or color

since

2.1.0

type

memberof

TextureBase

description

The type of texture source, 'image' | 'color' | 'either'

since

2.1.0

Methods

setFillColor

  • setFillColor(color: string | number): void
  • memberof

    Texture

    description

    Sets the Texture color if the type is color

    since

    2.1.0

    Parameters

    • color: string | number

      New color of the texture

    Returns void

setImagePath

  • setImagePath(imagePath: string): void
  • memberof

    Texture

    description

    Sets the Texture Image Path if the type is image

    since

    2.1.0

    Parameters

    • imagePath: string

      New imagePath of the texture

    Returns void

setScale

Static fromColor

  • fromColor(color: string, w: number, h: number): TextureBase<"color">
  • memberof

    TextureBase

    description

    Creates a new TextureBase instance from a color

    static
    since

    2.1.0

    Parameters

    • color: string

      Color

    • w: number

      Width

    • h: number

      Height

    Returns TextureBase<"color">

Static fromEither

  • fromEither(fillColorOrIMGPath: string, w: number, h: number): TextureBase<"either">
  • memberof

    TextureBase

    description

    Creates a new TextureBase instance from a color or an image path

    static
    since

    2.1.0

    Parameters

    • fillColorOrIMGPath: string

      Color or Image path

    • w: number

      Width

    • h: number

      Height

    Returns TextureBase<"either">

Static fromTexture

  • fromTexture(imgpath: string, w: number, h: number): TextureBase<"image">
  • memberof

    TextureBase

    description

    Creates a new TextureBase instance from an image path

    static
    since

    2.1.0

    Parameters

    • imgpath: string

      Image path

    • w: number

      Width

    • h: number

      Height

    Returns TextureBase<"image">

Generated using TypeDoc