/** May return null. */ protected FileHandle loadAtlas (Element root, FileHandle tmxFile) throws IOException { Element e = root.getChildByName("properties"); if (e != null) { for (Element property : e.getChildrenByName("property")) { String name = property.getAttribute("name", null); String value = property.getAttribute("value", null); if (name.equals("atlas")) { if (value == null) { value = property.getText(); } if (value == null || value.length() == 0) { // keep trying until there are no more atlas properties continue; } return getRelativeFileHandle(tmxFile, value); } } } FileHandle atlasFile = tmxFile.sibling(tmxFile.nameWithoutExtension() + ".atlas"); return atlasFile.exists() ? atlasFile : null; }
/** May return null. */ protected FileHandle loadAtlas (Element root, FileHandle tmxFile) throws IOException { Element e = root.getChildByName("properties"); if (e != null) { for (Element property : e.getChildrenByName("property")) { String name = property.getAttribute("name", null); String value = property.getAttribute("value", null); if (name.equals("atlas")) { if (value == null) { value = property.getText(); } if (value == null || value.length() == 0) { // keep trying until there are no more atlas properties continue; } return getRelativeFileHandle(tmxFile, value); } } } FileHandle atlasFile = tmxFile.sibling(tmxFile.nameWithoutExtension() + ".atlas"); return atlasFile.exists() ? atlasFile : null; }
@Override public Array<AssetDescriptor> getDependencies (String fileName, FileHandle tmxFile, AtlasTiledMapLoaderParameters parameter) { Array<AssetDescriptor> dependencies = new Array<AssetDescriptor>(); try { root = xml.parse(tmxFile); Element properties = root.getChildByName("properties"); if (properties != null) { for (Element property : properties.getChildrenByName("property")) { String name = property.getAttribute("name"); String value = property.getAttribute("value"); if (name.startsWith("atlas")) { FileHandle atlasHandle = getRelativeFileHandle(tmxFile, value); dependencies.add(new AssetDescriptor(atlasHandle, TextureAtlas.class)); } } } } catch (SerializationException e) { throw new GdxRuntimeException("Unable to parse .tmx file."); } return dependencies; }
@Override public Array<AssetDescriptor> getDependencies (String fileName, FileHandle tmxFile, AtlasTiledMapLoaderParameters parameter) { Array<AssetDescriptor> dependencies = new Array<AssetDescriptor>(); try { root = xml.parse(tmxFile); Element properties = root.getChildByName("properties"); if (properties != null) { for (Element property : properties.getChildrenByName("property")) { String name = property.getAttribute("name"); String value = property.getAttribute("value"); if (name.startsWith("atlas")) { FileHandle atlasHandle = getRelativeFileHandle(tmxFile, value); dependencies.add(new AssetDescriptor(atlasHandle, TextureAtlas.class)); } } } } catch (SerializationException e) { throw new GdxRuntimeException("Unable to parse .tmx file."); } return dependencies; }
FileHandle tsx = getRelativeFileHandle(tmxFile, source); try { element = xml.parse(tsx); imageWidth = imageElement.getIntAttribute("width", 0); imageHeight = imageElement.getIntAttribute("height", 0); image = getRelativeFileHandle(tsx, imageSource); imageWidth = imageElement.getIntAttribute("width", 0); imageHeight = imageElement.getIntAttribute("height", 0); image = getRelativeFileHandle(tmxFile, imageSource); FileHandle atlasHandle = getRelativeFileHandle(tmxFile, atlasFilePath); atlasHandle = resolve(atlasHandle.path()); TextureAtlas atlas = resolver.getAtlas(atlasHandle.path());
FileHandle tsx = getRelativeFileHandle(tmxFile, source); try { element = xml.parse(tsx); imageWidth = imageElement.getIntAttribute("width", 0); imageHeight = imageElement.getIntAttribute("height", 0); image = getRelativeFileHandle(tsx, imageSource); imageWidth = imageElement.getIntAttribute("width", 0); imageHeight = imageElement.getIntAttribute("height", 0); image = getRelativeFileHandle(tmxFile, imageSource); FileHandle atlasHandle = getRelativeFileHandle(tmxFile, atlasFilePath); atlasHandle = resolve(atlasHandle.path()); TextureAtlas atlas = resolver.getAtlas(atlasHandle.path());
/** May return null. */ protected FileHandle loadAtlas (Element root, FileHandle tmxFile) throws IOException { Element e = root.getChildByName("properties"); if (e != null) { for (Element property : e.getChildrenByName("property")) { String name = property.getAttribute("name", null); String value = property.getAttribute("value", null); if (name.equals("atlas")) { if (value == null) { value = property.getText(); } if (value == null || value.length() == 0) { // keep trying until there are no more atlas properties continue; } return getRelativeFileHandle(tmxFile, value); } } } FileHandle atlasFile = tmxFile.sibling(tmxFile.nameWithoutExtension() + ".atlas"); return atlasFile.exists() ? atlasFile : null; }
@Override public Array<AssetDescriptor> getDependencies (String fileName, FileHandle tmxFile, AtlasTiledMapLoaderParameters parameter) { Array<AssetDescriptor> dependencies = new Array<AssetDescriptor>(); try { root = xml.parse(tmxFile); Element properties = root.getChildByName("properties"); if (properties != null) { for (Element property : properties.getChildrenByName("property")) { String name = property.getAttribute("name"); String value = property.getAttribute("value"); if (name.startsWith("atlas")) { FileHandle atlasHandle = getRelativeFileHandle(tmxFile, value); dependencies.add(new AssetDescriptor(atlasHandle, TextureAtlas.class)); } } } } catch (SerializationException e) { throw new GdxRuntimeException("Unable to parse .tmx file."); } return dependencies; }
FileHandle tsx = getRelativeFileHandle(tmxFile, source); try { element = xml.parse(tsx); imageWidth = imageElement.getIntAttribute("width", 0); imageHeight = imageElement.getIntAttribute("height", 0); image = getRelativeFileHandle(tsx, imageSource); imageWidth = imageElement.getIntAttribute("width", 0); imageHeight = imageElement.getIntAttribute("height", 0); image = getRelativeFileHandle(tmxFile, imageSource); FileHandle atlasHandle = getRelativeFileHandle(tmxFile, atlasFilePath); atlasHandle = resolve(atlasHandle.path()); TextureAtlas atlas = resolver.getAtlas(atlasHandle.path());