Joystick axis Event

Started by Krux, May 25, 2012, 20:06:58

Previous topic - Next topic

Krux

Hi I am working with the lwjgl controller classes, but I am unable to find the Joystick AxisEvent that tells me the exact position of the updated axis. I know I can write this:

Controller controller = Controllers.getEventSource();
int controlIndex = Controllers.getEventControlIndex();
if( Controllers.isEventAxis() ) {
    controller.getAxisValue( controlIndex );
}


but this is not pure event based. The current AxisValue might already differ from the value that is present in the controller object and here I need to make shure that I use the value from when the event was thrown. Some Controllers.getEventAxisValue would be ideal, but I wasn't able to find it.

The same is for Buttons.

Fool Running

Yes you are correct. It looks like the code only stores the value of the last event for any given button/axis/POV during a poll() (looking at the JInputController.poll()). Either a bug, or deemed a worthless problem when polling 60 times a second, not sure. :P

EDIT: How often are you polling? I would think that if you're polling fast enough (like 60 times a second) the user wouldn't be able to move the stick (or press a button) fast enough for it to matter.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Endolf

There are 2 types of axis that JInput recognises, absolute and relative. Relative axis are like mice, where there is no absolute position (mouse pointers have screen location, the mouse does not), for these, each event just contains the delta from the last event. For absolute (joysticks, gamepad thumb sticks etc) the value in the event is the absolute position each time.

I'm not sure what lwjgl does to these values, but that's what JInput does.

HTH

Endolf