1
Graphics / Re: Moving sf::View with mouse
« on: August 07, 2015, 09:18:49 pm »I got everything working now. Thank you for the help!I added the zooming code you linked and it works great. However, when i zoom in or out and then move the image with middle mouse button, the zoom resets to default value. I read through the code and noticed this:You should be aware that that function modifies the view that is used by the window and then sets the window to use that view.sf::Vector2f pos((float)mPos_old.x-mPos.x, (float)mPos_old.y-mPos.y);
camera.move(pos.x, pos.y);
window.setView(camera); // If i remove this, i cant move the image but zoom works.
// If i dont remove it, zooming works but resets whe image is moved.
When you set the view to your own view (camera), it's ignoring any alterations made by the zoom function.
You could either modify the function to pass your view as a parameter and it could alter that one or, after using the function, use something like camera = window.getView();
