TileMap

The Tile map consist of tiles which are stored in a XML file (preferably build with tiled)

class TileMap : Transformable , Drawable {}

Constructors

this
this(string filename, bool compress)

CTor

Members

Functions

_applyViewport
void _applyViewport()
Undocumented in source. Be warned that the author may not have intended to support it.
_loadTexCoords
void _loadTexCoords(ShortRect[ushort] used)
Undocumented in source. Be warned that the author may not have intended to support it.
_loadTileset
void _loadTileset()
Undocumented in source.
_readTileMap
void _readTileMap()

The read method must be overriden by any specialized TileMap.

_render
void _render()
Undocumented in source.
adjustCoords
Vector2s adjustCoords(float cx, float cy)

Adjusted pixel coordinates so that they lie on valid pixel coordinates based on tile coordinates.

adjustCoords
Vector2s adjustCoords(Vector2f vec)

Adjusted pixel coordinates so that they lie on valid pixel coordinates based on tile coordinates.

adjustView
void adjustView()

Adjust the viewport. The position is shifted about <code>view.x * -1</code> and <code>view.y - 1</code> so that the left upper corner of the current view is in the left upper corner of the Window.

calculateCenter
const(Vector2s) calculateCenter()

Calculate, store and return the center point.

convertCoords
Vector2s convertCoords(float cx, float cy)

Convert from pixel coordinates to tile coordinates.

convertCoords
Vector2s convertCoords(Vector2f vec)

Convert from pixel coordinates to tile coordinates.

exchangeTileset
void exchangeTileset(Texture tex)

Exchange the tileset

fetchView
inout(ShortRect*) fetchView()

Fetch the viewport pointer so that it can modified outside.

getFilename
string getFilename()

Returns the .xml filename of this tilemap

getInfo
const(TileMapInfo) getInfo()

Returns the information structure of this tilemap

getTileAt
Tile getTileAt(Vector2s vec)

Returns the tile at the given position, or throw an Exception Note: The position must be in tile coordinates, not pixel coordinates.

getTileAt
Tile getTileAt(short x, short y)

Returns the tile at the given position, or throw an Exception Note: The position must be in tile coordinates, not pixel coordinates.

getTiles
inout(Tile[]) getTiles()

Returns all containing tiles

isTileAt
bool isTileAt(Vector2s vec, uint* idx)

Check whether a tile exist on the given Coordinates. If idx isn't null, the calculated index of the Tile at the given position is stored there.

isTileAt
bool isTileAt(short x, short y, uint* idx)

Check whether a tile exist on the given Coordinates. If idx isn't null, the calculated index of the Tile at the given position is stored there.

load
void load(string filename, bool compress)

Load a new TileMap

reconvertCoords
Vector2s reconvertCoords(float cx, float cy)

Convert from tile coordinates to pixel coordinates.

reconvertCoords
Vector2s reconvertCoords(Vector2f vec)

Convert from tile coordinates to pixel coordinates.

reload
void reload(Vector2s[] coords, Vector2s[] newCoords)

Reload multiple tiles. The length of coords must be equal to the length of newCoords.

reload
void reload(Vector2s[] coords, Vector2s newCoord)

Replace multiple tiles with another.

reload
void reload(Vector2s[] coords, Vector2s newCoord)

Rvalue version

reload
void reload(Vector2s coord, Vector2s newCoord)

Reload one tile, which means that the tile on the coordinates coord is replaced with the tile (and the tile surface) on the coordinates newCoord

reload
void reload(Vector2s coord, Vector2s newCoord)

Rvalue version

replaceTileAt
void replaceTileAt(Vector2s vec, Tile newTile, Tile* oldTile)

Replace the tile at the given position with the given new Tile. If oldtile is not null, the former Tile is stored there.

replaceTileAt
void replaceTileAt(short x, short y, Tile newTile, Tile* oldTile)

Replace the tile at the given position with the given new Tile. If oldtile is not null, the former Tile is stored there.

resetView
void resetView()

Reset the viewport.

setView
void setView(short x, short y, short w, short h)

Set a new view.

setView
void setView(ShortRect view)

Set a new view.

setView
void setView(ShortRect view)

Rvalue version.

Properties

doCompress
bool doCompress [@property getter]

If compress is true, only the needed Tiles are stored (which means that are new tileset is created which contains only the needed tiles) otherwise the whole tileset is taken.

Variables

_doCompress
bool _doCompress;
Undocumented in source.
_filename
string _filename;
Undocumented in source.
_tex
Texture _tex;
Undocumented in source.
_tiles
Tile[] _tiles;
Undocumented in source.
_tmi
TileMapInfo _tmi;
Undocumented in source.
_vbo
VertexBufferObject _vbo;
Undocumented in source.
_view
ShortRect _view;
Undocumented in source.

Inherited Members

From Transformable

_applyTranslation
void _applyTranslation()

Apply translation to the object.

calculateCenter
const(Vector2s) calculateCenter()

Calculate, store and return the center point.

resetTranslation
void resetTranslation()

Reset the translation.

setCenter
void setCenter(Vector2s center)

Set the rotation center.

setCenter
void setCenter(short x, short y)

Set the rotation center.

getCenter
const(Vector2s) getCenter()

Returns the rotation center.

setRotation
void setRotation(short rotAngle)

Set a (new) rotation.

rotate
void rotate(short rotAngle)

Increase/Decrease the rotation.

getRotation
short getRotation()

Returns the current rotation.

setScale
void setScale(float zoom)

Set a new scale.

scale
void scale(float zoom)

Increase/Decrease the scale/zoom.

getScale
float getScale()

Returns the current scale/zoom.

From Drawable

_render
void _render()
Undocumented in source.
render
void render()

Render method

Meta

Authors

rschuett