Skip to content

Commit

Permalink
Merge pull request #63 from u3shit/tileset-image-size
Browse files Browse the repository at this point in the history
Add image size to Tileset (fixes #61)
  • Loading branch information
fallahn authored May 5, 2020
2 parents 013dd12 + fa024dc commit 8aea23e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tmxlite/include/tmxlite/Tileset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ namespace tmx
*/
const std::string getImagePath() const { return m_imagePath; }
/*!
\brief Returns the size of the tile set image in pixels.
*/
const Vector2u& getImageSize() const { return m_imageSize; }
/*!
\brief Returns the colour used by the tile map image to represent transparency.
By default this is a transparent colour (0, 0, 0, 0)
*/
Expand Down Expand Up @@ -214,6 +218,7 @@ namespace tmx

std::vector<Property> m_properties;
std::string m_imagePath;
Vector2u m_imageSize;
Colour m_transparencyColour;
bool m_hasTransparency;

Expand Down
6 changes: 5 additions & 1 deletion tmxlite/src/Tileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ void Tileset::parse(pugi::xml_node node, Map* map)
{
attribString = node.attribute("trans").as_string();
m_transparencyColour = colourFromString(attribString);

}
if (node.attribute("width") && node.attribute("height"))
{
m_imageSize.x = node.attribute("width").as_int();
m_imageSize.y = node.attribute("height").as_int();
}
}
else if (name == "tileoffset")
Expand Down

0 comments on commit 8aea23e

Please sign in to comment.