hi
I just downloaded the latest distribution from jinput.dev.java.net. So far I used the jar, which is distributed with LWJGL. Why do I need natives now even though I didn’t need any with the (supposed to be) older jar?
Anyway, my test code worked with the older jar and with the latest one (with correctly setup natives) I cannot run it anymore and get the following exception:
Loading: net.java.games.input.LinuxEnvironmentPlugin
java.lang.UnsatisfiedLinkError: nGetAxisMap
at net.java.games.input.LinuxJoystickDevice.nGetAxisMap(Native Method)
at net.java.games.input.LinuxJoystickDevice.getDeviceAxisMap(LinuxJoystickDevice.java:200)
at net.java.games.input.LinuxJoystickDevice.<init>(LinuxJoystickDevice.java:70)
at net.java.games.input.LinuxEnvironmentPlugin.enumerateJoystickControllers(LinuxEnvironmentPlugin.java:406)
at net.java.games.input.LinuxEnvironmentPlugin.enumerateControllers(LinuxEnvironmentPlugin.java:233)
at net.java.games.input.LinuxEnvironmentPlugin.<init>(LinuxEnvironmentPlugin.java:113)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:157)
at org.jagatoo.input.InputTest.main(InputTest.java:235)
This is my code:
net.java.games.input.Controller[] controllers = net.java.games.input.ControllerEnvironment.getDefaultEnvironment().getControllers();
//net.java.games.input.Controller[] controllers = net.java.games.input.RawInputEnvironmentPlugin.getDefaultEnvironment().getControllers();
for ( net.java.games.input.Controller controller: controllers )
{
System.out.println( controller.getType() );
System.out.println( controller.getComponents().length );
if ( controller.getComponents().length == 144 ) // Keyboard
{
net.java.games.input.Event event = new net.java.games.input.Event();
while ( true )
{
controller.poll();
while ( controller.getEventQueue().getNextEvent( event ) )
{
System.out.println( event.getComponent().getIdentifier() + ", " + event.getValue() );
}
}
}
}
btw. Another question. Why are there keyboards with only one component? Can I ignore them or are they supposed to be good for anything?
Thanks
Marvin