Skip to content

Commit fa024dc

Browse files
committed
Add image size to Tileset
1 parent 013dd12 commit fa024dc

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

tmxlite/include/tmxlite/Tileset.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ namespace tmx
163163
*/
164164
const std::string getImagePath() const { return m_imagePath; }
165165
/*!
166+
\brief Returns the size of the tile set image in pixels.
167+
*/
168+
const Vector2u& getImageSize() const { return m_imageSize; }
169+
/*!
166170
\brief Returns the colour used by the tile map image to represent transparency.
167171
By default this is a transparent colour (0, 0, 0, 0)
168172
*/
@@ -214,6 +218,7 @@ namespace tmx
214218

215219
std::vector<Property> m_properties;
216220
std::string m_imagePath;
221+
Vector2u m_imageSize;
217222
Colour m_transparencyColour;
218223
bool m_hasTransparency;
219224

tmxlite/src/Tileset.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ void Tileset::parse(pugi::xml_node node, Map* map)
138138
{
139139
attribString = node.attribute("trans").as_string();
140140
m_transparencyColour = colourFromString(attribString);
141-
141+
}
142+
if (node.attribute("width") && node.attribute("height"))
143+
{
144+
m_imageSize.x = node.attribute("width").as_int();
145+
m_imageSize.y = node.attribute("height").as_int();
142146
}
143147
}
144148
else if (name == "tileoffset")

0 commit comments

Comments
 (0)