Package com.badlogic.gdx.maps.tiled
Class TmxMapLoader
- 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<TmxMapLoader.Parameters>
-
- com.badlogic.gdx.maps.tiled.TmxMapLoader
-
public class TmxMapLoader extends BaseTmxMapLoader<TmxMapLoader.Parameters>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TmxMapLoader.Parameters
-
Field Summary
-
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 TmxMapLoader()
TmxMapLoader(FileHandleResolver resolver)
Creates loader
-
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 Array<AssetDescriptor>
getDependencyAssetDescriptors(FileHandle tmxFile, TextureLoader.TextureParameter textureParameter)
protected Array<FileHandle>
getDependencyFileHandles(FileHandle tmxFile)
TiledMap
load(java.lang.String fileName)
Loads theTiledMap
from the given file.TiledMap
load(java.lang.String fileName, TmxMapLoader.Parameters parameter)
Loads theTiledMap
from the given file.void
loadAsync(AssetManager manager, java.lang.String fileName, FileHandle tmxFile, TmxMapLoader.Parameters 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, TmxMapLoader.Parameters parameter)
Loads the OpenGL part of the asset.-
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
-
-
-
-
Constructor Detail
-
TmxMapLoader
public TmxMapLoader()
-
TmxMapLoader
public TmxMapLoader(FileHandleResolver resolver)
Creates loader- Parameters:
resolver
-
-
-
Method Detail
-
load
public TiledMap load(java.lang.String fileName)
Loads theTiledMap
from the given file. The file is resolved via theFileHandleResolver
set in the constructor of this class. By default it will resolve to an internal file. The map will be loaded for a y-up coordinate system.- Parameters:
fileName
- the filename- Returns:
- the TiledMap
-
load
public TiledMap load(java.lang.String fileName, TmxMapLoader.Parameters parameter)
Loads theTiledMap
from the given file. The file is resolved via theFileHandleResolver
set in the constructor of this class. By default it will resolve to an internal file.- Parameters:
fileName
- the filenameparameter
- specifies whether to use y-up, generate mip maps etc.- Returns:
- the TiledMap
-
loadAsync
public void loadAsync(AssetManager manager, java.lang.String fileName, FileHandle tmxFile, TmxMapLoader.Parameters 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,TmxMapLoader.Parameters>
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, TmxMapLoader.Parameters parameter)
Description copied from class:AsynchronousAssetLoader
Loads the OpenGL part of the asset.- Specified by:
loadSync
in classAsynchronousAssetLoader<TiledMap,TmxMapLoader.Parameters>
file
- the resolved file to load
-
getDependencyAssetDescriptors
protected Array<AssetDescriptor> getDependencyAssetDescriptors(FileHandle tmxFile, TextureLoader.TextureParameter textureParameter)
- Specified by:
getDependencyAssetDescriptors
in classBaseTmxMapLoader<TmxMapLoader.Parameters>
-
getDependencyFileHandles
protected Array<FileHandle> getDependencyFileHandles(FileHandle tmxFile)
-
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<TmxMapLoader.Parameters>
-
-