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

public Class AtlasTmjMapLoader

extends BaseTmjMapLoader<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.TextureAtlas, .TextureAtlas.AtlasRegion, .TextureRegion, com.badlogic.gdx.maps.ImageResolver, .MapProperties, com.badlogic.gdx.utils.Array, .GdxRuntimeException, .JsonValue

A TiledMap Loader which loads tiles from a TextureAtlas instead of separate images. It requires a map-level property called 'atlas' with its value being the relative path to the TextureAtlas. The atlas must have in it indexed regions named after the tilesets used in the map. The indexes shall be local to the tileset (not the global id). Strip whitespace and rotation should not be used when creating the atlas.
Authors
Justin Shapcott, Manuel Bua

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static interface

Field Summary

Modifier and TypeField and Description
protected AtlasTmjMapLoader.AtlasResolver
protected Array<Texture>
Inherited from com.badlogic.gdx.maps.tiled.BaseTmjMapLoader:
jsonroottemplateCachetilesetPathsToGIDs

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected void
addStaticTiles(FileHandle tmjFile, ImageResolver imageResolver, TiledMapTileSet tileSet, JsonValue element, JsonValue tiles, 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.BaseTmjMapLoader.addStaticTiles.

protected FileHandle
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

public TiledMap
load(String fileName)

public TiledMap
public void
loadAsync(AssetManager manager, String fileName, FileHandle tmjFile, 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.

pack-priv static String

Returns:

The name of the region to pass into an atlas
parseRegionName
(String
Name to check
name
)

Parse incoming region name to check for 'atlas_imagelayer' within the String These are regions representing Image Layers that have been packed into the atlas ImageLayer Image names include the relative assets path, so it must be stripped.

protected void
Inherited from com.badlogic.gdx.maps.tiled.BaseTmjMapLoader:
cloneElementShallowcreateAnimatedTilegetDependenciesgetTileIdsloadBasicLayerInfoloadImageLayerloadLayerloadLayerGrouploadObjectloadObjectloadObjectloadObjectGrouploadTiledMaploadTileLayerloadTileSetmergeJsonObjectmergeJsonPropertiesmergeParentElementWithTemplateresolveTemplateObject

Field Detail

atlasResolverback to summary
protected AtlasTmjMapLoader.AtlasResolver atlasResolver
trackedTexturesback to summary
protected Array<Texture> trackedTextures

Constructor Detail

AtlasTmjMapLoaderback to summary
public AtlasTmjMapLoader()
AtlasTmjMapLoaderback to summary
public AtlasTmjMapLoader(FileHandleResolver resolver)

Method Detail

addStaticTilesback to summary
protected void addStaticTiles(FileHandle tmjFile, ImageResolver imageResolver, TiledMapTileSet tileSet, JsonValue element, JsonValue tiles, 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.BaseTmjMapLoader.addStaticTiles.

Annotations
@Override
getAtlasFileHandleback to summary
protected FileHandle getAtlasFileHandle(FileHandle tmjFile)
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
loadback to summary
public TiledMap load(String fileName)
loadback to summary
public TiledMap load(String fileName, BaseTiledMapLoader.Parameters parameter)
loadAsyncback to summary
public void loadAsync(AssetManager manager, String fileName, FileHandle tmjFile, 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
parseRegionNameback to summary
pack-priv static String parseRegionName(String name)

Parse incoming region name to check for 'atlas_imagelayer' within the String These are regions representing Image Layers that have been packed into the atlas ImageLayer Image names include the relative assets path, so it must be stripped.

Parameters
name:String

Name to check

Returns:String

The name of the region to pass into an atlas

setTextureFiltersback to summary
protected void setTextureFilters(Texture.TextureFilter min, Texture.TextureFilter mag)
com.badlogic.gdx.maps.tiled back to summary

protected Interface AtlasTmjMapLoader.AtlasResolver

extends ImageResolver
Known Direct Implementers
com.badlogic.gdx.maps.tiled.AtlasTmjMapLoader.AtlasResolver.DirectAtlasResolver, com.badlogic.gdx.maps.tiled.AtlasTmjMapLoader.AtlasResolver.AssetManagerAtlasResolver

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Method Summary

Modifier and TypeMethod and Description
public TextureAtlas
Inherited from com.badlogic.gdx.maps.ImageResolver:
getImage

Method Detail

getAtlasback to summary
public TextureAtlas getAtlas()
com.badlogic.gdx.maps.tiled back to summary

public Class AtlasTmjMapLoader.AtlasResolver.AssetManagerAtlasResolver

extends Object
implements AtlasResolver
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.maps.tiled.AtlasTmjMapLoader.AtlasResolver.AssetManagerAtlasResolver
All Implemented Interfaces
com.badlogic.gdx.maps.tiled.AtlasTmjMapLoader.AtlasResolver, com.badlogic.gdx.maps.ImageResolver

Field Summary

Modifier and TypeField and Description
private final AssetManager
private final String

Constructor Summary

AccessConstructor and Description
public

Field Detail

assetManagerback to summary
private final AssetManager assetManager
atlasNameback to summary
private final String atlasName

Constructor Detail

AssetManagerAtlasResolverback to summary
public AssetManagerAtlasResolver(AssetManager assetManager, String atlasName)
com.badlogic.gdx.maps.tiled back to summary

public Class AtlasTmjMapLoader.AtlasResolver.DirectAtlasResolver

extends Object
implements AtlasResolver
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.maps.tiled.AtlasTmjMapLoader.AtlasResolver.DirectAtlasResolver
All Implemented Interfaces
com.badlogic.gdx.maps.tiled.AtlasTmjMapLoader.AtlasResolver, com.badlogic.gdx.maps.ImageResolver

Field Summary

Modifier and TypeField and Description
private final TextureAtlas

Constructor Summary

AccessConstructor and Description
public

Field Detail

atlasback to summary
private final TextureAtlas atlas

Constructor Detail

DirectAtlasResolverback to summary
public DirectAtlasResolver(TextureAtlas atlas)