Fork me on GitHub
View source

package haxepunk.graphics.atlas

class AtlasData

Constructor

View source

new (texture : Texture, name : String) : Void

Creates a new AtlasData class

NOTE: Only create one instance of AtlasData per name. An error will be thrown if you try to create a duplicate.


Parameters:
texture   

Texture image to use for rendering

name   

A reference to the image data, used with destroy and for setting rendering flags

Variables

read only height : Int

read only width : Int

Functions

View source

createRegion (rect : Rectangle, center : Vector2) : AtlasRegion

Creates a new AtlasRegion


Parameters:
rect   

Defines the rectangle of the tile on the tilesheet

center   

Positions the local center point to pivot on (not used)


Returns:

The new AtlasRegion object.

View source

prepareTile (rect : Rectangle, tx : Float, ty : Float, scaleX : Float, scaleY : Float, angle : Float, color : Color, alpha : Float, shader : Shader, smooth : Bool, blend : BlendMode, clipRect : Rectangle, flexibleLayer : Bool = false) : Void

Prepares a tile to be drawn


Parameters:
rect   

The source rectangle to draw

x   

The x-axis value

y   

The y-axis value

scaleX   

X-Axis scale

scaleY   

Y-Axis scale

angle   

Angle (in degrees)

red   

Red color value

green   

Green color value

blue   

Blue color value

alpha   

Alpha value

View source

prepareTileMatrix (rect : Rectangle, tx : Float, ty : Float, a : Float, b : Float, c : Float, d : Float, color : Color, alpha : Float, shader : Shader, smooth : Bool = false, blend : BlendMode, clipRect : Rectangle, flexibleLayer : Bool = false) : Void

Prepares a tile to be drawn using a matrix


Parameters:
rect   

The source rectangle to draw

tx   

X-Axis translation

ty   

Y-Axis translation

a   

Top-left

b   

Top-right

c   

Bottom-left

d   

Bottom-right

red   

Red color value

green   

Green color value

blue   

Blue color value

alpha   

Alpha value

View source

prepareTriangle (tx1 : Float, ty1 : Float, uvx1 : Float, uvy1 : Float, tx2 : Float, ty2 : Float, uvx2 : Float, uvy2 : Float, tx3 : Float, ty3 : Float, uvx3 : Float, uvy3 : Float, color : Color, alpha : Float, shader : Shader, smooth : Bool, blend : BlendMode, clipRect : Rectangle, flexibleLayer : Bool = false) : Void

Prepares a triangle draw command


Parameters:
tx1   

The first vertex x position

ty1   

The first vertex y position

uvx1   

The first vertex uv x coord (0-1)

uvy1   

The first vertex uv y coord (0-1)

tx2   

The second vertex x position

ty2   

The second vertex y position

uvx2   

The second vertex uv x coord (0-1)

uvy2   

The second vertex uv y coord (0-1)

tx3   

The third vertex x position

ty3   

The third vertex y position

uvx3   

The third vertex uv x coord (0-1)

uvy3   

The third vertex uv y coord (0-1)

red   

Red color value

green   

Green color value

blue   

Blue color value

alpha   

Alpha value

shader   

Shader to use for rendering

smooth   

Enables linear smoothing on texture

blend   

Blend mode to use for rendering

clipRect   

The rectangle used for clipping

View source

toString () : String

String representation of AtlasData


Returns:

the name of the AtlasData