Polling mouse wheel scroll state

Started by
5 comments, last by Nanoha 14 years, 5 months ago
Is it possible to poll the scroll state of the mouse wheel? I've just been fixing all my input and swapped everything to be polled instead of using the windows events. The only thing that is left now is the mouse scroll. At the moment I do: case WM_MOUSEWHEEL: InputManager::Instance()->OnMouseScroll((int)wParam); which works BUT it feels horribly delayed (as was all my input untill I started polling instead of catching events). My game is multi threaded to an extent whith the game being updated in one thread and windows messages being handled in another and so that slight delay when my game is being updated that messages cannot be handled is really noticable on input. I'm trying to get my game update method to be: HandleInput Update logic etc Render its just this one tiny scroll thing thats got me stuck. Any help would be appreciated, thanks.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

Advertisement
The mouse wheel doesn't have a state to poll.
Consider using Raw Input, which tends to have lower latency compared to regular WM_MOUSE* messages. The difference is small but noticeable.

However, note that Raw Input:
1. requires Windows 2000 or higher, and
2. does not perform pointer ballistics (mouse acceleration).

#2 is actually great for FPS games, but not so nice on RTS or other games with lots of UI.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

Also make sure you process all windows messages every frame, or you'll get lots of input lag.
Quote:Original post by Adam_42
Also make sure you process all windows messages every frame, or you'll get lots of input lag.


Hmm yeah, perhaps I should rethink the seperate thread for messages.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

Quote:Original post by Nanoha
Quote:Original post by Adam_42
Also make sure you process all windows messages every frame, or you'll get lots of input lag.


Hmm yeah, perhaps I should rethink the seperate thread for messages.
I would think so. In fact I'd rethink the polling approach too. Using Windows messages works great if you do it properly. Your delayed input had to mean you were doing something wrong such as not processing all messages each frame.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Quote:Original post by iMalc
Quote:Original post by Nanoha
Quote:Original post by Adam_42
Also make sure you process all windows messages every frame, or you'll get lots of input lag.


Hmm yeah, perhaps I should rethink the seperate thread for messages.
I would think so. In fact I'd rethink the polling approach too. Using Windows messages works great if you do it properly. Your delayed input had to mean you were doing something wrong such as not processing all messages each frame.


I tried an older version and removed my thread. It works perfect now. I do like the polling idea (wraps everything up neatly) but I guess I shall stick with events.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

This topic is closed to new replies.

Advertisement