Jump to content
  • Advertisement
Sign in to follow this  
Headkaze

Reversing mouse movement

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

Say I have a global mouse hook using WH_MOUSE_LL is it possible to reverse mouse movement (left is right, up is down etc.)?

[Edited by - Headkaze on October 21, 2010 1:39:39 AM]

Share this post


Link to post
Share on other sites
Advertisement
I thought so. I wonder if it's possible to use RawInput and SetCursorPos to position it in reverse. Or would it have to be on a lower level than that? I guess what I'm asking is does anyone know of any way to reverse mouse movement?

Share this post


Link to post
Share on other sites
This is for an app I'm writing to help the disabled. So if anyone has any ideas on how to implement this it would be greatly appreciated.

Share this post


Link to post
Share on other sites
Quote:
Original post by Headkaze
So if anyone has any ideas on how to implement this it would be greatly appreciated.
On older mice you could do this kind of thing very easily.

Buy an older mouse. Open it up. Reattach the horizontal and vertical sensors. Put the screws back in.

You can also use an older trackball circuit and stuff the guts into a mouse body for the same effect.

Since you can have multiple mice controlling a PC's cursor just fine, hook up both your regular mouse and reversed mouse.

Share this post


Link to post
Share on other sites
Thanks frob but there are new mice that you that allow you to reverse movement via software anyway but it's only for that particular hardware.

I was hoping for a universal solution via software. I'm starting to think it's not possible though.

Share this post


Link to post
Share on other sites
Quote:
Original post by Headkaze
I thought so. I wonder if it's possible to use RawInput and SetCursorPos to position it in reverse. Or would it have to be on a lower level than that? I guess what I'm asking is does anyone know of any way to reverse mouse movement?
Actually, out of curiosity, I quickly checked your approach, with DirectInput though. The device gives me relative coordinates, bookkeeping and a simple calculation (screensize - absolutecoords) "inverts" the mouse globally when feeding it to SetScreenPos. Checked if I can "work" with such a mouse (clicking buttons, menus, selecting text, writing this post). Seems fine. But can't say if this will be sane for everything (e.g. login screen behaves normal).

Share this post


Link to post
Share on other sites
If you return nonzero from the hook procedure of a low-level mouse hook, doesn't the mouse event get filtered out? So couldn't the OP block all mouse movement messages with a low-level mouse hook and then invert cursor movement by fabricating synthetic mouse events with SendInput() or mouse_event()?

Share this post


Link to post
Share on other sites
(from PM):
Quote:
I tried setting the input mode to DIPROPAXISMODE_REL and using screensize - coords but it is not reversing the mouse movements.
Ok, here we go. You probably missed the "bookkeeping" part, which should be something like (pseudo code)
coords = clamp(coords + relative_coords, screensize)
where relative_coords is what you receive from DirectX or raw input. Just make sure the numbers make sense, e.g. by logging. Show your code if it still does not work.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!