String source = element.getAttribute("source", null);
String imageSource = "";
int imageWidth = 0, imageHeight = 0;
FileHandle image = null;
if (source != null) {
FileHandle tsx = getRelativeFileHandle(tmxFile, source);
try {
element = xml.parse(tsx);
name = element.get("name", null);
tilewidth = element.getIntAttribute("tilewidth", 0);
tileheight = element.getIntAttribute("tileheight", 0);
spacing = element.getIntAttribute("spacing", 0);
margin = element.getIntAttribute("margin", 0);
imageSource = element.getChildByName("image").getAttribute("source");
imageWidth = element.getChildByName("image").getIntAttribute("width", 0);
imageHeight = element.getChildByName("image").getIntAttribute("height", 0);
} catch (IOException e) {
throw new GdxRuntimeException("Error parsing external tileset.");
}
} else {
imageSource = element.getChildByName("image").getAttribute("source");
imageWidth = element.getChildByName("image").getIntAttribute("width", 0);
imageHeight = element.getChildByName("image").getIntAttribute("height", 0);
}
if (!map.getProperties().containsKey("atlas")) {
throw new GdxRuntimeException("The map is missing the 'atlas' property");
}
// get the TextureAtlas for this tileset
FileHandle atlasHandle = getRelativeFileHandle(tmxFile, map.getProperties().get("atlas", String.class));
atlasHandle = resolve(atlasHandle.path());
TextureAtlas atlas = resolver.getAtlas(atlasHandle.path());
String regionsName = atlasHandle.nameWithoutExtension();
if (parameter != null && parameter.forceTextureFilters) {
for (Texture texture : atlas.getTextures()) {
trackedTextures.add(texture);
}