I found sometimes SFML draw a sprite incorrectly on a particular position or in some cases.
For example, this code can't draw a sprite correctly.
I tested it on SFML 2.1 stable version and latest version also.
Here is the source code and the result screen.
sf::RenderWindow window(sf::VideoMode(800, 600), "Test", sf::Style::Close);
sf::Texture texture;
texture.loadFromFile("texture.png");
sf::Sprite sprite(texture);
sprite.setPosition(16.49849838f, 16.49849838f);
sf::Sprite sprite2(texture);
sprite2.setPosition(16.5f, 50.f);
sf::Sprite sprite3(texture);
sprite3.setPosition(16.f, 85.f);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(sprite);
window.draw(sprite2);
window.draw(sprite3);
window.display();
}
Only third one draw normally.
Actually it can avoid using just integer position.
But, when I draw an animation like this ( move(velocity * dt.asSeconds(); )
SFML will draw an incorrect image a while.
Also sf::Font looks have the same problem.