fallahn/tmxlite

Feature Request: Allow independent parse of tsx to TileMap.

brandon-reinhart opened this issue · 2 comments

Currently tsx loading is embedded in map loading. This is fine for a game runtime, but your library is a pretty good interface to an asset import process (I'm using it for my custom importer to Unreal). I'd like to be able to treat tsx (tileset) files as their own asset and write a separate importer for them. I could trick your interface by loading the tsx, parsing it into an xml node, then calling parse with an empty map, but this is shady.

Would be nice to be able to create a TileMap object independent of any Map. Multiple maps may refer to the same tsx, so this allows us to manage each asset for import/reimport independently.

// Abuse tmxlite by parsing this tileset into a fake map.
// There's no way to tell if this worked... :/
auto attr = node.prepend_attribute("firstgid"); // fake! OMG! BAD CODER!
attr.set_value(1); // wtf this is so awful!
TileSet.parse( node, &Map );

Here is an example of the bad thing I'd like not to do.

That's not a bad idea - could also possibly combine it with #128 . I'll have a think about the best way to do this, as it'll likely require a not insignificant refactor.