After a number of requests I’ve given in and written this
Any comments on this information should be made in other threads and I’ll update this one to prevent it getting messy.
- Go here and download the latest JInput binaries.
- Unpack the zip file somewhere temporarily. You should get a dist folder, and in there,
[list]
[li]jinput-dx8.dll - jinput-raw.dll
- jinput-test.jar
- jinput-wintab.dll
- jinput.jar
- libjinput-linux.so
- libjinput-osx.jnilib
[/li] - Copy jinput.jar and the dlls, so, or jnilib to somewhere handy and add the natives to your java.library.path.
[/list]
The jinput-test.jar contains 3 test applications, one to dump the name and details of each controller, one to open up a gui to show the values of each of the components on each of the controllers, and a rumble test for any rumbling controllers.
You can run the tests in the dist folder by running
java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.ControllerTextTest
java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.ControllerReadTest
java -Djava.library.path=. -cp jinput.jar:jinput-test.jar net.java.games.input.test.RumbleTest
On windows you’ll need to change the :'s to ;'s
Without reproducing the javadoc here, the basic principle is that you ask the DefaultControllerEnvironment for a list of controllers. Controllers are things, a joystick, the keyboard etc. Each controller potentially has subcontrollers, but for most devices, these are not used.
Each controller also has a list of components, buttons and axis.
Components have a value and a bunch of information about it, relative or absolute, normalised (values are between -1 and +1).
At it’s simplest, thats it, and thats as much detail as I want to go in to here
HTH
Endolf