gainput icon indicating copy to clipboard operation
gainput copied to clipboard

Mouse Scrolling

Open Neconspictor opened this issue 9 years ago • 2 comments

Hi,

I have one simple question: For mouse input i use a gainput::InputDeviceMouse object and id didn't find out, how to capture mouse scrolling (i work on Windows 7). I initialized the InputDeviceMouse with gainput::InputDevice::AutoIndex and gainput::InputDevice::DV_STANDARD, as with gainput::InputDevice::DV_RAW it didn't work, at all (no mouse input was registered). As a next step i tested all mouse buttons, but no one did the wished result.

So: How is it possible to capture mouse scrolling?

Neconspictor avatar Oct 19 '16 18:10 Neconspictor

Mouse scrolling is represented as boolean buttons. That means the buttons gainput::MouseButtonWheelUp and gainput::MouseButtonWheelDown will be down for one frame if the user is using the scroll wheel on the mouse. That means if you call gainput::InputDevice::GetBool(gainput::MouseButtonWheelUp) on a mouse device it should return true for exactly one frame.

Does that help?

jkuhlmann avatar Oct 20 '16 18:10 jkuhlmann

Unfortunately, no it doesn't help. My first approach was to use a gainput::InputMap to map my own enum to the scroll wheel, but your tip doesn't work ever. Left, right and middle mouse buttons work just fine, but it seems to me, that the WM_MOUSEWHEEL message isn't properly handled. At least i know, that this message is sent to the gainput::InputManager via gainput::InputManager::handleMessage().

Neconspictor avatar Oct 21 '16 12:10 Neconspictor