use of com.badlogic.gdx.assets.AssetDescriptor in project libgdx by libgdx.
the class TextureAtlasLoader method getDependencies.
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle atlasFile, TextureAtlasParameter parameter) {
FileHandle imgDir = atlasFile.parent();
if (parameter != null)
data = new TextureAtlasData(atlasFile, imgDir, parameter.flip);
else {
data = new TextureAtlasData(atlasFile, imgDir, false);
}
Array<AssetDescriptor> dependencies = new Array();
for (Page page : data.getPages()) {
TextureParameter params = new TextureParameter();
params.format = page.format;
params.genMipMaps = page.useMipMaps;
params.minFilter = page.minFilter;
params.magFilter = page.magFilter;
dependencies.add(new AssetDescriptor(page.textureFile, Texture.class, params));
}
return dependencies;
}
use of com.badlogic.gdx.assets.AssetDescriptor in project libgdx by libgdx.
the class ParticleEffectLoader method getDependencies.
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, ParticleEffectLoadParameter parameter) {
Json json = new Json();
ResourceData<ParticleEffect> data = json.fromJson(ResourceData.class, file);
Array<AssetData> assets = null;
synchronized (items) {
ObjectMap.Entry<String, ResourceData<ParticleEffect>> entry = new ObjectMap.Entry<String, ResourceData<ParticleEffect>>();
entry.key = fileName;
entry.value = data;
items.add(entry);
assets = data.getAssets();
}
Array<AssetDescriptor> descriptors = new Array<AssetDescriptor>();
for (AssetData<?> assetData : assets) {
// If the asset doesn't exist try to load it from loading effect directory
if (!resolve(assetData.filename).exists()) {
assetData.filename = file.parent().child(Gdx.files.internal(assetData.filename).name()).path();
}
if (assetData.type == ParticleEffect.class) {
descriptors.add(new AssetDescriptor(assetData.filename, assetData.type, parameter));
} else
descriptors.add(new AssetDescriptor(assetData.filename, assetData.type));
}
return descriptors;
}
use of com.badlogic.gdx.assets.AssetDescriptor in project libgdx by libgdx.
the class TiledMapAtlasAssetManagerTest method create.
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 10, 10);
camera.zoom = 2;
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
AtlasTiledMapLoaderParameters params = new AtlasTiledMapLoaderParameters();
params.forceTextureFilters = true;
params.textureMinFilter = TextureFilter.Linear;
params.textureMagFilter = TextureFilter.Linear;
assetManager = new AssetManager();
assetManager.setErrorListener(new AssetErrorListener() {
@Override
public void error(AssetDescriptor asset, Throwable throwable) {
errorMessage = throwable.getMessage();
}
});
assetManager.setLoader(TiledMap.class, new AtlasTmxMapLoader(new InternalFileHandleResolver()));
assetManager.load(fileName, TiledMap.class);
}
Aggregations