SFML community forums

General => General discussions => Topic started by: clampflower on May 22, 2024, 05:23:19 pm

Title: Scroll Wheel
Post by: clampflower on May 22, 2024, 05:23:19 pm
Hi All,

Apologies, as I am fairly new to this game.  I have been programming in C++ / SFML for a while now (months) but got stuck on mouse wheels. How do I use SFML to detect which way a vertical mouse wheel has been scrolled? I am using a Logitech mouse that has a pile of buttons and wheels but the main vertical wheel is the one that I want to detect.

I have been playing Forge of Empires and this scroll wheel controls the zoom function of the map, which is great and so I know this is doable. Would very much appreciate any help.

Many thanks

Moon.
Title: Re: Scroll Wheel
Post by: eXpl0it3r on May 22, 2024, 10:38:53 pm
Have you tried the sf::Event::MouseWheelScrolled event? See the tutorial (https://www.sfml-dev.org/tutorials/2.6/window-events.php#the-mousewheelscrolled-event).

Or are you saying that your mouse has more than one scroll wheel?

As for buttons, SFML also supports two extra mouse buttons (https://www.sfml-dev.org/documentation/2.6.1/classsf_1_1Mouse.php#a4fb128be433f9aafe66bc0c605daaa90).