Hi everyone,
I have a problem with drawing a simple sprite from an image.
Sometimes a black line at the right end of the image appears (its not regularly).
I created a minimal example to show this.
(I hope that you will see the same effect, a friend of mine already confirmed, that he has the same effects).
I uploaded the image I used here:
http://www.megaupload.com/?d=GPPOH5RPHere is the source code:
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
int main()
{
sf::Image img;
img.LoadFromFile("marioandluigi.png");
img.SetSmooth(false);
sf::Sprite mario(img);
int x = 0;
mario.SetSubRect(sf::IntRect(1+17*x, 232, 1+17*x+16, 232+32));
mario.SetScale(5,5);
int xDir = 1;
sf::RenderWindow app(sf::VideoMode(800, 600, 32), "SFML Window");
while(app.IsOpened())
{
sf::Event event;
while (app.GetEvent(event))
{
if(event.Type == sf::Event::Closed)
{
app.Close();
}
}
app.Clear(sf::Color::Green);
app.Draw(mario);
if(mario.GetPosition().x > app.GetWidth() - mario.GetSize().x)
{
xDir = -1;
}
if(mario.GetPosition().x < 0)
{
xDir = 1;
}
mario.Move(app.GetFrameTime() * 100 * xDir, 0);
app.Display();
}
return 0;
}
Please tell me if you have any clue, why this line appears.