public class TileLayer extends Layer
TiledMap| Constructor and Description |
|---|
TileLayer(int width,
int height) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
static TileLayer |
fromInputStream(java.io.DataInputStream inputStream) |
int |
getHeight()
Returns the height of the layer
|
int |
getTileId(int x,
int y)
Returns the tile id at a given coordinate on the layer
|
int |
getTotalEmptyTiles()
Returns the total number of empty tiles on this layer
|
int |
getTotalFilledTiles()
Returns the total number of tiles that have content on this layer
|
int |
getWidth()
Returns the width of the layer
|
int |
hashCode() |
boolean |
isFlippedDiagonally(int x,
int y)
Returns if the tile at the given coordinate is flipped diagonally
|
boolean |
isFlippedHorizontally(int x,
int y)
Returns if the tile at the given coordinate is flipped horizontally
|
boolean |
isFlippedVertically(int x,
int y)
Returns if the tile at the given coordinate is flipped vertically
|
boolean |
isMostlyEmptyTiles()
Returns if the majority of the
TileLayer consists of empty tiles |
void |
readData(java.io.DataInputStream inputStream)
Deserializes this object from a
DataInputStream |
void |
setFlippedDiagonally(int x,
int y,
boolean flip)
Sets if the tile at the given coordinate is flipped diagonally
|
void |
setFlippedHorizontally(int x,
int y,
boolean flip)
Sets if the tile at the given coordinate is flipped horizontally
|
void |
setFlippedVertically(int x,
int y,
boolean flip)
Sets if the tile at the given coordinate is flipped vertically
|
void |
setTileId(int x,
int y,
int id)
Sets the tile id at a given coordinate on the layer
|
void |
setTileId(int x,
int y,
int id,
boolean flipH,
boolean flipV,
boolean flipD)
Sets the tile id at a given coordinate on the layer
|
java.lang.String |
toString() |
void |
writeData(java.io.DataOutputStream outputStream)
Serializes this object to a
DataOutputStream |
containsProperty, getIndex, getLayerType, getName, getProperties, getProperty, isVisible, setIndex, setName, setProperty, setVisiblepublic static TileLayer fromInputStream(java.io.DataInputStream inputStream) throws java.io.IOException
java.io.IOExceptionpublic void writeData(java.io.DataOutputStream outputStream)
throws java.io.IOException
GameDataSerializableDataOutputStreamwriteData in interface GameDataSerializablewriteData in class LayeroutputStream - The DataOutputStream to write tojava.io.IOException - Thrown if an error occurs during I/Opublic void readData(java.io.DataInputStream inputStream)
throws java.io.IOException
GameDataSerializableDataInputStreamreadData in interface GameDataSerializablereadData in class LayerinputStream - The DataInputStream to read fromjava.io.IOException - Thrown if an error occurs during I/Opublic int getTileId(int x,
int y)
x - The x coordinate in tilesy - The y coordinate in tilespublic void setTileId(int x,
int y,
int id)
x - The x coordinate in tilesy - The y coordinate in tilesid - 0 if there is no tilepublic void setTileId(int x,
int y,
int id,
boolean flipH,
boolean flipV,
boolean flipD)
x - The x coordinate in tilesy - The y coordinate in tilesid - 0 if there is no tileflipH - True if the tile is flipped horizontallyflipV - True if the tile is flipped verticallyflipD - True if the tile is flipped (anti) diagonally - rotationpublic boolean isFlippedHorizontally(int x,
int y)
x - The tile x coordinatey - The tile y coordinatepublic void setFlippedHorizontally(int x,
int y,
boolean flip)
x - The tile x coordinatey - The tile y coordinateflip - True if flipped horizontallypublic boolean isFlippedVertically(int x,
int y)
x - The tile x coordinatey - The tile y coordinatepublic void setFlippedVertically(int x,
int y,
boolean flip)
x - The tile x coordinatey - The tile y coordinateflip - True if flipped verticallypublic boolean isFlippedDiagonally(int x,
int y)
x - The tile x coordinatey - The tile y coordinatepublic void setFlippedDiagonally(int x,
int y,
boolean flip)
x - The tile x coordinatey - The tile y coordinateflip - True if flipped diagonallypublic int getWidth()
public int getHeight()
public boolean isMostlyEmptyTiles()
TileLayer consists of empty tilesTiledMap.FAST_RENDER_EMPTY_LAYERS_THRESHOLD of the layer contains tilespublic int getTotalEmptyTiles()
public int getTotalFilledTiles()