Search in sources :

Example 1 with AtlasTmxMapLoader

use of com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader 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);
}
Also used : AtlasTiledMapLoaderParameters(com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader.AtlasTiledMapLoaderParameters) AssetManager(com.badlogic.gdx.assets.AssetManager) OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) OrthoCamController(com.badlogic.gdx.tests.utils.OrthoCamController) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) AssetErrorListener(com.badlogic.gdx.assets.AssetErrorListener) InternalFileHandleResolver(com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver) AtlasTmxMapLoader(com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont) AssetDescriptor(com.badlogic.gdx.assets.AssetDescriptor)

Example 2 with AtlasTmxMapLoader

use of com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader in project libgdx by libgdx.

the class TiledMapAtlasDirectLoaderTest 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.update();
    cameraController = new OrthoCamController(camera);
    Gdx.input.setInputProcessor(cameraController);
    font = new BitmapFont();
    batch = new SpriteBatch();
    map = new AtlasTmxMapLoader().load("data/maps/tiled-atlas-processed/test.tmx");
    renderer = new OrthogonalTiledMapRenderer(map, 1f / 32f);
}
Also used : OrthogonalTiledMapRenderer(com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer) OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) OrthoCamController(com.badlogic.gdx.tests.utils.OrthoCamController) AtlasTmxMapLoader(com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch)

Example 3 with AtlasTmxMapLoader

use of com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader in project libgdx by libgdx.

the class TiledMapPackerTestRender method create.

@Override
public void create() {
    atlasTmxMapLoader = new AtlasTmxMapLoader(new InternalFileHandleResolver());
    params = new AtlasTmxMapLoader.AtlasTiledMapLoaderParameters();
    params.generateMipMaps = false;
    params.convertObjectToTileSpace = false;
    params.flipY = true;
    viewport = new FitViewport(WORLD_WIDTH, WORLD_HEIGHT);
    cam = (OrthographicCamera) viewport.getCamera();
    map = atlasTmxMapLoader.load(TMX_LOC, params);
    mapRenderer = new OrthogonalTiledMapRenderer(map, UNIT_SCALE);
}
Also used : OrthogonalTiledMapRenderer(com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer) InternalFileHandleResolver(com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver) AtlasTmxMapLoader(com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader) FitViewport(com.badlogic.gdx.utils.viewport.FitViewport)

Aggregations

AtlasTmxMapLoader (com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader)3 InternalFileHandleResolver (com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver)2 OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)2 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)2 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)2 OrthogonalTiledMapRenderer (com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer)2 OrthoCamController (com.badlogic.gdx.tests.utils.OrthoCamController)2 AssetDescriptor (com.badlogic.gdx.assets.AssetDescriptor)1 AssetErrorListener (com.badlogic.gdx.assets.AssetErrorListener)1 AssetManager (com.badlogic.gdx.assets.AssetManager)1 AtlasTiledMapLoaderParameters (com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader.AtlasTiledMapLoaderParameters)1 FitViewport (com.badlogic.gdx.utils.viewport.FitViewport)1