Closed Josh1billion closed 9 years ago
The same also happens with Width and Height on lines 71-72, by the way.
It looks like libtiled converts these to integers (as in map reader.cpp:readObjectGroup), so it's definitely a good idea to do the same here. Thanks for the report!
Oops, my mistake. I was reading the (deprecated) object group attributes. The individual object attributes are indeed floats, so this is an error in TiledSharp.
Replacing (int)
with (float)
should be all that's needed.
I've updated the master branch to handle object float attributes. Could you give it a try?
Works great! Thanks for fixing it so quickly.
Found a new case where a bug can arise.
In ObjectGroup.cs, on lines 68-69, these lines can sometimes throw unhandled exceptions, crashing the program:
Specifically, this happens if the x and/or y values for an object are decimal values.
Steps to reproduce:
This might seem like a rare case ("who would enter a decimal value for an x or y coordinate, anyway?"), but in my case, Tiled actually set it to a decimal value automatically as I was dragging-and-dropping an object around in the editor, so it's entirely possible that users will run into this at some point after messing around in Tiled long enough, like I did. :)