use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class TideMapLoader method getRelativeFileHandle.
private static FileHandle getRelativeFileHandle(FileHandle file, String path) {
StringTokenizer tokenizer = new StringTokenizer(path, "\\/");
FileHandle result = file.parent();
while (tokenizer.hasMoreElements()) {
String token = tokenizer.nextToken();
if (token.equals(".."))
result = result.parent();
else {
result = result.child(token);
}
}
return result;
}
use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class TmxMapLoader method getDependencies.
/** Retrieves TiledMap resource dependencies
*
* @param fileName
* @param parameter not used for now
* @return dependencies for the given .tmx file */
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle tmxFile, Parameters parameter) {
Array<AssetDescriptor> dependencies = new Array<AssetDescriptor>();
try {
root = xml.parse(tmxFile);
boolean generateMipMaps = (parameter != null ? parameter.generateMipMaps : false);
TextureLoader.TextureParameter texParams = new TextureParameter();
texParams.genMipMaps = generateMipMaps;
if (parameter != null) {
texParams.minFilter = parameter.textureMinFilter;
texParams.magFilter = parameter.textureMagFilter;
}
for (FileHandle image : loadTilesets(root, tmxFile)) {
dependencies.add(new AssetDescriptor(image, Texture.class, texParams));
}
for (FileHandle image : loadImages(root, tmxFile)) {
dependencies.add(new AssetDescriptor(image, Texture.class, texParams));
}
return dependencies;
} catch (IOException e) {
throw new GdxRuntimeException("Couldn't load tilemap '" + fileName + "'", e);
}
}
use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class Preloader method list.
public FileHandle[] list(String url, FilenameFilter filter) {
Array<FileHandle> files = new Array<FileHandle>();
for (String path : texts.keys()) {
if (isChild(path, url) && filter.accept(new File(url), path.substring(url.length() + 1))) {
files.add(new GwtFileHandle(this, path, FileType.Internal));
}
}
FileHandle[] list = new FileHandle[files.size];
System.arraycopy(files.items, 0, list, 0, list.length);
return list;
}
use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class Preloader method list.
public FileHandle[] list(String url, FileFilter filter) {
Array<FileHandle> files = new Array<FileHandle>();
for (String path : texts.keys()) {
if (isChild(path, url) && filter.accept(new File(path))) {
files.add(new GwtFileHandle(this, path, FileType.Internal));
}
}
FileHandle[] list = new FileHandle[files.size];
System.arraycopy(files.items, 0, list, 0, list.length);
return list;
}
use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class ResolutionFileResolver method resolve.
@Override
public FileHandle resolve(String fileName) {
Resolution bestResolution = choose(descriptors);
FileHandle originalHandle = new FileHandle(fileName);
FileHandle handle = baseResolver.resolve(resolve(originalHandle, bestResolution.folder));
if (!handle.exists())
handle = baseResolver.resolve(fileName);
return handle;
}
Aggregations