33 #include "TmxPropertySet.h"
50 TMX_COULDNT_OPEN = 0x01,
54 TMX_PARSING_ERROR = 0x02,
57 TMX_INVALID_FILE_SIZE = 0x04
66 TMX_MO_ORTHOGONAL = 0x01,
69 TMX_MO_ISOMETRIC = 0x02,
72 TMX_MO_STAGGERED = 0x03,
75 TMX_MO_HEXAGONAL = 0x04
84 TMX_RIGHT_DOWN = 0x01,
127 void ParseFile(
const std::string &fileName);
181 const std::vector< Tmx::Layer* > &
GetLayers()
const {
return layers; }
190 const std::vector< Tmx::TileLayer* > &
GetTileLayers()
const {
return tile_layers; }
199 const std::vector< Tmx::ObjectGroup* > &
GetObjectGroups()
const {
return object_groups; }
208 const std::vector< Tmx::ImageLayer* > &
GetImageLayers()
const {
return image_layers; }
210 const Tmx::GroupLayer *GetGroupLayer(
int index)
const {
return group_layers.at(index); }
211 int GetNumGroupLayers()
const {
return group_layers.size(); }
212 const std::vector< Tmx::GroupLayer* > &GetGroupLayers()
const {
return group_layers; }
227 const std::vector< Tmx::Tileset* > &
GetTilesets()
const {
return tilesets; }
242 std::string file_name;
243 std::string file_path;
248 Tmx::MapOrientation orientation;
249 Tmx::MapRenderOrder render_order;
250 Tmx::MapStaggerAxis stagger_axis;
251 Tmx::MapStaggerIndex stagger_index;
260 std::vector< Tmx::Layer* > layers;
261 std::vector< Tmx::TileLayer* > tile_layers;
262 std::vector< Tmx::ImageLayer* > image_layers;
263 std::vector< Tmx::ObjectGroup* > object_groups;
264 std::vector< Tmx::GroupLayer* > group_layers;
265 std::vector< Tmx::Tileset* > tilesets;
268 unsigned char error_code;
269 std::string error_text;
274 void Parse(tinyxml2::XMLNode *mapNode);
const std::string & GetFilepath() const
Get a path to the directory of the map file if any.
Definition: TmxMap.h:136
Base class for other layer types.
Definition: TmxLayer.h:54
A class used for holding groups of layers to create a layer heirarchy.
Definition: TmxGroupLayer.h:40
A class used for holding a list of objects.
Definition: TmxObjectGroup.h:48
const std::vector< Tmx::Layer * > & GetLayers() const
Get the whole layers collection.
Definition: TmxMap.h:181
Tmx::Color GetBackgroundColor() const
Get the background color of the map file. If unset, return a fully transparent color.
Definition: TmxMap.h:139
const std::vector< Tmx::ImageLayer * > & GetImageLayers() const
Get the whole collection of image layers.
Definition: TmxMap.h:208
void ParseText(const std::string &text)
Parse text containing TMX formatted XML.
Definition: TmxMap.cpp:167
Used for storing information about the tile ids for every tile layer.
Definition: TmxTileLayer.h:68
A class used for storing information about each of the tilesets.
Definition: TmxTileset.h:51
const Tmx::PropertySet & GetProperties() const
Get the property set.
Definition: TmxMap.h:239
const Tmx::Tileset * GetTileset(int index) const
Get a tileset by an index.
Definition: TmxMap.h:221
const Tmx::ObjectGroup * GetObjectGroup(int index) const
Get the object group at a certain index.
Definition: TmxMap.h:193
Tmx::MapStaggerAxis GetStaggerAxis() const
Get the stagger axis of the map.
Definition: TmxMap.h:151
void ParseFile(const std::string &fileName)
Read a file and parse it.
Definition: TmxMap.cpp:134
int GetNumImageLayers() const
Get the amount of image layers.
Definition: TmxMap.h:205
const std::vector< Tmx::TileLayer * > & GetTileLayers() const
Get the whole collection of tile layers.
Definition: TmxMap.h:190
int GetNumLayers() const
Get the amount of layers.
Definition: TmxMap.h:178
int GetTileHeight() const
Get the height of a tile, in pixels.
Definition: TmxMap.h:166
int GetNumObjectGroups() const
Get the amount of object groups.
Definition: TmxMap.h:196
This class is the root class of the parser.
Definition: TmxMap.h:115
This class contains a map of properties.
Definition: TmxPropertySet.h:47
int GetTileWidth() const
Get the width of a tile, in pixels.
Definition: TmxMap.h:163
int GetHexsideLength() const
Get the hexside length.
Definition: TmxMap.h:172
A class used for holding information about a background image.
Definition: TmxImageLayer.h:41
Tmx::MapOrientation GetOrientation() const
Get the orientation of the map.
Definition: TmxMap.h:145
bool HasError() const
Get whether there was an error or not.
Definition: TmxMap.h:230
const std::string & GetFilename() const
Get the filename used to read the map.
Definition: TmxMap.h:133
int GetNumTilesets() const
Get the amount of tilesets.
Definition: TmxMap.h:224
int GetHeight() const
Get the height of the map, in tiles.
Definition: TmxMap.h:160
unsigned char GetErrorCode() const
Get a number that identifies the error. (TMX_ preceded constants)
Definition: TmxMap.h:236
const Tmx::ImageLayer * GetImageLayer(int index) const
Get the image layer at a certain index.
Definition: TmxMap.h:202
Tmx::MapRenderOrder GetRenderOrder() const
Get the render order of the map.
Definition: TmxMap.h:148
A class used for storing information about a color.
Definition: TmxColor.h:38
int GetWidth() const
Get the width of the map, in tiles.
Definition: TmxMap.h:157
const Tmx::Layer * GetLayer(int index) const
Get the layer at a certain index.
Definition: TmxMap.h:175
int GetNextObjectId() const
Get the next object id.
Definition: TmxMap.h:169
int GetNumTileLayers() const
Get the amount of tile layers.
Definition: TmxMap.h:187
const std::vector< Tmx::Tileset * > & GetTilesets() const
Get the collection of tilesets.
Definition: TmxMap.h:227
const Tmx::Tileset * FindTileset(int gid) const
Find a tileset for a specific gid.
Definition: TmxMap.cpp:203
double GetVersion() const
Get the version of the map.
Definition: TmxMap.h:142
int FindTilesetIndex(int gid) const
Find the tileset index for a tileset using a tile gid.
Definition: TmxMap.cpp:186
const std::vector< Tmx::ObjectGroup * > & GetObjectGroups() const
Get the whole collection of object groups.
Definition: TmxMap.h:199
const Tmx::TileLayer * GetTileLayer(int index) const
Get the tile layer at a certain index.
Definition: TmxMap.h:184
const std::string & GetErrorText() const
Get an error string containing the error in text format.
Definition: TmxMap.h:233
Tmx::MapStaggerIndex GetStaggerIndex() const
Get the stagger index of the map.
Definition: TmxMap.h:154