Jump to content
  • Advertisement
Sign in to follow this  

Raw Input for two mice.

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

I'm trying to make a game where you can use two mice at the same time. I have it working but there is a small bug (so far). Whenever I move one cursor the other has some 'residual' movement too. It doesn't move in the same direction but it has some movement that shouldn't be there. My code in 'LRESULT CALLBACK default_window_proc' looks like this:
static int M1RelX = 0; 
static int M1RelY = 0;
static int M2RelX = 0;
static int M2RelY = 0;
//   --code removed ---
                 case WM_INPUT: 

		        M1RelX += get_raw_mouse_x_delta(1);
			M1RelY += get_raw_mouse_y_delta(1);
			M2RelX += get_raw_mouse_x_delta(2);
			M2RelY += get_raw_mouse_y_delta(2);
		  if (M1RelX > 800){M1RelX = 800;}
		  if (M1RelX < 0){M1RelX = 0;}
		  if (M1RelY > 600){M1RelY = 600; }
		  if (M1RelY < 0){M1RelY = 0; }

		  if (M2RelX > 800){M2RelX = 800; }
		  if (M2RelX < 0){M2RelX = 0;}

		  if (M2RelY > 600){M2RelY = 600;}
                  if (M2RelY < 0){ M2RelY = 0;}
		  return 0;

Definition and declaration files for raw-input functions: raw_mouse.c raw_mouse.h I'm not very fluent with Win32API so I used this page as a starting point. The demo application on that page seems to work fine. However when I try to implement it in my code I get the problem described above. Can anyone point what might be wrong? [Edited by - Calin on March 1, 2006 3:44:58 PM]

Share this post

Link to post
Share on other sites
There was a bit of discussion on using two mice in a recent thread here:


About that particular way, I don't have time to play with it, sorry. :(


Share this post

Link to post
Share on other sites
I've solved the problem. I found some C# code for RawInput and after adapting my code I got it right. Thanks for that link though, it's good for reference.

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!