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);
}
use of com.badlogic.gdx.assets.AssetDescriptor in project libgdx by libgdx.
the class BitmapFontLoader method getDependencies.
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, BitmapFontParameter parameter) {
Array<AssetDescriptor> deps = new Array();
if (parameter != null && parameter.bitmapFontData != null) {
data = parameter.bitmapFontData;
return deps;
}
data = new BitmapFontData(file, parameter != null ? parameter.flip : false);
if (parameter != null && parameter.atlasName != null) {
deps.add(new AssetDescriptor(parameter.atlasName, TextureAtlas.class));
} else {
for (int i = 0; i < data.getImagePaths().length; i++) {
String path = data.getImagePath(i);
FileHandle resolved = resolve(path);
TextureLoader.TextureParameter textureParams = new TextureLoader.TextureParameter();
if (parameter != null) {
textureParams.genMipMaps = parameter.genMipMaps;
textureParams.minFilter = parameter.minFilter;
textureParams.magFilter = parameter.magFilter;
}
AssetDescriptor descriptor = new AssetDescriptor(resolved, Texture.class, textureParams);
deps.add(descriptor);
}
}
return deps;
}
use of com.badlogic.gdx.assets.AssetDescriptor in project libgdx by libgdx.
the class ModelLoader method getDependencies.
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, P parameters) {
final Array<AssetDescriptor> deps = new Array();
ModelData data = loadModelData(file, parameters);
if (data == null)
return deps;
ObjectMap.Entry<String, ModelData> item = new ObjectMap.Entry<String, ModelData>();
item.key = fileName;
item.value = data;
synchronized (items) {
items.add(item);
}
TextureLoader.TextureParameter textureParameter = (parameters != null) ? parameters.textureParameter : defaultParameters.textureParameter;
for (final ModelMaterial modelMaterial : data.materials) {
if (modelMaterial.textures != null) {
for (final ModelTexture modelTexture : modelMaterial.textures) deps.add(new AssetDescriptor(modelTexture.fileName, Texture.class, textureParameter));
}
}
return deps;
}
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, ParticleEffectParameter param) {
Array<AssetDescriptor> deps = null;
if (param != null && param.atlasFile != null) {
deps = new Array();
deps.add(new AssetDescriptor<TextureAtlas>(param.atlasFile, TextureAtlas.class));
}
return deps;
}
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;
}
Aggregations