SFML Tiled tmx Map Loader 0.7

So it's that time again... I know it seems all I post about these days is the map loader, but it's better than no posts at all I guess. I do have something in mind regarding 2D vehicle physics which I have been working on - but it's difficult to find the time to write all these things down. Regardless, as  matter of course I've been updating and maintaining the map loader so it's time for a new release. Much of the modification has happened under the hood so the interface has remained more or less the same and should just drop straight into any existing projects - assuming you've not made a lot of customisations yourself. The main exception is the removal of Draw2() - but that was, for all intents and purposes, deprecated anyway. Most importantly  the map loader now inherits from sf::Drawable, so can be drawn via


which draws the entire map and brings the style more in line with the SFML api. The existing Draw() functions still work, however, so you are able to draw specific layers if you require. I have been asked in the past why you might want to draw layers individually and the answer I usually give as an example is a real-world scenario where I store normal mapping data on a Tiled map layer. I don't want this layer to be drawn on screen, but I do want to be able to draw it internally to a RenderTexture, where it can be used for some shader effects. Performance wise I've substantially decreased load times by no longer caching image files. Originally the loader would slice the tile maps into textures representing each tile and store them in a vector so they could be used to create sprites for individual tiles. With the removal of Draw2() and a small tweak to make MapObjects use sprites created via a sub-rectangle it made sense to remove the lengthy process of caching every tile texture. As a side effect it also reduces memory usage, of course. The updated files are available to download in the usual place.

In related news there is also a C# port in the works. If .net/mono are your poison then you can find details of it in the SFML forum post here.


Popular Posts