Jump to content
  • Advertisement
Sign in to follow this  
sipickles

Syncronising cursor and movement in directX

This topic is 4502 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
Advertisement
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
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!