|
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.TiledMapRenderer
public class TiledMapRenderer
A renderer for Tiled maps backed with a Sprite Cache.
Constructor Summary | |
---|---|
TiledMapRenderer(TiledMap map,
TileAtlas atlas,
int blockWidth,
int blockHeight)
A renderer for Tiled maps backed with a Sprite Cache. |
|
TiledMapRenderer(TiledMap map,
TileAtlas atlas,
int blockWidth,
int blockHeight,
ShaderProgram shader)
A renderer for Tiled maps backed with a Sprite Cache. |
Method Summary | |
---|---|
void |
dispose()
Releases all resources held by this TiledMapRenderer. |
int |
getCol(int worldX)
Computes the Tiled Map column given an X coordinate in pixels |
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. |
int |
getMapHeightPixels()
|
int |
getMapWidthPixels()
|
Matrix4 |
getProjectionMatrix()
|
int |
getRow(int worldY)
Computes the Tiled Map row given a Y coordinate in pixels |
Matrix4 |
getTransformMatrix()
|
void |
render()
Renders the entire map. |
void |
render(int x,
int y,
int width,
int height)
Renders all layers between the given Tiled world coordinates. |
void |
render(int x,
int y,
int width,
int height,
int[] layers)
Renders specific layers between the given Tiled world coordinates. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TiledMapRenderer(TiledMap map, TileAtlas atlas, int blockWidth, int blockHeight)
render(int, int, int, int, int[])
is called, each block will equate one call to
SpriteCache.draw(int)
.
For debugging, use getInitialCol()
, getInitialRow()
,
getLastCol()
, and getLastRow()
after calling
render(int, int, int, int, int[])
to determine how many blocks were drawn.
map
- A Tiled map that has been run through the TiledMapPacker, which will add a few properties to optimize the rendereratlas
- The tile atlas to be used when drawing the mapblockWidth
- The width of each block to be drawn, in pixelsblockHeight
- The width of each block to be drawn, in pixelspublic TiledMapRenderer(TiledMap map, TileAtlas atlas, int blockWidth, int blockHeight, ShaderProgram shader)
render(int, int, int, int, int[])
is called, each block will equate one call to
SpriteCache.draw(int)
.
For debugging, use getInitialCol()
, getInitialRow()
,
getLastCol()
, and getLastRow()
after calling
render(int, int, int, int, int[])
to determine how many blocks were drawn.
map
- The map to be drawnatlas
- The tile atlas to be used when drawing the mapblockWidth
- The width of each block to be drawn, in pixelsblockHeight
- The width of each block to be drawn, in pixelsshader
- Shader to use for OpenGL ES 2.0Method Detail |
---|
public void render()
public void render(int x, int y, int width, int height)
render(int, int, int, int, int[])
with all layers in the layers list.
public void render(int x, int y, int width, int height, int[] layers)
layers
- The list of layers to draw, 0 being the lowest layer. You will get an IndexOutOfBoundsException if a layer
number is too high.public int getInitialRow()
getLastRow()
to
compute the number of rows drawn in the last call to render(int, int, int, int, int[])
.
public int getInitialCol()
getLastCol()
to
compute the number of columns drawn in the last call to render(int, int, int, int, int[])
.
public int getLastRow()
getInitialRow()
to
compute the number of rows drawn in the last call to render(int, int, int, int, int[])
.
public int getLastCol()
getInitialCol()
to compute the number of columns drawn in the last call to render(int, int, int, int, int[])
.
public Matrix4 getProjectionMatrix()
public Matrix4 getTransformMatrix()
public int getMapHeightPixels()
public int getMapWidthPixels()
public int getRow(int worldY)
worldY
- the Y coordinate in pixelspublic int getCol(int worldX)
worldX
- the X coordinate in pixelspublic void dispose()
dispose
in interface Disposable
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |