28 #ifndef TMXLITE_LAYER_HPP_ 29 #define TMXLITE_LAYER_HPP_ 31 #include <tmxlite/Config.hpp> 32 #include <tmxlite/Property.hpp> 33 #include <tmxlite/Types.hpp> 55 using Ptr = std::unique_ptr<Layer>;
57 explicit Layer() : m_opacity(1.f), m_visible(
true) {};
58 virtual ~
Layer() =
default;
70 virtual Type getType()
const = 0;
74 virtual void parse(
const pugi::xml_node&) = 0;
78 const std::string&
getName()
const {
return m_name; }
95 const std::vector<Property>&
getProperties()
const {
return m_properties; }
99 void setName(
const std::string& name) { m_name = name; }
100 void setOpacity(
float opacity) { m_opacity = opacity; }
101 void setVisible(
bool visible) { m_visible = visible; }
102 void setOffset(std::int32_t x, std::int32_t y) { m_offset =
Vector2i(x, y); }
103 void addProperty(
const pugi::xml_node& node) { m_properties.emplace_back(); m_properties.back().parse(node); }
111 std::vector<Property> m_properties;
115 #endif //TMXLITE_LAYER_HPP_
bool getVisible() const
Returns whether this layer is visible or not.
Definition: Layer.hpp:86
const Vector2i & getOffset() const
Returns the offset from the top left corner of the layer, in pixels.
Definition: Layer.hpp:91
Represents a layer of a tmx format tile map. This is an abstract base class from which all layer type...
Definition: Layer.hpp:52
Objects are stored in ObjectGroup layers. Objects may be rectangular, elliptical, polygonal or a poly...
Definition: Object.hpp:82
const std::string & getName() const
Returns the name of the layer.
Definition: Layer.hpp:78
float getOpacity() const
Returns the opacity value for the layer.
Definition: Layer.hpp:82
const std::vector< Property > & getProperties() const
Returns the list of properties of this layer.
Definition: Layer.hpp:95