class Atlas
package nb
Multiple images data container that can be packed into a single texture. Use it to avoid the usage of multiple textures.
Give it datas using the appropriate addX functions then use the make function to generate the texture.
All the useful datas of an image are contained in SubData instances.
0.1.0
.Constructor
Variables
makePOT:Bool = true
If true, the next texture generated will have its width and height be a power of two. This is good for GPUs.
preventTextureAutoDispose:Bool = false
If true, old texture will be disposed when a new one is generated.
remakeAtlasOnFileChange:Bool = true
When false, this instance is prevented from doing anything when a file changes.
Methods
addAseprite(aseprite:Ase, ?name:String, toFormat:PixelFormat = RGBA):Array<SubData>
Retrieve datas from an nb.Ase's instance and returns the SubData instance(s) made from it.
Parameters:
aseprite | |
|---|---|
name | A |
toFormat | The pixel format to convert the bytes of |
Returns:
An array of the SubData instance(s) made.
inlineaddBytes(bytes:Bytes, w:Int, h:Int, name:String, format:PixelFormat = PixelFormat.RGBA, ?toFormat:PixelFormat):SubData
Makes a SubData instance from the parameters and returns it.
Parameters:
bytes |
|
|---|---|
w | Width of the image. |
h | Height of the image. |
name | A name to assign to the |
format | Pixel format of |
toFormat | Pixel format to convert |
Returns:
The SubData instance made.
addImage(image:Image, ?name:String, ?toFormat:PixelFormat, ?flipY:Bool, ?index:Int):SubData
Retrieve datas from an hxd.Res.Image's instance and returns the SubData instance made from it.
Parameters:
image | The |
|---|---|
name | A name to assign to the |
toFormat | The pixel format to convert the bytes of |
flipY | Set to |
index | Index used to read image data from a Dds file. |
Returns:
The SubData instance made.
addPixels(pixels:Pixels, name:String, ?toFormat:PixelFormat):SubData
Retrieve datas from an hxd.Pixels's instance and returns the SubData instance made from it.
Parameters:
pixels | The |
|---|---|
name | The name to assign to the |
toFormat | The pixel format to convert the bytes of |
Returns:
The SubData instance made.
make(maxW:Int = 2048, maxH:Int = 2048, format:PixelFormat = PixelFormat.RGBA):Void
Generates a texture using the SubData instances.
Parameters:
maxW | Max width of the generated texture. If not a power of two and |
|---|---|
maxH | Max height of the generated texture. If not a power of two and |
format | Desired pixel format of |
onHotReload():Void
Called after a new texture was generated from file change.
Calls the onHotReload function of all objects in listeningObjects.