How does one load .tmx files from Tiled into a SFML game?
- \$\begingroup\$ Keep in mind to accept one answer, which both increases your reputation and helps you get help in the future if people see, that you approve of given hints and answers! \$\endgroup\$Christian Ivicevic– Christian Ivicevic2013-02-15 19:56:24 +00:00Commented Feb 15, 2013 at 19:56
- 1\$\begingroup\$ yeah sure.. i got it .. \$\endgroup\$dineshswamyp– dineshswamyp2013-02-17 18:36:12 +00:00Commented Feb 17, 2013 at 18:36
3 Answers
In my opinion the tmx-parser is the most robust library available which I have been using, too. It even supports compression which is the default option in Tiled.
- \$\begingroup\$ This, and if that does not please you, you can still export from Tiled to other formats like JSON and parse that, there is a lot of parsers for JSON. \$\endgroup\$opatut– opatut2013-02-15 20:19:06 +00:00Commented Feb 15, 2013 at 20:19
TMX is an xml-based format. You can parse it with any XML-parsing library to extract the level data and convert it into your internal format.
- \$\begingroup\$ okay ... got it \$\endgroup\$dineshswamyp– dineshswamyp2013-02-14 10:29:44 +00:00Commented Feb 14, 2013 at 10:29
Two other options you have are STP and sfml-tmxloader
As for the first option I have not tried it. However I've used sfml-tmxloader and found it to be very simple to use, which is also the one I recommend.