Sign in to follow this  

Syncronising cursor and movement in directX

This topic is 4221 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

Hello, I've noticed a quirk with my DXGUI. I can selected one of my DX windows by clicking on it. holding the mouse button drags it around the screen, and releasing the mouse button drops it. All okay. The problem is the window doesnt drag at the same rate as the mouse. If the mouse moves quickly, the window is left behind, but if the mouse moves slowly the window actually overtakes the cursor! At present, I am getting the mouse relative X and Y from directInput and moving the window by that amount each frame. I will probably simply set the windows position to the absolute mouse position each frame instead. That may solve it, but I was interested in understanding why this occurs? Thanks for your advice

Share this post


Link to post
Share on other sites
Ok, I tied the position of the window being dragged to the absolute position of the cursor and that works well.

However, the problem seems to have moved!

Depending on the position of the window on the screen, the mouse coords dont always correspond with the rendered position.

At 0,0 (these are transformed screen coords), both mouse coords and window position coincide. As the window is dragged towards the bottom right, the mouse and window begin to diverge, even tho they are apparently at the same point - according to all my debug output!

This is especially noticable on the y axis.

Heres the two extremes:





Debug output shows me that the mouse and window are at the same coords in the second screen shot.


So how come the transformed screen coords do not match the Direct input coords?


Thanks

Simon

EDIT: hmm i am having trouble capturing the cursor! in the first pic it is at the top left of the green window, in the second about 10% across and 20% down the window!

Share this post


Link to post
Share on other sites
Perhaps the rendering set is relative to the top-left of the entire window, and the input set is relative to the top-left of the client area? That's the problem I had with my 3D rendered GUI system.

Share this post


Link to post
Share on other sites
Yes, that sounds plausible.

I am getting even more spurious results when running in full screen mode. THere is definately so sort of disparity here.

Share this post


Link to post
Share on other sites

This topic is 4221 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.

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