Hello,
I’m working with jinput to access my 360 controller, and have nearly everything working properly. However, one question: with the two analog sticks, the way that I am currently accessing them only sends information back to the application when the stick’s value changes. So, if I hold a stick in the same position (be it 1, -1, .423162346 or whatever else) no continuous data stream is sent back to the application.
How would I go about allowing for that?
My current code looks something like this:
Controller[] ca = ControllerEnvironment.getDefaultEnvironment().getControllers();
for(int i =0;i<ca.length;i++){
//If controler is a gamepad, name it xbox
if (ca[i].getType() == Controller.Type.GAMEPAD) {
xbox = ca[i];
}
}
while (true) {
xbox.poll();
EventQueue queue = xbox.getEventQueue();
Event event = new Event();
while (queue.getNextEvent(event)) {
Component comp = event.getComponent();
float value = event.getValue();
//Code to handle other buttons...
if (comp.getName().equals("X Axis")) {
//Take action off the value
}
//Code to handle other buttons
}
Thanks for any help you can offer.