com.badlogic.gdx.maps.tiled
Class AtlasTmxMapLoader

java.lang.Object
  extended by com.badlogic.gdx.assets.loaders.AssetLoader<T,P>
      extended by com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader<TiledMap,AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
          extended by com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader

public class AtlasTmxMapLoader
extends AsynchronousAssetLoader<TiledMap,AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>

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.

Author:
Justin Shapcott, Manuel Bua

Nested Class Summary
static class AtlasTmxMapLoader.AtlasTiledMapLoaderParameters
           
 
Constructor Summary
AtlasTmxMapLoader()
           
AtlasTmxMapLoader(FileHandleResolver resolver)
           
 
Method Summary
 Array<AssetDescriptor> getDependencies(String fileName, FileHandle tmxFile, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
          Returns the assets this asset requires to be loaded first.
static FileHandle getRelativeFileHandle(FileHandle file, String path)
           
 TiledMap load(String fileName)
           
 TiledMap load(String fileName, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
           
 void loadAsync(AssetManager manager, String fileName, FileHandle tmxFile, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
          Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.
 TiledMap loadSync(AssetManager manager, String fileName, FileHandle file, AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
          Loads the OpenGL part of the asset.
 
Methods inherited from class com.badlogic.gdx.assets.loaders.AssetLoader
resolve
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtlasTmxMapLoader

public AtlasTmxMapLoader()

AtlasTmxMapLoader

public AtlasTmxMapLoader(FileHandleResolver resolver)
Method Detail

load

public TiledMap load(String fileName)

getDependencies

public Array<AssetDescriptor> getDependencies(String fileName,
                                              FileHandle tmxFile,
                                              AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
Description copied from class: AssetLoader
Returns the assets this asset requires to be loaded first. This method may be called on a thread other than the GL thread.

Specified by:
getDependencies in class AssetLoader<TiledMap,AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
Parameters:
fileName - name of the asset to load
tmxFile - the resolved file to load
parameter - parameters for loading the asset
Returns:
other assets that the asset depends on and need to be loaded first or null if there are no dependencies.

load

public TiledMap load(String fileName,
                     AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)

loadAsync

public void loadAsync(AssetManager manager,
                      String fileName,
                      FileHandle tmxFile,
                      AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
Description copied from class: AsynchronousAssetLoader
Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.

Specified by:
loadAsync in class AsynchronousAssetLoader<TiledMap,AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
fileName - the name of the asset to load
tmxFile - the resolved file to load
parameter - the parameters to use for loading the asset

loadSync

public TiledMap loadSync(AssetManager manager,
                         String fileName,
                         FileHandle file,
                         AtlasTmxMapLoader.AtlasTiledMapLoaderParameters parameter)
Description copied from class: AsynchronousAssetLoader
Loads the OpenGL part of the asset.

Specified by:
loadSync in class AsynchronousAssetLoader<TiledMap,AtlasTmxMapLoader.AtlasTiledMapLoaderParameters>
file - the resolved file to load

getRelativeFileHandle

public static FileHandle getRelativeFileHandle(FileHandle file,
                                               String path)


Copyright © 2013. All Rights Reserved.