I´m currently dealing with some Problems concerning dual mouse input. I've looked up several libraries and decided that JInput would do best. Although i was able to get a list of all devices plugged into my laptop, i couldn't retrieve any PollData. The following code only produces 0's:
public static void main(String[] args) {
Controller mouse1 = null;
Controller[] cs = ControllerEnvironment.getDefaultEnvironment().getControllers();
for(int i = 0; i < cs.length; i++) {
if(cs[i].getType() == Type.MOUSE) {
mouse1 = cs[i];
}
}
mouse1.poll();
Component[] comps = mouse1.getComponents();
while(true) {
mouse1.poll();
for(int i = 0; i < comps.length; i++) {
System.out.print(comps[i].getName() + ": ");
System.out.println(comps[i].getPollData());
}
}
}
I also tried out to get KeyBoard-Input with this, same problem. I could get the number of keys, but i was unable to access any information about the key's state. I hope that someone knows how to solve this problem or has an idea what might be causing it.
Thank you in advance, aquatyp.
I know this is almost a year old, but for the benefit of anyone who finds this through Google like I did...
Make sure you have an OpenGL display initialized (note the if statement is there just to eliminate the flood of messages):