The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Registering mouse wheel in SDL2?
Bananskrue


Joined: 25 Feb 2014
Posts: 7
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?
Registering mouse wheel in SDL2?
Melker Narikka
Guest

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

--
Melker Narikka

On Sun, Sep 21, 2014 at 7:53 PM, Bananskrue wrote:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Registering mouse wheel in SDL2?
Jeffrey Carpenter
Guest

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=%28%5CbCategoryStruct%5Cb%29%7C%28CategoryEvents%29

Cheers,
Jeffrey Carpenter


On 2014/09/ 21, at 11:53, Bananskrue wrote:

Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Bananskrue


Joined: 25 Feb 2014
Posts: 7
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.