Search in sources :

Example 1 with TiledMapImageLayer

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

the class BatchTiledMapRenderer method render.

@Override
public void render() {
    beginRender();
    for (MapLayer layer : map.getLayers()) {
        if (layer.isVisible()) {
            if (layer instanceof TiledMapTileLayer) {
                renderTileLayer((TiledMapTileLayer) layer);
            } else if (layer instanceof TiledMapImageLayer) {
                renderImageLayer((TiledMapImageLayer) layer);
            } else {
                renderObjects(layer);
            }
        }
    }
    endRender();
}
Also used : TiledMapImageLayer(com.badlogic.gdx.maps.tiled.TiledMapImageLayer) TiledMapTileLayer(com.badlogic.gdx.maps.tiled.TiledMapTileLayer) MapLayer(com.badlogic.gdx.maps.MapLayer)

Example 2 with TiledMapImageLayer

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

the class BatchTiledMapRenderer method render.

@Override
public void render(int[] layers) {
    beginRender();
    for (int layerIdx : layers) {
        MapLayer layer = map.getLayers().get(layerIdx);
        if (layer.isVisible()) {
            if (layer instanceof TiledMapTileLayer) {
                renderTileLayer((TiledMapTileLayer) layer);
            } else if (layer instanceof TiledMapImageLayer) {
                renderImageLayer((TiledMapImageLayer) layer);
            } else {
                renderObjects(layer);
            }
        }
    }
    endRender();
}
Also used : TiledMapImageLayer(com.badlogic.gdx.maps.tiled.TiledMapImageLayer) TiledMapTileLayer(com.badlogic.gdx.maps.tiled.TiledMapTileLayer) MapLayer(com.badlogic.gdx.maps.MapLayer)

Example 3 with TiledMapImageLayer

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

the class OrthoCachedTiledMapRenderer method render.

@Override
public void render(int[] layers) {
    if (!cached) {
        cached = true;
        count = 0;
        spriteCache.clear();
        final float extraWidth = viewBounds.width * overCache;
        final float extraHeight = viewBounds.height * overCache;
        cacheBounds.x = viewBounds.x - extraWidth;
        cacheBounds.y = viewBounds.y - extraHeight;
        cacheBounds.width = viewBounds.width + extraWidth * 2;
        cacheBounds.height = viewBounds.height + extraHeight * 2;
        for (MapLayer layer : map.getLayers()) {
            spriteCache.beginCache();
            if (layer instanceof TiledMapTileLayer) {
                renderTileLayer((TiledMapTileLayer) layer);
            } else if (layer instanceof TiledMapImageLayer) {
                renderImageLayer((TiledMapImageLayer) layer);
            }
            spriteCache.endCache();
        }
    }
    if (blending) {
        Gdx.gl.glEnable(GL20.GL_BLEND);
        Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    }
    spriteCache.begin();
    MapLayers mapLayers = map.getLayers();
    for (int i : layers) {
        MapLayer layer = mapLayers.get(i);
        if (layer.isVisible()) {
            spriteCache.draw(i);
            renderObjects(layer);
        }
    }
    spriteCache.end();
    if (blending)
        Gdx.gl.glDisable(GL20.GL_BLEND);
}
Also used : TiledMapImageLayer(com.badlogic.gdx.maps.tiled.TiledMapImageLayer) TiledMapTileLayer(com.badlogic.gdx.maps.tiled.TiledMapTileLayer) MapLayer(com.badlogic.gdx.maps.MapLayer) MapLayers(com.badlogic.gdx.maps.MapLayers)

Example 4 with TiledMapImageLayer

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

the class OrthoCachedTiledMapRenderer method render.

@Override
public void render() {
    if (!cached) {
        cached = true;
        count = 0;
        spriteCache.clear();
        final float extraWidth = viewBounds.width * overCache;
        final float extraHeight = viewBounds.height * overCache;
        cacheBounds.x = viewBounds.x - extraWidth;
        cacheBounds.y = viewBounds.y - extraHeight;
        cacheBounds.width = viewBounds.width + extraWidth * 2;
        cacheBounds.height = viewBounds.height + extraHeight * 2;
        for (MapLayer layer : map.getLayers()) {
            spriteCache.beginCache();
            if (layer instanceof TiledMapTileLayer) {
                renderTileLayer((TiledMapTileLayer) layer);
            } else if (layer instanceof TiledMapImageLayer) {
                renderImageLayer((TiledMapImageLayer) layer);
            }
            spriteCache.endCache();
        }
    }
    if (blending) {
        Gdx.gl.glEnable(GL20.GL_BLEND);
        Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    }
    spriteCache.begin();
    MapLayers mapLayers = map.getLayers();
    for (int i = 0, j = mapLayers.getCount(); i < j; i++) {
        MapLayer layer = mapLayers.get(i);
        if (layer.isVisible()) {
            spriteCache.draw(i);
            renderObjects(layer);
        }
    }
    spriteCache.end();
    if (blending)
        Gdx.gl.glDisable(GL20.GL_BLEND);
}
Also used : TiledMapImageLayer(com.badlogic.gdx.maps.tiled.TiledMapImageLayer) TiledMapTileLayer(com.badlogic.gdx.maps.tiled.TiledMapTileLayer) MapLayer(com.badlogic.gdx.maps.MapLayer) MapLayers(com.badlogic.gdx.maps.MapLayers)

Aggregations

MapLayer (com.badlogic.gdx.maps.MapLayer)4 TiledMapImageLayer (com.badlogic.gdx.maps.tiled.TiledMapImageLayer)4 TiledMapTileLayer (com.badlogic.gdx.maps.tiled.TiledMapTileLayer)4 MapLayers (com.badlogic.gdx.maps.MapLayers)2