com.talosvfx.talos.runtime.assets.AtlasAssetProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of talos-libgdx Show documentation
Show all versions of talos-libgdx Show documentation
Talos runtime for use in LibGDX projects
package com.talosvfx.talos.runtime.assets;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
public class AtlasAssetProvider extends BaseAssetProvider {
private final TextureAtlas atlas;
public AtlasAssetProvider (final TextureAtlas atlas) {
this.atlas = atlas;
setAssetHandler(TextureRegion.class, new AssetHandler() {
@Override
public TextureRegion findAsset (String assetName) {
return atlas.findRegion(assetName);
}
});
setAssetHandler(Sprite.class, new AssetHandler() {
@Override
public Sprite findAsset (String assetName) {
return atlas.createSprite(assetName);
}
});
}
}