Hi,i'm learning both c++ and sfml and i did a simple camera movement with 4 keyboard keys.
sf::View view(sf::FloatRect(0, 0, 640, 360));
window.setView(view);
if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))//move the camera up
{
view.move(0, -32);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::X))//move the camera down
{
view.move(0, 32);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))//move the camera left
{
view.move(-32, 0);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::C))//move the camera right
{
view.move(32, 0);
}
My problem is that the camera move double the distance.
example : view.move(32, 0) will make the view/camera move 64 pixels to the right and not 32.
Is that normal ?
Why ?