public class TmxMapLoader extends SynchronousAssetLoader<TiledMap,TmxMapLoader.Parameters>
| Modifier and Type | Class and Description |
|---|---|
static class |
TmxMapLoader.Parameters |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
FLAG_FLIP_DIAGONALLY |
protected static int |
FLAG_FLIP_HORIZONTALLY |
protected static int |
FLAG_FLIP_VERTICALLY |
protected int |
mapHeightInPixels |
protected int |
mapWidthInPixels |
protected static int |
MASK_CLEAR |
protected XmlReader.Element |
root |
protected XmlReader |
xml |
protected boolean |
yUp |
| Constructor and Description |
|---|
TmxMapLoader() |
TmxMapLoader(FileHandleResolver resolver)
Creates loader
|
| Modifier and Type | Method and Description |
|---|---|
Array<AssetDescriptor> |
getDependencies(java.lang.String fileName,
TmxMapLoader.Parameters parameter)
Retrieves TiledMap resource dependencies
|
protected static FileHandle |
getRelativeFileHandle(FileHandle file,
java.lang.String path) |
TiledMap |
load(AssetManager assetManager,
java.lang.String fileName,
TmxMapLoader.Parameters parameter) |
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. |
protected void |
loadObject(MapLayer layer,
XmlReader.Element element) |
protected void |
loadObjectGroup(TiledMap map,
XmlReader.Element element) |
protected void |
loadProperties(MapProperties properties,
XmlReader.Element element) |
protected void |
loadTileLayer(TiledMap map,
XmlReader.Element element) |
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
|
protected static int |
unsignedByteToInt(byte b) |
resolveprotected static final int FLAG_FLIP_HORIZONTALLY
protected static final int FLAG_FLIP_VERTICALLY
protected static final int FLAG_FLIP_DIAGONALLY
protected static final int MASK_CLEAR
protected XmlReader xml
protected XmlReader.Element root
protected boolean yUp
protected int mapWidthInPixels
protected int mapHeightInPixels
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 TiledMap load(AssetManager assetManager, java.lang.String fileName, TmxMapLoader.Parameters parameter)
load in class SynchronousAssetLoader<TiledMap,TmxMapLoader.Parameters>public Array<AssetDescriptor> getDependencies(java.lang.String fileName, TmxMapLoader.Parameters parameter)
getDependencies in class AssetLoader<TiledMap,TmxMapLoader.Parameters>fileName - parameter - not used for nowprotected 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 ImageResolverTiledMapprotected Array<FileHandle> loadTilesets(XmlReader.Element root, FileHandle tmxFile) throws java.io.IOException
root - the root XML elementjava.io.IOExceptionprotected 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 ImageResolverprotected void loadTileLayer(TiledMap map, XmlReader.Element element)
protected void loadObjectGroup(TiledMap map, XmlReader.Element element)
protected void loadObject(MapLayer layer, XmlReader.Element element)
protected void loadProperties(MapProperties properties, XmlReader.Element element)
protected static FileHandle getRelativeFileHandle(FileHandle file, java.lang.String path)
protected static int unsignedByteToInt(byte b)