/** * The joystick index. * * @return joystick index. * * @see InputManager#getJoysticks() */ public int getJoyIndex() { return axis.getJoystick().getJoyId(); }
public void onJoyAxisEvent(JoyAxisEvent evt) { setViewedJoystick( evt.getAxis().getJoystick() ); gamepad.setAxisValue( evt.getAxis(), evt.getValue() ); }
public void setAxisValue( JoystickAxis axis, float value ) { System.out.println( "Axis:" + axis.getName() + "=" + value ); if( axis == axis.getJoystick().getXAxis() ) { setXAxis(value); } else if( axis == axis.getJoystick().getYAxis() ) { setYAxis(-value); } else if( axis == axis.getJoystick().getAxis(JoystickAxis.Z_AXIS) ) { } else if( axis == axis.getJoystick().getAxis(JoystickAxis.Z_ROTATION) ) { setZRotation(-value); } else if( axis == axis.getJoystick().getPovXAxis() ) { if( lastPovX < 0 ) { setButtonValue( "POV -X", false ); } else if( axis == axis.getJoystick().getPovYAxis() ) { if( lastPovY < 0 ) { setButtonValue( "POV -Y", false );
/** * The joystick index. * * @return joystick index. * * @see InputManager#getJoysticks() */ public int getJoyIndex() { return axis.getJoystick().getJoyId(); }
public void onJoyAxisEvent( JoyAxisEvent evt ) { if( log.isTraceEnabled() ) { log.trace("onJoyAxisEvent(axis:" + evt.getAxis() + ", val:" + evt.getValue() + ")"); } JoystickAxis a = evt.getAxis(); Joystick j = a.getJoystick(); float val = evt.getValue(); // Below a certain threshold, call the value 0 float aVal = Math.abs(val); if( aVal <= 0.01 || aVal <= Math.max(a.getDeadZone(), inputManager.getAxisDeadZone()) ) { val = 0; } Axis axis = joystickAxisMap.get(a); if( axis == null ) { log.warn("No axis mapping for:" + a ); return; } StateGroupIndex index = getIndex(axis, false); if( index == null ) return; index.updateValue(val); }