drawTexture

fun Canvas.drawTexture(texture: Texture2D, x: Int, y: Int, tint: Color = Color.WHITE)

Draws a texture on the canvas at the specified position with an optional tint color.

Parameters

texture

The texture to draw.

x

The X coordinate where the texture will be drawn.

y

The X coordinate where the texture will be drawn.

tint

The color to tint the texture. Default is white (no tint).


fun Canvas.drawTexture(texture: Texture2D, x: Float, y: Float, tint: Color = Color.WHITE)

Draws a texture on the canvas at the specified position with an optional tint color.

Parameters

texture

The texture to draw.

x

The X coordinate where the texture will be drawn.

y

The Y coordinate where the texture will be drawn.

tint

The color to tint the texture. Default is white (no tint).


fun Canvas.drawTexture(texture: Texture2D, x: Float, y: Float, rotation: Float, scale: Float = 1.0f, tint: Color = Color.WHITE)

Draws a texture on the canvas at the specified position with rotation, scale, and optional tint color.

Parameters

texture

The texture to draw.

x

The X coordinate where the texture will be drawn.

y

The Y coordinate where the texture will be drawn.

rotation

The rotation of the sprite in degrees.

scale

The scale of the sprite. Default is 1.0 (no scale).

tint

The color to tint the texture. Default is white (no tint).


fun Canvas.drawTexture(texture: Texture2D, x: Int, y: Int, rotation: Float, scale: Float = 1.0f, tint: Color = Color.WHITE)

Draws a texture on the canvas at the specified position with rotation, scale, and an optional tint color.

Parameters

texture

The texture to draw.

x

The X coordinate where the texture will be drawn.

y

The Y coordinate where the texture will be drawn.

rotation

The rotation angle in degrees.

scale

The scale factor. Default is 1.0f (no scaling).

tint

The color to tint the texture. Default is white (no tint).


fun Canvas.drawTexture(texture: Texture2D, x: Int, y: Int, rotation: Float, centerX: Int = 0, centerY: Int = 0, scale: Float = 1.0f, tint: Color = Color.WHITE)
fun Canvas.drawTexture(texture: Texture2D, x: Float, y: Float, rotation: Float, centerX: Float = 0.0f, centerY: Float = 0.0f, scale: Float = 1.0f, tint: Color = Color.WHITE)

Draws a texture on the canvas at the specified position.

Parameters

texture

The texture to draw.

x

The X coordinate where the texture will be drawn.

y

The Y coordinate where the texture will be drawn.

rotation

The rotation of the sprite in degrees.

centerX

The X delta of the origin where transformations are calculated, relative to x.

centerY

The Y delta of the origin where transformations are calcualted, relative to y.

scale

The scale of the sprite. Default is 1.0 (no scale).

tint

The color to tint the texture. Default is white (no tint).