Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

Creates a DuckEngine Texture

description

The Texture Class. Stores images and colors in a class

since

2.0.0

Type parameters

Hierarchy

Index

Constructors

constructor

  • new Texture<type>(type: Duck.Types.Texture.Type, texture: type extends "image" ? HTMLImageElement : type extends "either" ? string | HTMLImageElement : string, w: number, h: number): Texture<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

setImagePath

  • setImagePath(imagePath: string): void

setScale

Static fromColor

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

Static fromEither

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

Static fromTexture

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

Generated using TypeDoc