I am developing an applet that will use JInput if it is present (in the user’s “lib/ext” directory), or will otherwise fall back to standard java.awt techniques.
Here is the problem:
When JInput is detected on LINUX, keyboard events are detected fine, but mouse events are not.
When JInput is detected on WINDOWS, mouse events are detected fine, but keyboard events are not.
My game depends on keyboard input, so the second problem is worse for me.
Here is the code I’m using to see what events are being detected by JInput:
Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers();
Event event = new Event();
while (...)
{
for (int i = 0; i < controllers.length; i++)
{
controllers[i].poll();
EventQueue queue = controllers[i].getEventQueue();
while(queue.getNextEvent(event))
System.out.println(event);
}
}
By printing out the array of controllers, I can also verify that a keyboard controller is found by JInput in both WINDOWS and LINUX, but it just doesn’t do anything in WINDOWS.
I noticed that a similar problem was described in the thread “JInput and Java 1.6.0_10” although this might be a different problem because in my case there is evidence that things are at least “partially” working.
Is there a solution that doesn’t fundamentally change the delivery approach of an applet loading JInput from lib/ext?
My LINUX Java version is 1.6.0_10-beta-b14 (but I unfortunately don’t have the WINDOWS Java version at hand).
Thank you