Registering mouse wheel in SDL2?

Probably a stupid question, but how exactly does one register the moving of the mousewheel in SDL2? I googled the issue and the answer on all accounts was using the button state SDL_BUTTON_WHEELDOWN or SDL_BUTTON_WHEELUP but this doesn’t seem to exist as my compiler so eloquently tells me these are “undeclared identifiers.”

Under SDL_BUTTON I have: SDL_BUTTON_LEFT, SDL_BUTTON_RIGHT, SDL_BUTTON_MIDDLE (Which is pressing the middle button, not rolling it!), SDL_BUTTON_X1 and SDL_BUTTON_X2.

I’m confused, was this a feature in previous SDL versions and then removed, or where has it gone?

Does this wiki page help?
https://wiki.libsdl.org/SDL_MouseWheelEvent--
Melker Narikka

On Sun, Sep 21, 2014 at 7:53 PM, Bananskrue wrote:

Probably a stupid question, but how exactly does one register the moving of
the mousewheel in SDL2? I googled the issue and the answer on all accounts
was using the button state SDL_BUTTON_WHEELDOWN or SDL_BUTTON_WHEELUP but
this doesn’t seem to exist as my compiler so eloquently tells me these are
"undeclared identifiers."

Under SDL_BUTTON I have: SDL_BUTTON_LEFT, SDL_BUTTON_RIGHT,
SDL_BUTTON_MIDDLE (Which is pressing the middle button, not rolling it!),
SDL_BUTTON_X1 and SDL_BUTTON_X2.

I’m confused, was this a feature in previous SDL versions and then removed,
or where has it gone?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi there,

I believe it is the SDL_MOUSEWHEEL event that you are looking for – you can access its X, Y axis via event.wheel.x, event.wheel.y. Check out the documentation for it at https://wiki.libsdl.org/SDL_MouseWheelEvent?highlight=(\bCategoryStruct\b)|(CategoryEvents)

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>On 2014/09/ 21, at 11:53, Bananskrue wrote:

Probably a stupid question, but how exactly does one register the moving of the mousewheel in SDL2? I googled the issue and the answer on all accounts was using the button state SDL_BUTTON_WHEELDOWN or SDL_BUTTON_WHEELUP but this doesn’t seem to exist as my compiler so eloquently tells me these are “undeclared identifiers.”

Under SDL_BUTTON I have: SDL_BUTTON_LEFT, SDL_BUTTON_RIGHT, SDL_BUTTON_MIDDLE (Which is pressing the middle button, not rolling it!), SDL_BUTTON_X1 and SDL_BUTTON_X2.

I’m confused, was this a feature in previous SDL versions and then removed, or where has it gone?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Aah Thanks to both of you, I did find SDL_MOUSEWHEEL it just didn’t help me figuring which way the wheel was rolling.
Furthermore, I also did find SDL_MouseWheelEvent but didn’t realize it was a part of the SDL_Event class, this explains everything.

Thanks so much! I was really stumped here.