Package com.badlogic.gdx.maps.tiled
Class AtlasTmxMapLoader
- java.lang.Object
-
- com.badlogic.gdx.assets.loaders.AssetLoader<T,P>
-
- com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader<TiledMap,P>
-
- com.badlogic.gdx.maps.tiled.BaseTmxMapLoader<AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
-
- com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader
-
public class AtlasTmxMapLoader extends BaseTmxMapLoader<AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
A TiledMap Loader which loads tiles from a TextureAtlas instead of separate images. It requires a map-level property called 'atlas' with its value being the relative path to the TextureAtlas. The atlas must have in it indexed regions named after the tilesets used in the map. The indexes shall be local to the tileset (not the global id). Strip whitespace and rotation should not be used when creating the atlas.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
AtlasTmxMapLoader.AtlasResolver
static class
AtlasTmxMapLoader.AtlasTiledMapLoaderParameters
-
Nested classes/interfaces inherited from class com.badlogic.gdx.maps.tiled.BaseTmxMapLoader
BaseTmxMapLoader.Parameters
-
-
Field Summary
Fields Modifier and Type Field Description protected AtlasTmxMapLoader.AtlasResolver
atlasResolver
protected Array<Texture>
trackedTextures
-
Fields inherited from class com.badlogic.gdx.maps.tiled.BaseTmxMapLoader
convertObjectToTileSpace, FLAG_FLIP_DIAGONALLY, FLAG_FLIP_HORIZONTALLY, FLAG_FLIP_VERTICALLY, flipY, idToObject, map, mapHeightInPixels, mapTileHeight, mapTileWidth, mapWidthInPixels, MASK_CLEAR, root, runOnEndOfLoadTiled, xml
-
-
Constructor Summary
Constructors Constructor Description AtlasTmxMapLoader()
AtlasTmxMapLoader(FileHandleResolver resolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addStaticTiles(FileHandle tmxFile, ImageResolver imageResolver, TiledMapTileSet tileSet, XmlReader.Element element, Array<XmlReader.Element> tileElements, java.lang.String name, int firstgid, int tilewidth, int tileheight, int spacing, int margin, java.lang.String source, int offsetX, int offsetY, java.lang.String imageSource, int imageWidth, int imageHeight, FileHandle image)
protected FileHandle
getAtlasFileHandle(FileHandle tmxFile)
protected Array<AssetDescriptor>
getDependencyAssetDescriptors(FileHandle tmxFile, TextureLoader.TextureParameter textureParameter)
TiledMap
load(java.lang.String fileName)
TiledMap
load(java.lang.String fileName, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
void
loadAsync(AssetManager manager, java.lang.String fileName, FileHandle tmxFile, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.TiledMap
loadSync(AssetManager manager, java.lang.String fileName, FileHandle file, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
Loads the OpenGL part of the asset.protected void
setTextureFilters(Texture.TextureFilter min, Texture.TextureFilter mag)
-
Methods inherited from class com.badlogic.gdx.maps.tiled.BaseTmxMapLoader
addStaticTiledMapTile, addTileObjectGroup, addTileProperties, castProperty, createAnimatedTile, createTileLayerCell, getDependencies, getIdToObject, getRelativeFileHandle, getTileIds, loadBasicLayerInfo, loadImageLayer, loadLayer, loadLayerGroup, loadObject, loadObject, loadObject, loadObjectGroup, loadProperties, loadTiledMap, loadTileLayer, loadTileSet, unsignedByteToInt
-
Methods inherited from class com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader
unloadAsync
-
Methods inherited from class com.badlogic.gdx.assets.loaders.AssetLoader
resolve
-
-
-
-
Field Detail
-
atlasResolver
protected AtlasTmxMapLoader.AtlasResolver atlasResolver
-
-
Constructor Detail
-
AtlasTmxMapLoader
public AtlasTmxMapLoader()
-
AtlasTmxMapLoader
public AtlasTmxMapLoader(FileHandleResolver resolver)
-
-
Method Detail
-
load
public TiledMap load(java.lang.String fileName)
-
load
public TiledMap load(java.lang.String fileName, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
-
loadAsync
public void loadAsync(AssetManager manager, java.lang.String fileName, FileHandle tmxFile, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
Description copied from class:AsynchronousAssetLoader
Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.- Specified by:
loadAsync
in classAsynchronousAssetLoader<TiledMap,AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
fileName
- the name of the asset to loadtmxFile
- the resolved file to loadparameter
- the parameters to use for loading the asset
-
loadSync
public TiledMap loadSync(AssetManager manager, java.lang.String fileName, FileHandle file, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
Description copied from class:AsynchronousAssetLoader
Loads the OpenGL part of the asset.- Specified by:
loadSync
in classAsynchronousAssetLoader<TiledMap,AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
file
- the resolved file to load
-
getDependencyAssetDescriptors
protected Array<AssetDescriptor> getDependencyAssetDescriptors(FileHandle tmxFile, TextureLoader.TextureParameter textureParameter)
- Specified by:
getDependencyAssetDescriptors
in classBaseTmxMapLoader<AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
-
addStaticTiles
protected void addStaticTiles(FileHandle tmxFile, ImageResolver imageResolver, TiledMapTileSet tileSet, XmlReader.Element element, Array<XmlReader.Element> tileElements, java.lang.String name, int firstgid, int tilewidth, int tileheight, int spacing, int margin, java.lang.String source, int offsetX, int offsetY, java.lang.String imageSource, int imageWidth, int imageHeight, FileHandle image)
- Specified by:
addStaticTiles
in classBaseTmxMapLoader<AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
-
getAtlasFileHandle
protected FileHandle getAtlasFileHandle(FileHandle tmxFile)
-
setTextureFilters
protected void setTextureFilters(Texture.TextureFilter min, Texture.TextureFilter mag)
-
-