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...
|
| 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.
|
|
bool | loadFromString (const std::string &data, const std::string &workingDir) |
| Loads a map from a document stored in a string.
|
|
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()
|
|
const std::string & | getClass () const |
| Returns the class of the Map, as defined in the editor Tiled 1.9+.
|
|
const std::vector< Property > & | getProperties () const |
| Returns a vector of Property objects loaded by the map.
|
|
const std::map< std::uint32_t, Tileset::Tile > & | getAnimatedTiles () const |
| Returns a Hashmap of all animated tiles accessible by TileID.
|
|
const std::string & | getWorkingDirectory () const |
| Returns the current working directory of the map. Images and other resources are loaded relative to this.
|
|
std::unordered_map< std::string, Object > & | getTemplateObjects () |
| Returns an unordered_map of template objects indexed by file name.
|
|
const std::unordered_map< std::string, Object > & | getTemplateObjects () const |
|
std::unordered_map< std::string, Tileset > & | getTemplateTilesets () |
| Returns an unordered_map of tilesets used by templated objects. If Object::getTilesetName() is not empty it can be used to retreive a tileset from this map. Otherwise the object's tileset can be found from in the map's global tilesets returned by getTilesets().
|
|
const std::unordered_map< std::string, Tileset > & | getTemplateTilesets () const |
|
bool | isInfinite () const |
| Returns true if this is in infinite tile map. Infinite maps store their tile data in for tile layers in chunks. If this is an infinite map use TileLayer::getChunks() to get tile IDs rather than TileLayer::getTiles().
|
|
Vector2f | getParallaxOrigin () const |
|
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.
- See also
- https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#map