How to set drawing bounds for a sfml tiled map loader

Started by
5 comments, last by Jordanske 12 years ago
How would I set drawing bounds for this tiled map editor...
http://www.sfml-dev.org/forum/viewtopic.php?p=43028&sid=64293e259add28a8092157afef619735

This is the example that was in the readme 
level.SetDrawingBounds(somesfview.GetRect()) 

I'm not sure what to put in for "somesfview"
Advertisement
It is referring to the sf::View I believe, which is this:
http://www.sfml-dev.org/documentation/1.6/classsf_1_1View.php
ok I got it to load and build without errors, but when I run the program the console says "Bad map. No tile information found" I know however, that the map isn't blank. Does anyone know why it is telling me this?
Any code to share? Or does the console give any other information?

Level map1;
map1.LoadFromFile("MapTest1.tmx");
sf::View View1(sf::FloatRect(0, 0, 1000, 1000));
map1.SetDrawingBounds(View1.GetRect());
map1.Draw(window4);


And no the console doesn't say anything else. I know that the map and tile sheet is loading correctly though. Maybe it has to do with the drawing bounds???
After examining the code and what you posted, my thought is that it is crashing because layerDataElement is pointing to NULL (the if test where you get your message). Perhaps you have some problems in the file? Or it has a blank layer that it is trying to load? Can you grab a file that definitely works, say an example file from the guy that made it?
I had the same problem that you have,

Before exporting the .tmx file first go to "Edit" >> "Preferences"
and open the first dropdown box: "Store tile layer data as:"
and change it to xml.

This topic is closed to new replies.

Advertisement