|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.graphics.g2d.tiled.TileMapRenderer
public class TileMapRenderer
A renderer for Tiled maps backed with a Sprite Cache.
Field Summary | |
---|---|
float |
overdrawX
Sets the amount of overdraw in the X direction (in units). |
float |
overdrawY
Sets the amount of overdraw in the Y direction (in units). |
Constructor Summary | |
---|---|
TileMapRenderer(int[][][] map,
TileAtlas atlas,
int tileWidth,
int tileHeight,
float unitsPerTileX,
float unitsPerTileY,
IntArray blendedTiles,
int tilesPerBlockX,
int tilesPerBlockY)
A renderer for static tile maps backed with a Sprite Cache. |
|
TileMapRenderer(int[][][] map,
TileAtlas atlas,
int tileWidth,
int tileHeight,
float unitsPerTileX,
float unitsPerTileY,
IntArray blendedTiles,
int tilesPerBlockX,
int tilesPerBlockY,
ShaderProgram shader)
A renderer for static tile maps backed with a Sprite Cache. |
|
TileMapRenderer(TiledMap map,
TileAtlas atlas,
int tilesPerBlockX,
int tilesPerBlockY)
A renderer for static tile maps backed with a Sprite Cache. |
|
TileMapRenderer(TiledMap map,
TileAtlas atlas,
int tilesPerBlockX,
int tilesPerBlockY,
float unitsPerTileX,
float unitsPerTileY)
A renderer for static tile maps backed with a Sprite Cache. |
|
TileMapRenderer(TiledMap map,
TileAtlas atlas,
int tilesPerBlockX,
int tilesPerBlockY,
float unitsPerTileX,
float unitsPerTileY,
ShaderProgram shader)
|
|
TileMapRenderer(TiledMap map,
TileAtlas atlas,
int tilesPerBlockX,
int tilesPerBlockY,
ShaderProgram shader)
A renderer for static tile maps backed with a Sprite Cache. |
Method Summary | |
---|---|
void |
dispose()
Releases all resources held by this TiledMapRenderer. |
TileAtlas |
getAtlas()
|
int |
getCol(int worldX)
Computes the Tiled Map column given an X coordinate in units |
int |
getInitialCol()
Returns the initial drawn block column, for debugging purposes. |
int |
getInitialRow()
Returns the initial drawn block row, for debugging purposes. |
int |
getLastCol()
Returns the final drawn block column, for debugging purposes. |
int |
getLastRow()
Returns the final drawn block row, for debugging purposes. |
TiledMap |
getMap()
|
int |
getMapHeightUnits()
|
int |
getMapWidthUnits()
|
Matrix4 |
getProjectionMatrix()
|
int |
getRow(int worldY)
Computes the Tiled Map row given a Y coordinate in units |
Matrix4 |
getTransformMatrix()
|
float |
getUnitsPerTileX()
|
float |
getUnitsPerTileY()
|
void |
render()
Renders the entire map. |
void |
render(float x,
float y,
float width,
float height)
Renders all layers between the given bounding box in map units. |
void |
render(float x,
float y,
float width,
float height,
int[] layers)
Renders specific layers between the given bounding box in map units. |
void |
render(OrthographicCamera cam)
Renders specific layers in the given a camera |
void |
render(OrthographicCamera cam,
int[] layers)
Renders specific layers in the given a camera. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public float overdrawX
public float overdrawY
Constructor Detail |
---|
public TileMapRenderer(TiledMap map, TileAtlas atlas, int tilesPerBlockX, int tilesPerBlockY)
map
- A tile map's tile numbers, in the order [layer][row][column]atlas
- The tile atlas to be used when drawing the maptilesPerBlockX
- The width of each block to be drawn, in number of tilestilesPerBlockY
- The height of each block to be drawn, in number of tilespublic TileMapRenderer(TiledMap map, TileAtlas atlas, int tilesPerBlockX, int tilesPerBlockY, float unitsPerTileX, float unitsPerTileY)
map
- A tile map's tile numbers, in the order [layer][row][column]atlas
- The tile atlas to be used when drawing the maptilesPerBlockX
- The width of each block to be drawn, in number of tilestilesPerBlockY
- The height of each block to be drawn, in number of tilesunitsPerTileX
- The number of units per tile in the x directionunitsPerTileY
- The number of units per tile in the y directionpublic TileMapRenderer(TiledMap map, TileAtlas atlas, int tilesPerBlockX, int tilesPerBlockY, ShaderProgram shader)
map
- A tile map's tile numbers, in the order [layer][row][column]atlas
- The tile atlas to be used when drawing the maptilesPerBlockX
- The width of each block to be drawn, in number of tilestilesPerBlockY
- The height of each block to be drawn, in number of tilesshader
- Shader to use for OpenGL ES 2.0, null uses a default shader. Ignored if using OpenGL ES 1.0.public TileMapRenderer(TiledMap map, TileAtlas atlas, int tilesPerBlockX, int tilesPerBlockY, float unitsPerTileX, float unitsPerTileY, ShaderProgram shader)
public TileMapRenderer(int[][][] map, TileAtlas atlas, int tileWidth, int tileHeight, float unitsPerTileX, float unitsPerTileY, IntArray blendedTiles, int tilesPerBlockX, int tilesPerBlockY)
map
- A tile map's tile numbers, in the order [layer][row][column]atlas
- The tile atlas to be used when drawing the maptileWidth
- The width of the tiles, in pixelstileHeight
- The height of the tiles, in pixelsunitsPerTileX
- The number of units per tile in the x directionunitsPerTileY
- The number of units per tile in the y directionblendedTiles
- Array containing tile numbers that require blendingtilesPerBlockX
- The width of each block to be drawn, in number of tilestilesPerBlockY
- The height of each block to be drawn, in number of tilespublic TileMapRenderer(int[][][] map, TileAtlas atlas, int tileWidth, int tileHeight, float unitsPerTileX, float unitsPerTileY, IntArray blendedTiles, int tilesPerBlockX, int tilesPerBlockY, ShaderProgram shader)
map
- A tile map's tile numbers, in the order [layer][row][column]atlas
- The tile atlas to be used when drawing the maptileWidth
- The width of the tiles, in pixelstileHeight
- The height of the tiles, in pixelsunitsPerTileX
- The number of units per tile in the x directionunitsPerTileY
- The number of units per tile in the y directionblendedTiles
- Array containing tile numbers that require blendingtilesPerBlockX
- The width of each block to be drawn, in number of tilestilesPerBlockY
- The height of each block to be drawn, in number of tilesshader
- Shader to use for OpenGL ES 2.0, null uses a default shader. Ignored if using OpenGL ES 1.0.Method Detail |
---|
public void render()
public void render(float x, float y, float width, float height)
render(float, float, float, float, int[])
with all layers in the layers list.
public void render(OrthographicCamera cam)
cam
- The camera to usepublic void render(OrthographicCamera cam, int[] layers)
cam
- The camera to uselayers
- The list of layers to draw, 0 being the lowest layer. You will get an IndexOutOfBoundsException if a layer
number is too high.public void render(float x, float y, float width, float height, int[] layers)
x
- The x coordinate to start drawingy
- the y coordinate to start drawingwidth
- the width of the tiles to drawheight
- the width of the tiles to drawlayers
- The list of layers to draw, 0 being the lowest layer. You will get an IndexOutOfBoundsException if a layer
number is too high.public Matrix4 getProjectionMatrix()
public Matrix4 getTransformMatrix()
public int getRow(int worldY)
worldY
- the Y coordinate in unitspublic int getCol(int worldX)
worldX
- the X coordinate in unitspublic int getInitialRow()
getLastRow()
to
compute the number of rows drawn in the last call to render(float, float, float, float, int[])
.
public int getInitialCol()
getLastCol()
to
compute the number of columns drawn in the last call to render(float, float, float, float, int[])
.
public int getLastRow()
getInitialRow()
to
compute the number of rows drawn in the last call to render(float, float, float, float, int[])
.
public int getLastCol()
getInitialCol()
to
compute the number of columns drawn in the last call to render(float, float, float, float, int[])
.
public float getUnitsPerTileX()
public float getUnitsPerTileY()
public int getMapHeightUnits()
public int getMapWidthUnits()
public void dispose()
dispose
in interface Disposable
public TiledMap getMap()
public TileAtlas getAtlas()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |