Hello,
I know this problem isn't new. I searched, found workarounds, and they didn't work for me or at least I don't fully understand the topic and would like to know more. I hope you can help me out here.
I have animated sprites in a game, using the
SetTextureRect() function
1. The spritesheets have no gaps between the single images. The game uses a view to resize an area of 640x480 units to the full screen while keeping the aspect ratio. Example: for 16:9, the 640x480 area is resized to 1440x1080 and has black borders to the left and right. The example sprite below is also scaled (uniformly by 3).
This is what I get:
Notice the black stripes above and to the left? This is a part of the next image, and I don't like it. In
this thread, Laurent said that it's intended behaviour, but I can't quite understand the intention.
What I tried:- Rounding the coords to integral numbers before drawing
- The above, subtracting 0.375f in each direction (is this still valid in SFML 2.1?)
- The above, but subtracting 0.375f*scale
- Creating a gap between the images in the spritesheet of course solves the problem, but does not seem like the most elegant solution...
Could someone explain to me why this is happening, and if there is a workaround?
If you want to see the game, and the error, in action, you're
welcome to do so Thanks a lot,
David
1Actually I'm using SFML.Net with C#, so it's
TextureRect's setter.