In my program I wish to be able to know if the mouse wheel has been scrolled, and if so how much in what direction. Is this possible with C++ and SFML?
So far I have this:
if (sf::Event::MouseWheelEvent().delta != 0)
{
SimulationView.zoom(1 + (10 / sf::Event::MouseWheelEvent().delta));
}
But the second line never exicutes, even when I scroll the mouse wheel
You can read the mouse wheel as part of the event loop that is polled once per frame:
Note: For
SFML 2.3
Thanks to @Hiura for pointing out that
sf::Event::MouseWheelMoved
is deprecated inSFML 2.3
.Use this instead: