Issue #3 new

JInput - Controller Axis Value

Anonymous created an issue

When implementing controller support in games, the default value for all axis starts at -1, which is incorrect. They should be initialized to 0.

One a button from each axis is pressed, the controllers work as intended.

For example, lets say I have a controller with a simple d-pad. The default value for axis 0 is -1 (up) and for axis 1 is -1 (left). If I coded my d-pad to control a character in my game, my character would start out walking up and to the left.

This is a minor issue but takes a lot of code to fix and some user input (such as forcing a user to pressed a button from each axis to set them back to zero after they release the button).

This was reported before on the forums several years ago, but since it is a JInput bug and not a Slick2D bug, nothing has changed.

Thanks!

Comments (2)

  1. Regiden

    Then why do you tell to us o.o

    Well actually, I would not need much code fix. We just need to change the Input so that it get's initialized when the user first makes an Input on the Controller. I Remember Cas from LWJGL did something like this in Revenge of the Titans.

    Anyway there are more issues with Controller... Like it does not exaclty work like keys and such.

  2. Anonymous

    OP here.

    Controller is weird but if you use the controllerButton variable and the others from BasicGame or whatever, you can make your own methods to test if controller buttons are pressed, released, or down.

    I just know that the axis are sometimes important if you need something that changes depending on if you press the axis all the way versus just a little bit (racing games, games like geometry wars, etc).

    Thanks :P

  3. Log in to comment