tmxlite
lightweight Tiled tmx map parser for C++
|
Parser for TMX format tile maps. This class can be used to parse the XML format tile maps created with the Tiled map editor, providing an interface to create drawable and physics objects. Typical usage would be to create an instance of this class before calling load() providing a path to the *.tmx file to be loaded. Then layers or objects can be requested from the Map class to be interpreted as needed. More...
#include <Map.hpp>
Public Member Functions | |
Map (const Map &)=delete | |
Map & | operator= (const Map &)=delete |
Map (Map &&)=default | |
Map & | operator= (Map &&)=default |
bool | load (const std::string &) |
Attempts to parse the tilemap at the given location. More... | |
const Version & | getVersion () const |
Returns the version of the tile map last parsed. If no tile map has yet been parsed the version will read 0, 0. | |
Orientation | getOrientation () const |
Returns the orientation of the map if one is loaded, else returns None. | |
RenderOrder | getRenderOrder () const |
Returns the RenderOrder of the map if one is loaded, else returns None. | |
const Vector2u & | getTileCount () const |
Returns the tile count of the map in the X and Y directions. | |
const Vector2u & | getTileSize () const |
Returns the size of the tile grid in this map. Actual tile sizes may vary and will be extended / shrunk about the bottom left corner of the tile. | |
FloatRect | getBounds () const |
Returns the bounds of the map. | |
float | getHexSideLength () const |
Returns the length of an edge of a tile if a Hexagonal map is loaded. The length returned is in pixels of the straight edge running along the axis returned by getStaggerAxis(). If no map is loaded or the loaded map is not of Hexagonal orientation this function returns 0.f. | |
StaggerAxis | getStaggerAxis () const |
Stagger axis of the map. If either a Staggered or Hexagonal tile map is loaded this returns which axis the map is staggered along, else returns None. | |
StaggerIndex | getStaggerIndex () const |
Stagger Index of the loaded map. If a Staggered or Hexagonal map is loaded this returns whether the even or odd rows of tiles are staggered, otherwise it returns None. | |
const Colour & | getBackgroundColour () const |
Returns the background colour of the map. | |
const std::vector< Tileset > & | getTilesets () const |
Returns a reference to the vector of tile sets used by the map. | |
const std::vector< Layer::Ptr > & | getLayers () const |
Returns a reference to the vector containing the layer data. Layers are pointer-to-baseclass, the concrete type of which can be found via Layer::getType() More... | |
const std::vector< Property > & | getProperties () const |
Returns a vector of Property objects loaded by the map. | |
Parser for TMX format tile maps. This class can be used to parse the XML format tile maps created with the Tiled map editor, providing an interface to create drawable and physics objects. Typical usage would be to create an instance of this class before calling load() providing a path to the *.tmx file to be loaded. Then layers or objects can be requested from the Map class to be interpreted as needed.
|
inline |
Returns a reference to the vector containing the layer data. Layers are pointer-to-baseclass, the concrete type of which can be found via Layer::getType()
bool tmx::Map::load | ( | const std::string & | ) |
Attempts to parse the tilemap at the given location.
std::string | Path to map file to try to parse |