PDA

View Full Version : SDL mousewheel, have you gotten it to work?


Jesse Aldridge
12-15-2005, 09:06 PM
I'm trying to read the mousewheel via SDL. I added the following to my mouse reading function:

sprintf(buffer, "%i", mouseState);

The buffer later gets written to the screen.
I detect a left mouse click, a right mouse click and a scroll button click, but no scroll wheel movement.

I just upgraded SDL to 1.2.9, which I beleive to be the latest version.

Has anybody gotten this to work?
Using Windows XP.

Sol_HSA
12-15-2005, 10:09 PM
The mouse wheel in SDL is mapped to mouse buttons 4 and 5. If you get an event that mouse button 4 is pressed, the wheel moves in one direction, and 5 for the other direction.

soniCron
12-15-2005, 11:01 PM
I've gotten it to work in XP and 98, though I'm not doing anything special. Are you checking for buttons 4 and 5?

Jesse Aldridge
12-16-2005, 03:52 AM
Oh, right - events! :D

Ok, that might've sounded pretty dumb, but my problem was caused by the fact the I read mouse clicks by directly polling the mouse with SDL_GetMouseState and thought I could handle the mouse wheel the same way.

Works now, thanks.