|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.graphics.g2d.TextureAtlas
public class TextureAtlas
Loads images from texture atlases created by TexturePacker.
A TextureAtlas must be disposed to free up the resources consumed by the backing textures.
Nested Class Summary | |
---|---|
static class |
TextureAtlas.AtlasRegion
Describes the region of a packed image and provides information about the original image before it was packed. |
static class |
TextureAtlas.AtlasSprite
A sprite that, if whitespace was stripped from the region when it was packed, is automatically positioned as if whitespace had not been stripped. |
static class |
TextureAtlas.TextureAtlasData
|
Constructor Summary | |
---|---|
TextureAtlas()
Creates an empty atlas to which regions can be added. |
|
TextureAtlas(FileHandle packFile)
Loads the specified pack file, using the parent directory of the pack file to find the page images. |
|
TextureAtlas(FileHandle packFile,
boolean flip)
|
|
TextureAtlas(FileHandle packFile,
FileHandle imagesDir)
|
|
TextureAtlas(FileHandle packFile,
FileHandle imagesDir,
boolean flip)
|
|
TextureAtlas(java.lang.String internalPackFile)
Loads the specified pack file using Files.FileType.Internal , using the parent directory of the pack file to find the page
images. |
|
TextureAtlas(TextureAtlas.TextureAtlasData data)
|
Method Summary | |
---|---|
TextureAtlas.AtlasRegion |
addRegion(java.lang.String name,
Texture texture,
int x,
int y,
int width,
int height)
Adds a region to the atlas. |
TextureAtlas.AtlasRegion |
addRegion(java.lang.String name,
TextureRegion textureRegion)
Adds a region to the atlas. |
Sprite |
createSprite(java.lang.String name)
Returns the first region found with the specified name as a sprite. |
Sprite |
createSprite(java.lang.String name,
int index)
Returns the first region found with the specified name and index as a sprite. |
java.util.List<Sprite> |
createSprites()
Returns all regions in the atlas as sprites. |
java.util.List<Sprite> |
createSprites(java.lang.String name)
Returns all regions with the specified name as sprites, ordered by smallest to largest index . |
void |
dispose()
Releases all resources associated with this TextureAtlas instance. |
TextureAtlas.AtlasRegion |
findRegion(java.lang.String name)
Returns the first region found with the specified name. |
TextureAtlas.AtlasRegion |
findRegion(java.lang.String name,
int index)
Returns the first region found with the specified name and index. |
java.util.List<TextureAtlas.AtlasRegion> |
findRegions(java.lang.String name)
Returns all regions with the specified name, ordered by smallest to largest index . |
java.util.List<TextureAtlas.AtlasRegion> |
getRegions()
Returns all regions in the atlas. |
java.util.Set<Texture> |
getTextures()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextureAtlas()
public TextureAtlas(java.lang.String internalPackFile)
Files.FileType.Internal
, using the parent directory of the pack file to find the page
images.
public TextureAtlas(FileHandle packFile)
public TextureAtlas(FileHandle packFile, boolean flip)
flip
- If true, all regions loaded will be flipped for use with a perspective where 0,0 is the upper left corner.TextureAtlas(FileHandle)
public TextureAtlas(FileHandle packFile, FileHandle imagesDir)
public TextureAtlas(FileHandle packFile, FileHandle imagesDir, boolean flip)
flip
- If true, all regions loaded will be flipped for use with a perspective where 0,0 is the upper left corner.public TextureAtlas(TextureAtlas.TextureAtlasData data)
Method Detail |
---|
public TextureAtlas.AtlasRegion addRegion(java.lang.String name, Texture texture, int x, int y, int width, int height)
public TextureAtlas.AtlasRegion addRegion(java.lang.String name, TextureRegion textureRegion)
public java.util.List<TextureAtlas.AtlasRegion> getRegions()
public TextureAtlas.AtlasRegion findRegion(java.lang.String name)
public TextureAtlas.AtlasRegion findRegion(java.lang.String name, int index)
public java.util.List<TextureAtlas.AtlasRegion> findRegions(java.lang.String name)
index
. This method
uses string comparison to find the regions, so the result should be cached rather than calling this method multiple times.
public java.util.List<Sprite> createSprites()
createSprite(String)
public Sprite createSprite(java.lang.String name)
public Sprite createSprite(java.lang.String name, int index)
createSprite(String)
public java.util.List<Sprite> createSprites(java.lang.String name)
index
. This
method uses string comparison to find the regions and constructs new sprites, so the result should be cached rather than
calling this method multiple times.
createSprite(String)
public java.util.Set<Texture> getTextures()
public void dispose()
dispose
in interface Disposable
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |