Sign in to follow this  
Nanoha

Polling mouse wheel scroll state

Recommended Posts

Nanoha    2682
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.

Share this post


Link to post
Share on other sites
Fiddler    860
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.

Share this post


Link to post
Share on other sites
Nanoha    2682
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.

Share this post


Link to post
Share on other sites
iMalc    2466
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.

Share this post


Link to post
Share on other sites
Nanoha    2682
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this