28 #ifndef TMXLITE_MAP_HPP_ 29 #define TMXLITE_MAP_HPP_ 31 #include <tmxlite/Tileset.hpp> 32 #include <tmxlite/Layer.hpp> 33 #include <tmxlite/Property.hpp> 34 #include <tmxlite/Types.hpp> 49 Version(std::uint16_t maj = 0, std::uint16_t min = 0)
50 : upper(maj), lower(min) {}
53 enum class Orientation
62 enum class RenderOrder
71 enum class StaggerAxis
76 enum class StaggerIndex
90 class TMXLITE_EXPORT_API
Map final
97 Map& operator = (
const Map&) =
delete;
99 Map& operator = (
Map&&) =
default;
107 bool load(
const std::string&);
137 FloatRect getBounds()
const {
return FloatRect(0.f, 0.f, static_cast<float>(m_tileCount.x * m_tileSize.x), static_cast<float>(m_tileCount.y * m_tileSize.y)); }
166 const std::vector<Tileset>&
getTilesets()
const {
return m_tilesets; }
173 const std::vector<Layer::Ptr>&
getLayers()
const {
return m_layers; }
182 Orientation m_orientation;
183 RenderOrder m_renderOrder;
188 float m_hexSideLength;
189 StaggerAxis m_staggerAxis;
190 StaggerIndex m_staggerIndex;
192 Colour m_backgroundColour;
194 std::string m_workingDirectory;
196 std::vector<Tileset> m_tilesets;
197 std::vector<Layer::Ptr> m_layers;
198 std::vector<Property> m_properties;
207 #endif //TMXLITE_MAP_HPP_ float getHexSideLength() const
Returns the length of an edge of a tile if a Hexagonal map is loaded. The length returned is in pixel...
Definition: Map.hpp:146
const Version & getVersion() const
Returns the version of the tile map last parsed. If no tile map has yet been parsed the version will ...
Definition: Map.hpp:113
StaggerAxis getStaggerAxis() const
Stagger axis of the map. If either a Staggered or Hexagonal tile map is loaded this returns which axi...
Definition: Map.hpp:152
Orientation getOrientation() const
Returns the orientation of the map if one is loaded, else returns None.
Definition: Map.hpp:118
FloatRect getBounds() const
Returns the bounds of the map.
Definition: Map.hpp:137
Contains the red, green, blue and alpha values of a colour in the range 0 - 255.
Definition: Types.hpp:109
const Vector2u & getTileSize() const
Returns the size of the tile grid in this map. Actual tile sizes may vary and will be extended / shru...
Definition: Map.hpp:133
Parser for TMX format tile maps. This class can be used to parse the XML format tile maps created wit...
Definition: Map.hpp:90
const std::vector< Property > & getProperties() const
Returns a vector of Property objects loaded by the map.
Definition: Map.hpp:177
const Vector2u & getTileCount() const
Returns the tile count of the map in the X and Y directions.
Definition: Map.hpp:127
Holds the xml version of the loaded map.
Definition: Map.hpp:44
StaggerIndex getStaggerIndex() const
Stagger Index of the loaded map. If a Staggered or Hexagonal map is loaded this returns whether the e...
Definition: Map.hpp:158
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()
Definition: Map.hpp:173
const std::vector< Tileset > & getTilesets() const
Returns a reference to the vector of tile sets used by the map.
Definition: Map.hpp:166
const Colour & getBackgroundColour() const
Returns the background colour of the map.
Definition: Map.hpp:162
RenderOrder getRenderOrder() const
Returns the RenderOrder of the map if one is loaded, else returns None.
Definition: Map.hpp:123