Jump to content
  • Advertisement
Sign in to follow this  
ejthayer

Sensing/polling mouse movement

This topic is 4501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm sure many of you are thinking that doing this is easy. But that is really not the case if you want to do it well. The problem I am having is sluggish mouse movement. The DirectX GetDeviceState has a major problem. The mouse info it returns is actually about 4 to 5 frames old instaed of returning the current mouse state as the docs say it does. This slightly old info results in a very sluggish movement to the mouse. Games that I have played that have this problem are Hitman 2, Grand Theft Auto SA, and Serious Sam. I'm sure others do as well but I try not to play too much because it takes away from work time. World of warcraft on the other hand has this problem solved. They sense mouse input so that even if the game is running at 10 fps the mouse still moves around the screen or moves the viewpoint perfectly. This greatly increases the quality of game play in low FPS situations. Does anyone know or have suggestions on how to get the current exact mouse position from windows?

Share this post


Link to post
Share on other sites
Advertisement
Hey ejthayer,

Have you tried getting to the mouse through the vanilla GetCursorPos function? Not sure if GetDeviceState has overhead in DirectX's interfacing system, but I guess it might be worth a shot...unless, of course, GetDeviceState on the mouse is just a wrapper for GetCursorPos...a little bit of research didn't turn up anything for me, but I just googled it/MSDNed it and looked at the first few results.

Hope that helps,
Aviosity

Share this post


Link to post
Share on other sites
Maybe the mouse cursor is rendered by DirectX which in case of low framerates will slowdown the mouse as well, unlike The Sims 2 which I think changes the windows cursor instead which isn't rendered by the application. I am guessing WoW does this too.

Share this post


Link to post
Share on other sites
Hi, I'm very very very newbie but I'm programming an application and the only way ?ve founded to catch the mouse position, and events is throught windows API, using uMsg and casting it in a switch/case WM_LBUTTONDOWN....

If I'm doing something wrong, please tell me.

Sorry for my bad writting.

Share this post


Link to post
Share on other sites
Yes I have tried the GetCursorPos, it returns the same old data that DirectInput does. Currently I'm trying some things in assembler to get the up to date mouse info.

Using the windows message system to get mouse info works OK in some cases but is usually the slowest way to go.

Share this post


Link to post
Share on other sites
Is this a single-threaded application? If not, there may be an issue with that, where one thread is in a long processing loop and doesn't return the mouse info. But now I'm just shooting in the dark, maybe someone with more experience has an answer?

Aviosity

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by falledAngel
Hi, I'm very very very newbie but I'm programming an application and the only way ?ve founded to catch the mouse position, and events is throught windows API, using uMsg and casting it in a switch/case WM_LBUTTONDOWN....

If I'm doing something wrong, please tell me.

WM_MOUSEMOVE is probably more suitable, as it doesn't require the user to click; but, as the OP noted, messaging is the slower approach.


Quote:

Sorry for my bad writting.

Your writing is legible, which is what really matters[smile].

OP, have you considered the Raw Input API before resorting to ASM?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!