121
General / Re: Making SFML smoother and more accurate
« on: June 17, 2013, 04:58:49 pm »
Alright, I'll eat some pizza first and then post some stuff up
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
if ( event.type == sf::Event::mouseMove );
{
std::cout << "Mouse Move X works!: " << event.mouseMove.x;
std::cout << "Mouse Move Y works!: " << event.mouseMove.y;
}
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.display();
}
return 0;
}
error: invalid use of non-static data member 'sf::Event::<anonymous union>::mouseMove'
To be a bit more precise, it's now sf::Mouse::getPosition().y, if it should be relative to your screen resolution and sf::Mouse::getPosition(window).y, if it should be relative to your window, were window is of type sf::RenderWindow.
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
sf::Vector2i localPosition = sf::Mouse::getPosition( window );
if ( sf::Mouse::isButtonPressed( sf::Mouse::Left ) );
{
spritename1.move ( localPosition );
}
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw( spritewasteland1 );
window.draw ( spritename1 );
window.display();
}
return 0;