Hello there
Recently I've started toying with SFML and encountered problem. Hope I can get some help/explanation here.
First off I'm using SFML 2 fresh build (like 2 days old) with MinGW, win7 x64 if that matters.
I wanted to move dot around screen without removing its trail but even when its not supposed to move anymore(moved out of screen - stopped drawing) I can see whole window content blinking and dot trail "animating". It's almost as if buffers were different and were constantly swapped.
#include <SFML/Graphics.hpp>
int main()
{
sf::VideoMode Vmode(800, 600, 32);
sf::RenderWindow Window(Vmode,"");
sf::Vector2f ppos;
sf::Vector2f vec;
sf::Event Event;
vec.x = 5;
vec.y = -1.5;
sf::CircleShape D;
D.SetRadius(3.0f);
D.SetFillColor(sf::Color(255,0,0));
while (Window.IsOpened())
{
if(ppos.x+vec.x<800 && ppos.y+vec.y<600 &&(ppos.x+vec.x)>1 && (ppos.y+vec.y)>1)
{
ppos.x=ppos.x+vec.x;
ppos.y=ppos.y+vec.y;
D.SetPosition(ppos);
}
while (Window.PollEvent(Event))
{
switch (Event.Type)
{
case sf::Event::Closed:
Window.Close();
break;
case sf::Event::KeyPressed:
if(Event.Key.Code == sf::Keyboard::Escape)
Window.Close();
break;
case sf::Event::MouseButtonPressed:
if(sf::Mouse::IsButtonPressed(sf::Mouse::Right))
{
ppos.x=Event.MouseButton.X;
ppos.y=Event.MouseButton.Y;
}
break;
default:
break;
}
}
Window.Draw(D);
Window.Display();
}
return 0;
}
any idea what is real cause and how to prevent it?