Matt, first of all thanks for your code. It works really well!
I've just found a little bug when you compute the number of rows and columns in
MapLoader::m_ProcessTiles:
const bool MapLoader::m_ProcessTiles(const pugi::xml_node& tilesetNode)
{
sf::Uint16 tileWidth, tileHeight, spacing, margin;
...
//slice into tiles
int columns = sourceImage->getSize().x / tileWidth;
int rows = sourceImage->getSize().y / tileHeight;
This won't take into account the spacing and margin of the tileset, if any. I've discovered by accident, trying to load a map with the
blocks1.png tileset (attached below). That tileset requires a margin and spacing of 2 pixels.
The fix is easy:
const bool MapLoader::m_ProcessTiles(const pugi::xml_node& tilesetNode)
{
sf::Uint16 tileWidth, tileHeight, spacing, margin;
...
//slice into tiles
int columns = (sourceImage->getSize().x-margin) / (tileWidth+spacing);
int rows = (sourceImage->getSize().y-margin) / (tileHeight+spacing);
Hope it helps
Cheers!