List of usage examples for com.badlogic.gdx.graphics.g2d TextureAtlas TextureAtlas
public TextureAtlas(FileHandle packFile, FileHandle imagesDir, boolean flip)
From source file:com.weimingtom.iteye.simplerpg.tiled.TileAtlas.java
License:Apache License
/** Creates a TileAtlas for use with {@link TileMapRenderer}. Run the map through TiledMapPacker to create the files required. * @param map The tiled map//ww w . j av a 2 s . c o m * @param inputDir The directory containing all the files created by TiledMapPacker */ public TileAtlas(TiledMap map, FileHandle inputDir) { // TODO: Create a constructor that doesn't take a tmx map, for (TileSet set : map.tileSets) { FileHandle packfile = getRelativeFileHandle(inputDir, removeExtension(set.imageName) + " packfile"); TextureAtlas textureAtlas = new TextureAtlas(packfile, packfile.parent(), false); Array<AtlasRegion> atlasRegions = textureAtlas.findRegions(removeExtension(removePath(set.imageName))); for (AtlasRegion reg : atlasRegions) { regionsMap.put(reg.index + set.firstgid, reg); if (!textures.contains(reg.getTexture())) { textures.add(reg.getTexture()); } } } }