All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.talosvfx.talos.runtime.assets.AtlasAssetProvider Maven / Gradle / Ivy

The newest version!
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);
            }
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy