Hi,
I'm trying to implement mouse movement into my game, but the problem I've been running into is that mouse movement is much slower than movement with other input methods (keyboard and joystick). What I'm doing is checking to see if the mouse moved from the center of the window and then moving the sprite and re-positioning the mouse in the center of the window. I have added the relevant code below.
Thanks for your time and any help you provide in advance! Please let me know if you would like more information.
const sf::Vector2i WINDOW_CENTER(window.getSize().x / 2, window.getSize().y / 2);
sf::Mouse::setPosition(WINDOW_CENTER, window);
window.setMouseCursorVisible(false);
if (the joystick moved left || the left key was pressed ||
sf::Mouse::getPosition(window).x < WINDOW_CENTER.x)
{
move("left")
sf::Mouse::setPosition(WINDOW_CENTER, window);
}
if (the joystick moved right || the right key was pressed ||
sf::Mouse::getPosition(window).x > WINDOW_CENTER.x)
{
move("right")
sf::Mouse::setPosition(WINDOW_CENTER, window);
}
I'm using SFML 2.1 with Visual Studio 2012.