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

public abstract Class BaseTiledMapLoader<P extends BaseTiledMapLoader.Parameters>

extends AsynchronousAssetLoader<TiledMap, P extends BaseTiledMapLoader.Parameters>
Class Inheritance
Known Direct Subclasses
com.badlogic.gdx.maps.tiled.BaseTmjMapLoader, com.badlogic.gdx.maps.tiled.BaseTmxMapLoader
Imports
com.badlogic.gdx.Gdx, com.badlogic.gdx.assets.AssetDescriptor, .AssetLoaderParameters, com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader, .FileHandleResolver, .TextureLoader, com.badlogic.gdx.files.FileHandle, com.badlogic.gdx.graphics.Color, .Texture, com.badlogic.gdx.graphics.g2d.TextureRegion, com.badlogic.gdx.maps.ImageResolver, .MapObject, .MapProperties, com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile, com.badlogic.gdx.utils.Array, .GdxRuntimeException, .IntMap, .JsonReader, .JsonValue, .Null, .ObjectMap, java.util.StringTokenizer

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
protected static class
BaseTiledMapLoader.ProjectClassMember

Representation of a single Tiled class property.

Field Summary

Modifier and TypeField and Description
protected boolean
protected static final int
protected static final int
protected static final int
protected boolean
protected IntMap<MapObject>
protected TiledMap
protected int
protected int
protected int
protected int
protected static final int
protected ObjectMap<String, Array<BaseTiledMapLoader.ProjectClassMember>>
projectClassInfo

Optional Tiled project class information.

protected Array<Runnable>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
addStaticTiledMapTile(TiledMapTileSet tileSet, TextureRegion textureRegion, int tileId, float offsetX, float offsetY)

protected Object
castProperty(String name, String value, String type)

protected TiledMapTileLayer.Cell
createTileLayerCell(boolean flipHorizontally, boolean flipVertically, boolean flipDiagonally)

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

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

public IntMap<MapObject>

Returns:

the map of the ids to MapObject, or null if loadTiledMap(FileHandle, Parameters, ImageResolver) method has not been called yet.
getIdToObject
()

Gets a map of the object ids to the MapObject instances.

protected static FileHandle
protected void
loadBasicProperty(MapProperties properties, String name, String value, String type)

protected void
loadJsonClassProperties(String className, MapProperties classProperties, JsonValue classElement)

protected void
protected void
loadObjectProperty(final MapProperties properties, final String name, String value)

protected void
loadProjectFile(String projectFilePath)

Parses the given Tiled project file for class property information.

protected abstract TiledMap

Returns:

the TiledMap
loadTiledMap
(FileHandle
the Filehandle of the map file, .tmx or .tmj supported
mapFile
,
P parameter, ImageResolver imageResolver)

Loads the map data, given the root element

public static String

Returns:

A String representing the color in the #RRGGBBAA format
tiledColorToLibGDXColor
(String
A String representing a color in Tiled's #AARRGGBB format
tiledColor
)

Converts Tiled's color format #AARRGGBB to a libGDX appropriate #RRGGBBAA The Tiled Map Editor uses the color format #AARRGGBB But note, if the alpha of the color is set to 255, Tiled does not include it as part of the color code in the .tmx ex.

protected static int
Inherited from com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader:
loadAsyncloadSyncunloadAsync

Field Detail

convertObjectToTileSpaceback to summary
protected boolean convertObjectToTileSpace
FLAG_FLIP_DIAGONALLYback to summary
protected static final int FLAG_FLIP_DIAGONALLY
FLAG_FLIP_HORIZONTALLYback to summary
protected static final int FLAG_FLIP_HORIZONTALLY
FLAG_FLIP_VERTICALLYback to summary
protected static final int FLAG_FLIP_VERTICALLY
flipYback to summary
protected boolean flipY
idToObjectback to summary
protected IntMap<MapObject> idToObject
mapback to summary
protected TiledMap map
mapHeightInPixelsback to summary
protected int mapHeightInPixels
mapTileHeightback to summary
protected int mapTileHeight
mapTileWidthback to summary
protected int mapTileWidth
mapWidthInPixelsback to summary
protected int mapWidthInPixels
MASK_CLEARback to summary
protected static final int MASK_CLEAR
projectClassInfoback to summary
protected ObjectMap<String, Array<BaseTiledMapLoader.ProjectClassMember>> projectClassInfo

Optional Tiled project class information. Key is the classname and value is an array of class members (=class properties)

runOnEndOfLoadTiledback to summary
protected Array<Runnable> runOnEndOfLoadTiled

Constructor Detail

BaseTiledMapLoaderback to summary
public BaseTiledMapLoader(FileHandleResolver resolver)

Method Detail

addStaticTiledMapTileback to summary
protected void addStaticTiledMapTile(TiledMapTileSet tileSet, TextureRegion textureRegion, int tileId, float offsetX, float offsetY)
castPropertyback to summary
protected Object castProperty(String name, String value, String type)
createTileLayerCellback to summary
protected TiledMapTileLayer.Cell createTileLayerCell(boolean flipHorizontally, boolean flipVertically, boolean flipDiagonally)
getDependencyAssetDescriptorsback to summary
protected abstract Array<AssetDescriptor<T>> getDependencyAssetDescriptors(FileHandle mapFile, TextureLoader.TextureParameter textureParameter)

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

getIdToObjectback to summary
public IntMap<MapObject> getIdToObject()

Gets a map of the object ids to the MapObject instances. Returns null if loadTiledMap(FileHandle, Parameters, ImageResolver) has not been called yet.

Returns:IntMap<MapObject>

the map of the ids to MapObject, or null if loadTiledMap(FileHandle, Parameters, ImageResolver) method has not been called yet.

Annotations
@Null
getRelativeFileHandleback to summary
protected static FileHandle getRelativeFileHandle(FileHandle file, String path)
loadBasicPropertyback to summary
protected void loadBasicProperty(MapProperties properties, String name, String value, String type)
loadJsonClassPropertiesback to summary
protected void loadJsonClassProperties(String className, MapProperties classProperties, JsonValue classElement)
loadMapPropertiesClassDefaultsback to summary
protected void loadMapPropertiesClassDefaults(String className, MapProperties mapProperties)
loadObjectPropertyback to summary
protected void loadObjectProperty(final MapProperties properties, final String name, String value)
loadProjectFileback to summary
protected void loadProjectFile(String projectFilePath)

Parses the given Tiled project file for class property information. A class can have multiple members. Refer to ProjectClassMember.

loadTiledMapback to summary
protected abstract TiledMap loadTiledMap(FileHandle mapFile, P parameter, ImageResolver imageResolver)

Loads the map data, given the root element

Parameters
mapFile:FileHandle

the Filehandle of the map file, .tmx or .tmj supported

Returns:TiledMap

the TiledMap

tiledColorToLibGDXColorback to summary
public static String tiledColorToLibGDXColor(String tiledColor)

Converts Tiled's color format #AARRGGBB to a libGDX appropriate #RRGGBBAA The Tiled Map Editor uses the color format #AARRGGBB But note, if the alpha of the color is set to 255, Tiled does not include it as part of the color code in the .tmx ex. Red (r:255,g:0,b:0,a:255) becomes #ff0000, Red (r:255,g:0,b:0,a:127) becomes #7fff0000

Parameters
tiledColor:String

A String representing a color in Tiled's #AARRGGBB format

Returns:String

A String representing the color in the #RRGGBBAA format

unsignedByteToIntback to summary
protected static int unsignedByteToInt(byte b)
com.badlogic.gdx.maps.tiled back to summary

public Class BaseTiledMapLoader.Parameters

extends AssetLoaderParameters<TiledMap>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public boolean
convertObjectToTileSpace

Whether to convert the objects' pixel position and size to the equivalent in tile space.

public boolean
flipY

Whether to flip all Y coordinates so that Y positive is up.

public boolean
forceTextureFilters

force texture filters?

public boolean
generateMipMaps

generate mipmaps?

public String
projectFilePath

Path to Tiled project file.

public Texture.TextureFilter
textureMagFilter

The TextureFilter to use for magnification

public Texture.TextureFilter
textureMinFilter

The TextureFilter to use for minification

Inherited from com.badlogic.gdx.assets.AssetLoaderParameters:
loadedCallback

Constructor Summary

AccessConstructor and Description
public

Field Detail

convertObjectToTileSpaceback to summary
public boolean convertObjectToTileSpace

Whether to convert the objects' pixel position and size to the equivalent in tile space.

flipYback to summary
public boolean flipY

Whether to flip all Y coordinates so that Y positive is up. All libGDX renderers require flipped Y coordinates, and thus flipY set to true. This parameter is included for non-rendering related purposes of TMX files, or custom renderers.

forceTextureFiltersback to summary
public boolean forceTextureFilters

force texture filters?

generateMipMapsback to summary
public boolean generateMipMaps

generate mipmaps?

projectFilePathback to summary
public String projectFilePath

Path to Tiled project file. Needed when using class properties.

textureMagFilterback to summary
public Texture.TextureFilter textureMagFilter

The TextureFilter to use for magnification

textureMinFilterback to summary
public Texture.TextureFilter textureMinFilter

The TextureFilter to use for minification

Constructor Detail

Parametersback to summary
public Parameters()
com.badlogic.gdx.maps.tiled back to summary

protected Class BaseTiledMapLoader.ProjectClassMember

extends Object
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.maps.tiled.BaseTiledMapLoader.ProjectClassMember

Representation of a single Tiled class property. A property has:

Field Summary

Modifier and TypeField and Description
public JsonValue
public String
public String
public String

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

defaultValueback to summary
public JsonValue defaultValue
nameback to summary
public String name
propertyTypeback to summary
public String propertyType
typeback to summary
public String type

Constructor Detail

ProjectClassMemberback to summary
protected ProjectClassMember()

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override