Sign in to follow this  
BlackJoker

[SharpDX] Correctly handle mouse delta in Raw input

Recommended Posts

Hello. I am writing my own handler for RawInput in sharpDX and for now I am stuck with mouse events.

The thing is that I want to receive mouse delta X and Y, but faced with the issue. When there is no mouse movement, mouse delta keep staying at the last value, which is not 0, so, even if I dont move mouse, my camera (for ex.) still will be rotating, because Delta in not 0.

 

Could someone share experience how to handle this thing correctly?

 

Also I would like to know how to get absolute mouse coordinates from raw input, because for know I am getting only delta values..

Edited by BlackJoker

Share this post


Link to post
Share on other sites

Ok, seems I get it myself. 

I found out that mouse can send more than one event before my input update mehod with called and I used earlier only last deltas. SO, movement was jerky.

Now I create a buffer for deltas and update camera rotation in loop.

Now camera rotations become much smoother.

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