LWJGL
June 19, 2013, 02:05:21 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.9.0 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Joystick axis Event  (Read 774 times)
Krux
Newbie
*
Posts: 22


« on: May 25, 2012, 13:06:58 »

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:

Code:
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.
Logged
Fool Running
Nerdus Imperius
*****
Posts: 758


« Reply #1 on: May 30, 2012, 05:38:31 »

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. Tongue

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.
Logged

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option Grin
Endolf
Talks Too Much
***
Posts: 101



WWW
« Reply #2 on: May 31, 2012, 01:03:14 »

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
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!