public class TmxMapLoader extends BaseTmxMapLoader<TmxMapLoader.Parameters>
Modifier and Type | Class and Description |
---|---|
static class |
TmxMapLoader.Parameters |
convertObjectToTileSpace, FLAG_FLIP_DIAGONALLY, FLAG_FLIP_HORIZONTALLY, FLAG_FLIP_VERTICALLY, flipY, map, mapHeightInPixels, mapTileHeight, mapTileWidth, mapWidthInPixels, MASK_CLEAR, root, xml
Constructor and Description |
---|
TmxMapLoader() |
TmxMapLoader(FileHandleResolver resolver)
Creates loader
|
Modifier and Type | Method and Description |
---|---|
Array<AssetDescriptor> |
getDependencies(java.lang.String fileName,
FileHandle tmxFile,
TmxMapLoader.Parameters parameter)
Retrieves TiledMap resource dependencies
|
TiledMap |
load(java.lang.String fileName)
Loads the
TiledMap from the given file. |
TiledMap |
load(java.lang.String fileName,
TmxMapLoader.Parameters parameters)
Loads the
TiledMap 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.
|
protected Array<FileHandle> |
loadImages(XmlReader.Element root,
FileHandle tmxFile)
Loads the images in image layers
|
TiledMap |
loadSync(AssetManager manager,
java.lang.String fileName,
FileHandle file,
TmxMapLoader.Parameters parameter)
Loads the OpenGL part of the asset.
|
protected TiledMap |
loadTilemap(XmlReader.Element root,
FileHandle tmxFile,
ImageResolver imageResolver)
Loads the map data, given the XML root element and an
ImageResolver used to return the tileset Textures |
protected void |
loadTileSet(TiledMap map,
XmlReader.Element element,
FileHandle tmxFile,
ImageResolver imageResolver)
Loads the specified tileset data, adding it to the collection of the specified map, given the XML element, the tmxFile and
an
ImageResolver used to retrieve the tileset Textures. |
protected Array<FileHandle> |
loadTilesets(XmlReader.Element root,
FileHandle tmxFile)
Loads the tilesets
|
createTileLayerCell, getRelativeFileHandle, getTileIds, loadBasicLayerInfo, loadImageLayer, loadObject, loadObjectGroup, loadProperties, loadTileLayer, unsignedByteToInt
resolve
public TmxMapLoader()
public TmxMapLoader(FileHandleResolver resolver)
resolver
- public TiledMap load(java.lang.String fileName)
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.fileName
- the filenamepublic TiledMap load(java.lang.String fileName, TmxMapLoader.Parameters parameters)
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.fileName
- the filenameparameters
- specifies whether to use y-up, generate mip maps etc.public void loadAsync(AssetManager manager, java.lang.String fileName, FileHandle tmxFile, TmxMapLoader.Parameters parameter)
AsynchronousAssetLoader
loadAsync
in class AsynchronousAssetLoader<TiledMap,TmxMapLoader.Parameters>
fileName
- the name of the asset to loadtmxFile
- the resolved file to loadparameter
- the parameters to use for loading the assetpublic TiledMap loadSync(AssetManager manager, java.lang.String fileName, FileHandle file, TmxMapLoader.Parameters parameter)
AsynchronousAssetLoader
loadSync
in class AsynchronousAssetLoader<TiledMap,TmxMapLoader.Parameters>
file
- the resolved file to loadpublic Array<AssetDescriptor> getDependencies(java.lang.String fileName, FileHandle tmxFile, TmxMapLoader.Parameters parameter)
getDependencies
in class AssetLoader<TiledMap,TmxMapLoader.Parameters>
fileName
- parameter
- not used for nowtmxFile
- the resolved file to loadprotected TiledMap loadTilemap(XmlReader.Element root, FileHandle tmxFile, ImageResolver imageResolver)
ImageResolver
used to return the tileset Texturesroot
- the XML root elementtmxFile
- the Filehandle of the tmx fileimageResolver
- the ImageResolver
TiledMap
protected Array<FileHandle> loadTilesets(XmlReader.Element root, FileHandle tmxFile) throws java.io.IOException
root
- the root XML elementjava.io.IOException
protected Array<FileHandle> loadImages(XmlReader.Element root, FileHandle tmxFile) throws java.io.IOException
root
- the root XML elementjava.io.IOException
protected void loadTileSet(TiledMap map, XmlReader.Element element, FileHandle tmxFile, ImageResolver imageResolver)
ImageResolver
used to retrieve the tileset Textures.
Default tileset's property keys that are loaded by default are:
The values are extracted from the specified Tmx file, if a value can't be found then the default is used.
map
- the Map whose tilesets collection will be populatedelement
- the XML element identifying the tileset to loadtmxFile
- the Filehandle of the tmx fileimageResolver
- the ImageResolver