Two mouse inputs

I am making a game where I need two different mouse inputs. How can I do that with Processing?

1 Like

the question is more:
is there any computer / operating system what supports 2 pointer devices?

did you already connect 2 mouse to your computer and see 2 different mouse pointers on the screen?

one way could be to bypass the operating system and connect like a arduino
via USB, use the serial lib to communicate with it and make processing sketch
what use the standard mouse AND a coded mouse from arduino serial.

1 Like

Abi : what do you mean?

Like

  • e.g. draw a line and one mouse click is the start of the line, the next the end of the line? So the mouse inputs can signify different things in a sketch?

  • Or using two mice on one computer?

I dont know if there is a way to take 2 mouse inputs.

Most OS’s dont see the difference between mice, so I think your only hope would be some way of taking the input before the OS gets it.

The best place to start finding out how to do this probably is This dude obsessed with hotkeys trying to do the same thing with keyboards

1 Like

I believe most OS’s don’t support two mouses. But maybe a program will allow you to have two separate pointers. What you could always do is to make an in - game cursor which is controller by the arrows key and two buttons of your choice for left and right click. And the other inputs are from the actual mouse both will work and a nice solution to accommodate two pointers !

I think I tested multiple (two) mice a few years ago, if I remember correctly you couldn’t actually do anything with the second mouse pointer. And I’m not sure how i did it, I think it was AHK (AutoHotKey). Or maybe Glovepie.

Anyway, in searching a bit for this just now, I found this. Haven’t tried any of these myself (yet) btw.

MouseMux
Found link from (apparently) the dev in the comments on this page, which also lists a couple of other options.

And some AHK links (not what I tried):
AutoHotInterception
And another thread
There are more out there ofc, just listing a couple FYI.

EDIT: Btw it seems MouseMux supports fully functional multiple mice (and keyboards), from its description.

2 Likes

I looked into the ones you suggested. I am not very experienced, and I was looking for a way to get mouseX and mouseY from both mice. My OS only supports one cursor.

The second one. I wanted to be able to have two different mouseXs and mouseYs to move two separate objects at once. I know Java has libraries dealing with mouse inputs. If Processing had something specific to it, it would be nice, but even a Java library would be manageable for me. I don’t have much experience.

1 Like

Kind of forgot about that part, I have no idea, sorry. Unless you can find another Java (or Processing) work-around to get multiple mouse inputs, I think kll’s suggestion above is the best bet.