libtmx
0.4.0
an C++11 library for reading TMX files
|
A map is a set of tilesets and a set of different layers. More...
#include <tmx/Map.h>
Public Types | |
typedef boost::transformed_range< Adaptor, const boost::iterator_range< std::vector< std::unique_ptr< TileSet > >::const_iterator > > | const_tileset_range |
A tileset range. More... | |
typedef boost::transformed_range< Adaptor, const boost::iterator_range< std::vector< std::unique_ptr< Layer > >::const_iterator > > | const_layer_range |
A layer range. More... | |
Public Member Functions | |
Map (const std::string version, Orientation orientation, unsigned width, unsigned height, unsigned tilewidth, unsigned tileheight, const std::string &bgcolor, RenderOrder renderOrder, unsigned hexSideLength, StaggerAxis axis, StaggerIndex index, unsigned nextObjectId) | |
Map constructor. More... | |
Properties | |
const std::string & | getVersion () const noexcept |
Get the version of the TMX format. More... | |
Orientation | getOrientation () const noexcept |
Get the orientation of the map. More... | |
unsigned | getWidth () const noexcept |
Get the width of the map. More... | |
unsigned | getHeight () const noexcept |
Get the height of the map. More... | |
unsigned | getTileWidth () const noexcept |
Get the width of tiles. More... | |
unsigned | getTileHeight () const noexcept |
Get the height of tiles. More... | |
const std::string & | getBackgroundColor () const noexcept |
Get the background color. More... | |
RenderOrder | getRenderOrder () const noexcept |
Get the render order. More... | |
unsigned | getHexSideLength () const noexcept |
Get the hexagonal side length. More... | |
StaggerAxis | getStaggerAxis () const noexcept |
Get the staggered axis. More... | |
StaggerIndex | getStaggerIndex () const noexcept |
Get the staggered index. More... | |
unsigned | getNextObjectId () const noexcept |
Get the next object id. More... | |
Tileset handling | |
void | addTileSet (std::unique_ptr< TileSet > tileset) |
Add a tileset. More... | |
const_tileset_range | getTileSets () const noexcept |
Get the tilesets. More... | |
const TileSet * | getTileSetFromGID (unsigned gid) const noexcept |
Get the tileset corresponding to a global id. More... | |
Layer handling | |
void | addLayer (std::unique_ptr< Layer > layer) |
Add a layer. More... | |
const_layer_range | getLayers () const noexcept |
Get the layers. More... | |
void | visitLayers (LayerVisitor &visitor) const |
Visit the layers with a visitor. More... | |
Public Member Functions inherited from tmx::Component | |
bool | hasProperty (const std::string &key) const noexcept |
Tell if the object has a given property. More... | |
const std::string & | getProperty (const std::string &key, const std::string &def) const noexcept |
Get a property value. More... | |
bool | addProperty (const std::string &key, const std::string &value) |
Add a property. More... | |
Static Public Member Functions | |
Map parsing | |
static std::unique_ptr< Map > | parseFile (const boost::filesystem::path &filename) |
Parse a TMX file. More... | |
A map is a set of tilesets and a set of different layers.
Tilesets describe what to draw while layers describe how to draw things.
typedef boost::transformed_range<Adaptor, const boost::iterator_range<std::vector<std::unique_ptr<Layer> >::const_iterator> > tmx::Map::const_layer_range |
A layer range.
typedef boost::transformed_range<Adaptor, const boost::iterator_range<std::vector<std::unique_ptr<TileSet> >::const_iterator> > tmx::Map::const_tileset_range |
A tileset range.
|
inline |
Map constructor.
|
inline |
Add a layer.
layer | the layer |
|
inline |
Add a tileset.
tileset | the tileset |
|
inlinenoexcept |
Get the background color.
|
inlinenoexcept |
Get the height of the map.
|
inlinenoexcept |
Get the hexagonal side length.
Only relevant for hexagonal maps.
|
inlinenoexcept |
Get the layers.
|
inlinenoexcept |
Get the next object id.
|
inlinenoexcept |
Get the orientation of the map.
|
inlinenoexcept |
Get the render order.
|
inlinenoexcept |
Get the staggered axis.
Only relevant for staggered and hexagonal maps.
|
inlinenoexcept |
Get the staggered index.
Only relevant for staggered and hexagonal maps.
|
inlinenoexcept |
Get the height of tiles.
|
noexcept |
Get the tileset corresponding to a global id.
gid | a global id |
|
inlinenoexcept |
Get the tilesets.
|
inlinenoexcept |
Get the width of tiles.
|
inlinenoexcept |
Get the version of the TMX format.
|
inlinenoexcept |
Get the width of the map.
|
static |
Parse a TMX file.
filename | the name of the TMX file |
|
inline |
Visit the layers with a visitor.
visitor | the visitor |