Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (775)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  2 mice  (Read 5264 times)
0 Members and 1 Guest are viewing this topic.
Offline porjo

Junior Newbie

« Posted 2007-05-10 10:54:33 »

I've been wondering about putting together a 'Sale of the Century' type game for kids. I'd like to be able to use off-the-shelf hardware, so had thought of just using a few USB mice as buzzers. Each contestant would be given a mouse to hold. The software would listen for the first button click and display a message or play a sound to indicate which mouse that corresponded to.

Is it possible to detect mouse events from different mice plugged into the same system and distinguish them from each other? If not, I imagine I could probably do it with gamepads instead.

Any advice would be appreciated.
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #1 - Posted 2007-05-10 12:32:41 »

It's possible with XP, but not with NT, 2k or win9x (afaik).

I don't know how it's with Mac/Linux, but I could imagine that it works there.

However, I don't know if it's supported by JInput.

You Don't Know Jack used the keyboard for example (on Windows and Mac), which worked pretty well with 2 players and was sorta cramped with 3 players.

弾幕 ☆ @mahonnaiseblog
Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #2 - Posted 2007-05-10 18:27:03 »


Under windows XP, you can disable the directx plugin and use the 'Raw' plugin, this will expose multiple mice if you have them. Example, my laptop has a built in mouse, but I plug in an external usb mouse as it's easier to use when I have a desk to put my laptop on. Using the platform default plugin on windows shows 1 mouse. With the raw plugin, I get 2.

You have to disable the directx plugin becase both plugins can't capture the device(s) at the same time it appears.

To disable the default platform plugin add the property jinput.useDefaultPlugin=false and to list the plugins you with to load, add their classes to the jinput.plugins property, for the raw one, you want So to run the controller read test that comes with jinput, in the main directory, you should be able to run java -Djava.library.path=dist -cp dist\jinput.jar;dist\jinput-test.jar -Djinput.useDefaultPlugin=false

Under Linux it should already pick multiple mice up anyway. I'm unsure about OSX, and have no way to test, I'll try giving Elias a prod and see what falls out Smiley



Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline elias

Senior Devvie

« Reply #3 - Posted 2007-05-11 04:47:04 »

@oNyx: On other windows' than XP, the (default) DirectInput plugin should work. The Raw plugin is only there to fix the stupid decision by microsoft to exclude multiple mice (and keyboards) from DirectInput.

An alternative way to get the raw plugin is to try a "new RawInputEnvironmentPlugin()" before you try ControllerEnvironment.getDefaultEnvironment(). As Endolf stated, it's important that you don't have both the default DI plugin and the raw plugin active at the same time since directinput and raw input steps on each other's toes.

@Endolf: Multiple mice on mac should just work.

Offline porjo

Junior Newbie

« Reply #4 - Posted 2007-05-11 05:19:56 »

So to run the controller read test that comes with jinput, in the main directory, you should be able to run java -Djava.library.path=dist -cp dist\jinput.jar;dist\jinput-test.jar -Djinput.useDefaultPlugin=false

I tried that on my WinXP box with two USB mice connected and it worked perfectly. The test pops up a window displaying the properties for each mouse and the keyboard. I can click the mouse buttons and see the corresponding properties change for that mouse.

Excellent, thanks.
Pages: [1]
  ignore  |  Print  

hadezbladez (45 views)
2018-11-16 13:46:03

hadezbladez (50 views)
2018-11-16 13:41:33

hadezbladez (29 views)
2018-11-16 13:35:35

hadezbladez (20 views)
2018-11-16 13:32:03

EgonOlsen (1900 views)
2018-06-10 19:43:48

EgonOlsen (1936 views)
2018-06-10 19:43:44

EgonOlsen (1286 views)
2018-06-10 19:43:20

DesertCoockie (1718 views)
2018-05-13 18:23:11

nelsongames (1411 views)
2018-04-24 18:15:36

nelsongames (2041 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!