reading input without focus

Hello,

is it possible to monitor pressed Keys e.g. from a x-box controller with JInput when the application is out of focus?

afaik JInput uses the JNI Interface, so basically it should be possible.

Yes.

Great. ;D

With the application i wrote it didn’t work. I used the getEventQueue() method. (as shown in the getting started section)
As soon as my application is out of focus it stops getting signals.

What am I doing wrong? What might be the problem?

Which plugin are you using?, which platform?

Endolf

It’s running on Windows XP SP3 so far.
Well, if you ask like this… I took the JInput binarys I found in one of my older projects, so it’s from February 2010.

Ok, so windows, and I’m guessing you have not set the property to define which plugin to use?

There are posts here and here regarding focus and how to get it to always work, and the side effect.

HTH

Endolf

Right, I didn’t define the plugin.

It works :slight_smile: So far I’m happy.

now I just need to find out how to differentiate the input…Keyboard and mouse is all the same, but a gamepad has its own name.
Is there any device ID to read out… I mean the OS can differentiate between two mice, and with default Plugin JInput too. But with JInput the name of the mouse might be the same (HID compliant mouse for both) and its no problem for JInput to know which does what.

To save some space: where do I find something like a TODO list and what has changed in the last time, so I don’t have to ask each time.

Hi

Currently, there is no way to identify each instance of a device where the name is the same, we use what the OS gives us. Under directx you only get 1 mouse and 1 keyboard listed even if more are plugged on (the values from each device are combined but the OS, so we don’t see them as unique devices).

There are no TODO or release notes normally, if something significant changes it will probably be posted to JGO somewhere.

Endolf

OK

thx for the quick help

I wrote a wrapper class for the 360 controllers:
http://code.google.com/p/pg3b/source/browse/trunk/Java/#Java%2Fsrc%2Fcom%2Fesotericsoftware%2Fcontroller%2Finput
There is also a very lightweight native lib for Windows to use XInput to interface with the controllers:
http://code.google.com/p/pg3b/source/browse/trunk/Java/jni/xinput/xinput.c?r=189