I don't think I've missed it anywhere, checked the values on the appropriate (and all other) stat values, etc. There doesn't seem to be a way to get the mouse wheel. This'd be awfully useful in a tool I'm writing. I'm bummed that I have to turn to the dpad/cursor keys while otherwise mousing around in my little gui.
@zep - Assuming I'm not just missing it, would you mind adding the mouse wheel as another stat? Just treat it like an axis; that seems to work better than blipping buttons, in my experience with other APIs. Just increase or decrease the stat value by one each time you get the scroll event.
Please and thanks? :)



Hey Felice. Unless I'm remembering wrong, I think that mousewheel up, down, and click are all bits returned along with left and right click. At least on Windows.
Maybe I'm thinking of SDL though?



Middle click, yes. Scroll, no.
Try this and see:
function _init() poke(0x5f2d,1) end function _update60() mx=stat(32) my=stat(33) mb=stat(34) end function _draw() cls() print(mx) print(my) print(mb) end |



Sorry for the thread necromancy. As of 2022, mousewheel is detectable.
stat(36) -> number representing a mouse wheel event.
Possible values are:
1
roll up0
no roll-1
roll down



You are correct, @lorinc. While it may be common knowledge I did make a tool to demonstrate this recently.
https://www.lexaloffle.com/bbs/?tid=49070
Also put poke(0x5f2d,1)
at the top of your code to activate reading the mouse and keyboard.



Quick note: I believe mousewheel events can have values larger than 1 if people are scrolling quickly? That's what I observed with my test cartridge, anyway.



@packbat, you are correct. I'm - not sure if this could be something useful. I guess if it is farther than -1 or +1 then you could have a unique function like bring up a menu for "quick rolling."
From this code:
poke(0x5f2d,1) repeat ?stat(36) flip() until forever |
It appears as if it will go up to -4 or +4 with very quick rolling.
Update 10-27-22: It could be dodgy to expect an exact number for input. I would continue to use <0 and >0 as a valid value which does register a notch that can be physically felt on the mouse.
Here is a sample program to demonstrate. Run and use the mouse roller.


Examine source to see how it's done.



It looks like scroll wheels are actually calibrated with detents to move in discrete increments? So presumably the numbers go farther than +/-1 so that the same amount of physical rotation of the actual wheel on the actual mouse always adds up to the same amount of scroll wheel input, however quickly you move it.
[Please log in to post a comment]