1
Graphics / Re: Zoom a sf::View to Mouse-Point Center?
« on: January 28, 2015, 07:57:30 pm »
This works for me:
view.zoom(1 - event.mouseWheel.delta*0.1);
view.move(((sf::Vector2f(window.mapPixelToCoords((sf::Mouse::getPosition())) - sf::Vector2f(view.getCenter()))).x)*event.mouseWheel.delta*0.1,
((sf::Vector2f(window.mapPixelToCoords((sf::Mouse::getPosition())) - sf::Vector2f(view.getCenter()))).y)*event.mouseWheel.delta*0.1);
view.move(((sf::Vector2f(window.mapPixelToCoords((sf::Mouse::getPosition())) - sf::Vector2f(view.getCenter()))).x)*event.mouseWheel.delta*0.1,
((sf::Vector2f(window.mapPixelToCoords((sf::Mouse::getPosition())) - sf::Vector2f(view.getCenter()))).y)*event.mouseWheel.delta*0.1);