Jump to content
  • Advertisement
Sign in to follow this  
ongamex92

WINAPI Mouse movement diff via WinAPI

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

Hi all,

I want to obtain the mouse movement win WINAPI. Basically if the cursor is on the left side of the screen and I move the mouse left, I want to sill get a -x value.
I know that this was possible with DirectInput, but I cannot find a WinAPI equivalent. Is there any?

Share this post


Link to post
Share on other sites
Advertisement

Yeah, Raw Input does but you still need to get the mouse initial position by WINAPI call GetCursorPos unless you now the direction but do not now the position of your cursor

Share this post


Link to post
Share on other sites

GetRawInputData actually gives your the mouse motion in the X/Y directions, you can call it in response to a WM_INPUT event, after making sure to call RegisterRawInputDevice so that your window actually receives the events.

https://msdn.microsoft.com/query/dev15.query?appId=Dev15IDEF1&l=EN-US&k=k(WINUSER%2FGetRawInputData);k(GetRawInputData);k(SolutionItemsProject);k(DevLang-C%2B%2B);k(TargetOS-Windows)&rd=true

Share this post


Link to post
Share on other sites

I second or third using RawInput.  Since eventually DirectInput will no longer be supported.  It's pretty easy to use too.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!