I want to capture the movement of the analogue stick of the gamePad.

is there any equivalent function to this?

 public void mouseMoved(MouseEvent mouseEvent) {
    mouseEvent.getX(); //return the X coordinate of the cursor inside a component
    mouseEvent.getY();//return the Y coordinate of the cursor inside a component

into lwjgl.input.Controllers, I found controller.getAxisValue() but this one doesn't work as the function above.


Define 'doesn't work as the function above' -- what would you expect and what are you getting? Controller.getAxisValue(..) is the correct way to read gamepad inputs.

Check the Controller.getPovX/Y(), .getButton(..) and other methods too. Also, please note that there is no standard stick/button/trigger/etc to axis/key mapping so you'll get different values for different controllers, some controllers will report negative values for left/down, some will report negative for right/up, some will report keys as buttons, some as analogue inputs with only two values or a mix of the two, and there are also analogue triggers/shoulders -- in short, be prepared for a curiosity show :)

| improve this answer | |
  • \$\begingroup\$ There is a small part of what we could call "standrad" with getXAxisValue() and getYAxisValue(). It works on (almost) all gamepads. But for the other axis and buttons, there is no way telling which is what. \$\endgroup\$ – Alexandre Desbiens Jul 29 '14 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.