Hi there...
check this code snipit
sf::Event event;
// Mouse Position tmp Variables
sf::Vector2i position = sf::Mouse::getPosition(window);
<SNIP A LARGE CHUNK OF CODE>
case sf::Event::MouseMoved:
position=sf::Mouse::getPosition(window);
std::cout<<"Position X = "<<position.x<<" Y = "<<position.y<<std::endl;
std::cout<<"mouseButton.x = "<<event.mouseButton.x<<" Y = "<<event.mouseButton.y<<std::endl;
std::cout<<"Mouse moved - X: "<<event.mouseMove.x<<" Y: "<<event.mouseMove.y<<std::endl<<std::endl;
break;
it is my understanding that event.mouseButton.x returns the current mouse position before the mouse is moved, unlike event.mouseMove.x witch returns the x position of where the mouse was moved to? What is happening though is mouseButton.X is giving me the window cords of the mouse's Y position and the .y is returning junk.
here is a example of what si wrong -
http://screencast.com/t/U2JgoqR1eWhat I am trying to do is simply make left or right mouse moment to move teh block left or right, but not have it relative to mouse position, so it is just testing that the mouse moved left or right, not to were it is pointing at all. The plan was to have a tmp variable for the current mouse position in X only, then if the mouse moves say 34 pixles left register that as a single left moment and move the block, then reset the tmp variable to this new spot.