Class for packing multiple images in big one and generating frame data for each of them so you can easily load regions of atlas in sprites and tilemaps as a source of graphic
new(name:String, powerOfTwo:Bool = false, border:Int = 1, rotate:Bool = false, ?minSize:FlxPoint, ?maxSize:FlxPoint)
The name of this atlas. It will be used for caching
Whether the size of this atlas should be the power of 2 or not.
Gap between nodes to insert.
Whether to rotate added images for less atlas size.
Min size of atlas.
Max size of atlas.
Whether this atlas should stay in memory after state switch.
Default value if
Adds a new node to the atlas.
Newly created and added node, or
null if there is no space for it.
addNodeWithSpacesAndBorders(Graphic:FlxGraphicSource, ?Key:String, tileSize:FlxPoint, tileSpacing:FlxPoint, ?tileBorder:FlxPoint, ?region:FlxRect):FlxTileFrames
Optional key for image
The size of tile in spritesheet
Offsets to add in spritesheet between tiles
Border to add around tiles (helps to avoid "tearing" problem)
Region of source image to use as a source graphic
FlxTileFrames for the added node
Clears all data in atlas. Use it when you want reuse this atlas. WARNING: it will destroy the graphic of this image, so you can get null pointer exceptions if you're still using it for your sprites.
Creates a new "queue" for adding new nodes.
This method should be used with the
- first, you create queue, like
- second, you add several bitmaps to the queue:
atlas.addToQueue(bmd1, "key1").addToQueue(bmd2, "key2");
- third, you actually bake those bitmaps onto the atlas:
Destroys the atlas. Use only if you want to clear memory and don't need this atlas anymore,
since it disposes the
BitmapData and removes it from the cache.
Adds all objects in "queue" to existing atlas. Doesn't remove any nodes.
Gets a node by it's name.
Node name to search for.
node with searched name.
null if atlas doesn't contain any node with that name.