Hello everyone,
I want to move a line from left to right and it must look like a smooth movement.
Unfortuantely I didnt get this working so far, the movement seems not to be smooth, especially, when I maximize the screen.
I looks like sometimes the line jumps a bit and sometimes it seems to flicker and so, it just doesen't look good.
Here is the code which I used:
int main()
{
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
//both with and without verticalsync it doesent look good.
App.UseVerticalSync(true);
sf::Shape line(sf::Shape::Line(0,0,200,200,2,sf::Color::Green));
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
}
App.Clear();
line.Move(App.GetFrameTime() * 50, 0);
if(line.GetPosition().x > App.GetWidth())
{
line.SetPosition(0, line.GetPosition().y);
}
App.Draw(line);
App.Display();
}
return EXIT_SUCCESS;
}
Would be nice if you have any suggestions to improve this.
Edit: I Just tested it on other pcs and there it just runs fine, so its probably a problem with the graphics driver or my hardware is too old (which I dont think).
I'm using a GForce 6200 Graphics card at this pc, which is indeed not very new, but I think it should be good enough to display some lines :-)