Class BatchTiledMapRenderer
- java.lang.Object
-
- com.badlogic.gdx.maps.tiled.renderers.BatchTiledMapRenderer
-
- All Implemented Interfaces:
MapRenderer,TiledMapRenderer,Disposable
- Direct Known Subclasses:
HexagonalTiledMapRenderer,IsometricStaggeredTiledMapRenderer,IsometricTiledMapRenderer,OrthogonalTiledMapRenderer
public abstract class BatchTiledMapRenderer extends java.lang.Object implements TiledMapRenderer, Disposable
-
-
Field Summary
Fields Modifier and Type Field Description protected Batchbatchprotected RectangleimageBoundsprotected TiledMapmapprotected static intNUM_VERTICESprotected booleanownsBatchprotected floatunitScaleprotected float[]verticesprotected RectangleviewBounds
-
Constructor Summary
Constructors Constructor Description BatchTiledMapRenderer(TiledMap map)BatchTiledMapRenderer(TiledMap map, float unitScale)BatchTiledMapRenderer(TiledMap map, float unitScale, Batch batch)BatchTiledMapRenderer(TiledMap map, Batch batch)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbeginRender()Called before the rendering of all layers starts.voiddispose()Releases all resources of this object.protected voidendRender()Called after the rendering of all layers ended.BatchgetBatch()TiledMapgetMap()floatgetUnitScale()RectanglegetViewBounds()voidrender()Renders all the layers of a map.voidrender(int[] layers)Renders the given layers of a map.voidrenderImageLayer(TiledMapImageLayer layer)protected voidrenderMapLayer(MapLayer layer)voidrenderObject(MapObject object)voidrenderObjects(MapLayer layer)voidsetMap(TiledMap map)voidsetView(OrthographicCamera camera)Sets the projection matrix and viewbounds from the given camera.voidsetView(Matrix4 projection, float x, float y, float width, float height)Sets the projection matrix for rendering, as well as the bounds of the map which should be rendered.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.badlogic.gdx.maps.tiled.TiledMapRenderer
renderTileLayer
-
-
-
-
Field Detail
-
NUM_VERTICES
protected static final int NUM_VERTICES
- See Also:
- Constant Field Values
-
map
protected TiledMap map
-
unitScale
protected float unitScale
-
batch
protected Batch batch
-
viewBounds
protected Rectangle viewBounds
-
imageBounds
protected Rectangle imageBounds
-
ownsBatch
protected boolean ownsBatch
-
vertices
protected float[] vertices
-
-
Method Detail
-
getMap
public TiledMap getMap()
-
setMap
public void setMap(TiledMap map)
-
getUnitScale
public float getUnitScale()
-
getBatch
public Batch getBatch()
-
getViewBounds
public Rectangle getViewBounds()
-
setView
public void setView(OrthographicCamera camera)
Description copied from interface:MapRendererSets the projection matrix and viewbounds from the given camera. If the camera changes, you have to call this method again. The viewbounds are taken from the camera's position and viewport size as well as the scale. This method will only work if the camera's direction vector is (0,0,-1) and its up vector is (0, 1, 0), which are the defaults.- Specified by:
setViewin interfaceMapRenderer- Parameters:
camera- theOrthographicCamera
-
setView
public void setView(Matrix4 projection, float x, float y, float width, float height)
Description copied from interface:MapRendererSets the projection matrix for rendering, as well as the bounds of the map which should be rendered. Make sure that the frustum spanned by the projection matrix coincides with the viewbounds.- Specified by:
setViewin interfaceMapRenderer
-
render
public void render()
Description copied from interface:MapRendererRenders all the layers of a map.- Specified by:
renderin interfaceMapRenderer
-
render
public void render(int[] layers)
Description copied from interface:MapRendererRenders the given layers of a map.- Specified by:
renderin interfaceMapRenderer- Parameters:
layers- the layers to render.
-
renderMapLayer
protected void renderMapLayer(MapLayer layer)
-
renderObjects
public void renderObjects(MapLayer layer)
- Specified by:
renderObjectsin interfaceTiledMapRenderer
-
renderObject
public void renderObject(MapObject object)
- Specified by:
renderObjectin interfaceTiledMapRenderer
-
renderImageLayer
public void renderImageLayer(TiledMapImageLayer layer)
- Specified by:
renderImageLayerin interfaceTiledMapRenderer
-
beginRender
protected void beginRender()
Called before the rendering of all layers starts.
-
endRender
protected void endRender()
Called after the rendering of all layers ended.
-
dispose
public void dispose()
Description copied from interface:DisposableReleases all resources of this object.- Specified by:
disposein interfaceDisposable
-
-