I'm having some trouble with drawing tiles from a tile engine I'm working on. I'm honestly not sure if it's just a fluke, or if there's something causing it, but I wrote a quick and dirty level generator that isn't meant to actually generate anything special... it's just meant to show random tiles so I can play around with the tiles themselves. The problem, however, is that sometimes, I'll get tiles that half-appear, or appear to push other tiles over a random number of pixels.
This only seems to happen after I re-generate the level 5+ times, but hey... it's random, so who knows, right?
So is there something I'm doing wrong here?
SFMLApp.h:
http://pastebin.com/67LNpf9VSFMLApp.cpp:
http://pastebin.com/NrjQKSKzLevel.h:
http://pastebin.com/Ve4FET96Level.cpp:
http://pastebin.com/60WXYBfATile.h:
http://pastebin.com/DSU6C5xMTile.cpp:
http://pastebin.com/C5eG5q6JSeems like a lot of code to ask you to review, but really all you should need to look at is the GenerateLevel() method of the SFMLApp class and the Tile class' constructor and Draw() method. I just included the rest in case you need to see how I'm handling something specific.
I've attached some screenshots of the problem itself. All tiles should be the same distance from each other... 48 px, and if you'll notice, some of the tiles are pushed over slightly, or the tile's image itself will even be cut off.
Can anyone take a guess as to what's causing this?