APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.maps.tiled

public Class TmxMapLoader

extends BaseTmxMapLoader<BaseTiledMapLoader.Parameters>
Class Inheritance
Imports
com.badlogic.gdx.assets.AssetDescriptor, .AssetManager, com.badlogic.gdx.assets.loaders.FileHandleResolver, .TextureLoader, com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver, com.badlogic.gdx.files.FileHandle, com.badlogic.gdx.graphics.Texture, com.badlogic.gdx.graphics.g2d.TextureRegion, com.badlogic.gdx.maps.ImageResolver, .ImageResolver.AssetManagerImageResolver, .ImageResolver.DirectImageResolver, .MapProperties, com.badlogic.gdx.utils.Array, .ObjectMap, .XmlReader.Element

@brief synchronous loader for TMX maps created with the Tiled tool

Field Summary

Inherited from com.badlogic.gdx.maps.tiled.BaseTmxMapLoader:
roottemplateCachetilesetPathsToGIDsxml

Constructor Summary

AccessConstructor and Description
public
public
TmxMapLoader(FileHandleResolver resolver)

Creates loader

Method Summary

Modifier and TypeMethod and Description
protected void
addStaticTiles(FileHandle tmxFile, ImageResolver imageResolver, TiledMapTileSet tileSet, XmlReader.Element element, Array<XmlReader.Element> tileElements, String name, int firstgid, int tilewidth, int tileheight, int spacing, int margin, int offsetX, int offsetY, String imageSource, int imageWidth, int imageHeight, FileHandle image)

Implements abstract com.badlogic.gdx.maps.tiled.BaseTmxMapLoader.addStaticTiles.

protected Array<AssetDescriptor<T>>
getDependencyAssetDescriptors(FileHandle tmxFile, TextureLoader.TextureParameter textureParameter)

Implements abstract com.badlogic.gdx.maps.tiled.BaseTiledMapLoader.getDependencyAssetDescriptors.

Meant to be called within getDependencies() of a child class

protected Array<FileHandle>
protected Array<FileHandle>
protected Array<FileHandle>
public TiledMap

Returns:

the TiledMap
load
(String
the filename
fileName
)

Loads the TiledMap from the given file.

public TiledMap

Returns:

the TiledMap
load
(String
the filename
fileName
,
BaseTiledMapLoader.Parameters
specifies whether to use y-up, generate mip maps etc.
parameter
)

Loads the TiledMap from the given file.

public void
loadAsync(AssetManager manager, String fileName, FileHandle tmxFile, BaseTiledMapLoader.Parameters parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadAsync.

Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.

public TiledMap
loadSync(AssetManager manager, String fileName, FileHandle file, BaseTiledMapLoader.Parameters parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadSync.

Loads the OpenGL part of the asset.

public TiledMapTileSet

Returns:

the TiledMapTileSet
loadTileset
(String
the filename
fileName
)

Loads the TiledMapTileSet from the given file.

public TiledMapTileSet

Returns:

the TiledMapTileSet
loadTileset
(String
the filename
fileName
,
BaseTiledMapLoader.Parameters
specifies whether to use y-up, generate mip maps etc.
parameter
)

Loads the TiledMapTileSet from the given file.

Inherited from com.badlogic.gdx.maps.tiled.BaseTmxMapLoader:
addTileObjectGroupaddTilePropertiescloneElementShallowcreateAnimatedTilegetDependenciesgetPropertyByNamegetTileIdsloadBasicLayerInfoloadClassPropertiesloadImageLayerloadLayerloadLayerGrouploadObjectloadObjectloadObjectloadObjectGrouploadPropertiesloadTiledMaploadTileLayerloadTileSetmergeParentElementWithTemplatemergePropertiesresolveTemplateObject

Constructor Detail

TmxMapLoaderback to summary
public TmxMapLoader()
TmxMapLoaderback to summary
public TmxMapLoader(FileHandleResolver resolver)

Creates loader

Method Detail

addStaticTilesback to summary
protected void addStaticTiles(FileHandle tmxFile, ImageResolver imageResolver, TiledMapTileSet tileSet, XmlReader.Element element, Array<XmlReader.Element> tileElements, String name, int firstgid, int tilewidth, int tileheight, int spacing, int margin, int offsetX, int offsetY, String imageSource, int imageWidth, int imageHeight, FileHandle image)

Implements abstract com.badlogic.gdx.maps.tiled.BaseTmxMapLoader.addStaticTiles.

Annotations
@Override
getDependencyAssetDescriptorsback to summary
protected Array<AssetDescriptor<T>> getDependencyAssetDescriptors(FileHandle tmxFile, TextureLoader.TextureParameter textureParameter)

Implements abstract com.badlogic.gdx.maps.tiled.BaseTiledMapLoader.getDependencyAssetDescriptors.

Doc from com.badlogic.gdx.maps.tiled.BaseTiledMapLoader.getDependencyAssetDescriptors.

Meant to be called within getDependencies() of a child class

Annotations
@Override
getDependencyFileHandlesback to summary
protected Array<FileHandle> getDependencyFileHandles(FileHandle tmxFile)
getTileSetDependencyFileHandleback to summary
protected Array<FileHandle> getTileSetDependencyFileHandle(FileHandle tmxFile, XmlReader.Element tileset)
getTileSetDependencyFileHandleback to summary
protected Array<FileHandle> getTileSetDependencyFileHandle(Array<FileHandle> fileHandles, FileHandle tmxFile, XmlReader.Element tileset)
loadback to summary
public TiledMap load(String fileName)

Loads the TiledMap from the given file. The file is resolved via the FileHandleResolver 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:String

the filename

Returns:TiledMap

the TiledMap

loadback to summary
public TiledMap load(String fileName, BaseTiledMapLoader.Parameters parameter)

Loads the TiledMap from the given file. The file is resolved via the FileHandleResolver set in the constructor of this class. By default it will resolve to an internal file.

Parameters
fileName:String

the filename

parameter:BaseTiledMapLoader.Parameters

specifies whether to use y-up, generate mip maps etc.

Returns:TiledMap

the TiledMap

loadAsyncback to summary
public void loadAsync(AssetManager manager, String fileName, FileHandle tmxFile, BaseTiledMapLoader.Parameters parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadAsync.

Doc from com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadAsync.

Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.

Annotations
@Override
loadSyncback to summary
public TiledMap loadSync(AssetManager manager, String fileName, FileHandle file, BaseTiledMapLoader.Parameters parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadSync.

Doc from com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadSync.

Loads the OpenGL part of the asset.

Annotations
@Override
loadTilesetback to summary
public TiledMapTileSet loadTileset(String fileName)

Loads the TiledMapTileSet from the given file. The file is resolved via the FileHandleResolver 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:String

the filename

Returns:TiledMapTileSet

the TiledMapTileSet

loadTilesetback to summary
public TiledMapTileSet loadTileset(String fileName, BaseTiledMapLoader.Parameters parameter)

Loads the TiledMapTileSet from the given file. The file is resolved via the FileHandleResolver set in the constructor of this class. By default it will resolve to an internal file.

Parameters
fileName:String

the filename

parameter:BaseTiledMapLoader.Parameters

specifies whether to use y-up, generate mip maps etc.

Returns:TiledMapTileSet

the TiledMapTileSet