Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to set drawing bounds for a sfml tiled map loader

Started by SoulHeart Mar 11, 2012 at 11:48 PM 5 replies 2.9k views
Original Post
SoulHeart
SoulHeart
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"
Dragonsoulj
Dragonsoulj
It is referring to the sf::View I believe, which is this:
http://www.sfml-dev.org/documentation/1.6/classsf_1_1View.php
SoulHeart
SoulHeart
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?
Dragonsoulj
Dragonsoulj
Any code to share? Or does the console give any other information?
SoulHeart
SoulHeart

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???
Dragonsoulj
Dragonsoulj
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?
Jordanske
Jordanske
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.