Sign in to follow this  
Grdman

Mouse lag with directx input

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
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

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