Hi there, I have some code to move an object in sync to the mouse moment in X... I am using getPostion(rw); but I was wondering if this is the best way to do it.. my application seams to be having a slight strobie look to it.. and I was wondering if this can be fixed.. maybe my methods is not a good solution.
I am passing a float for time, but as of yet it is not getting used.. and the frame rate of the window is set to 60.
void goArkanoid::Update(sf::RenderWindow& rw, float TimeElapsed)
{
sf::Vector2f CurrentMousePos((float)sf::Mouse::getPosition(rw).x, 671);
sf::Event event;
rw.pollEvent(event);
if (event.type == sf::Event::MouseMoved)
{
if (GetPosition().x < sf::Mouse::getPosition(rw).x)
{
GameObject::SetTile(RIGHT);
}
if (GetPosition().x > sf::Mouse::getPosition(rw).x)
{
GameObject::SetTile(LEFT);
}
GameObject::SetPosition(CurrentMousePos);
std::cout<<"xM = "<<CurrentMousePos.x<<"\n"<<" "<<sf::Mouse::getPosition().x<<"\n\n";
}
if (GetPosition().x == sf::Mouse::getPosition(rw).x)
{
GameObject::SetTile(STOPPED);
}
}