class spinehx.atlas.TextureAtlas
Available on all platforms
Loads images from texture atlases created by TexturePacker.
*
* A TextureAtlas must be disposed to free up the resources consumed by the backing textures.
* @author Nathan Sweet
Class Fields
static function create(packFileData:String, imagesDir:String, textureLoader:TextureLoader, ?flip:Bool = false):TextureAtlas
flip | If true, all regions loaded will be flipped for use with a perspective where 0,0 is the upper left corner. |
Instance Fields
function addRegion(name:String, texture:Texture, x:Int, y:Int, width:Int, height:Int):AtlasRegion
Adds a region to the atlas. The specified texture will be disposed when the atlas is disposed.
function addRegionTex(name:String, textureRegion:TextureRegion):AtlasRegion
Adds a region to the atlas. The texture for the specified region will be disposed when the atlas is disposed.
Releases all resources associated with this TextureAtlas instance. This releases all the textures backing all TextureRegions * and Sprites, which should no longer be used after calling dispose.
function findRegion(name:String):AtlasRegion
Returns the first region found with the specified name. This method uses string comparison to find the region, so the result * should be cached rather than calling this method multiple times. *
returns | The region, or null. |
function findRegionIdx(name:String, index:Int):AtlasRegion
Returns the first region found with the specified name and index. This method uses string comparison to find the region, so * the result should be cached rather than calling this method multiple times. *
returns | The region, or null. |
function findRegions(name:String):Array<AtlasRegion>
Returns all regions with the specified name, ordered by smallest to largest {@link AtlasRegion#index index}. This method * uses string comparison to find the regions, so the result should be cached rather than calling this method multiple times.