Jump to content
  • Advertisement
Sign in to follow this  
Grdman

Mouse lag with directx input

This topic is 4870 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 have a problem with directx input. I have made my own mouse class that keeps track of and renders (with direct3d) a home made mouse cursor. It will move the mouse at every frame depending on the data I get from: GetDeviceState(sizeof(DIMOUSESTATE2), &mouseState ) My problem is now that when my framerate drops under 50 FPS the mouse starts to feel slow. If I use DISCL_NONEXCLUSIVE mode I can see the windows mouse curser at the same time and it is responding mutch quicker (if I let them start at the same position and then move them around its allmost like my cursor is following the windows curser as a mouse trail). Im not using the buffered mode but that cant be the problem can it? The value I get from mouseState.lX or mouseState.lY are a value based on how long the mouse have moved since the last call isn't it. DirectX input are supposed to be a fast way of getting data from the mouse so I must be doing something wrong, Its allmost like I get the data a couple of frames to late every time. I think I have done this in a stright up way so somebody else must have seen the same problem, and I would be most greatful if I could get any help. If you didn't understand my question or think that I gave to little infomation please just ask and I will explain.

Share this post


Link to post
Share on other sites
Advertisement
Are you drawing the cursor like a "normal object"? Drawing the cursor that way has always seemed laggy to me regardless of the FPS. If you use SetCursorProperties then DirectX will handle drawing the cursor for you and stuff doesn't feel laggy. That's my opinion anyway.

Share this post


Link to post
Share on other sites
Hello,

Base on you description, I assume that you call the function GetDeviceState() in every update. And I assume that you draw you mouse cursor after you update the position of your mouse. If it is true, it means that how frquenct you draw you mous base on how frequent you do a update which is related to your overall frame rate. In DirectX documentation, it introduces another approach which read the buffered mouse data base on the mouse event, and let Windows itself to draw the mouse cursor on the screen. You can take a look out of this I wish it will help!

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!