/** * Returns the joystick axis index. * * @return joystick axis index. * * @see Joystick#assignAxis(java.lang.String, java.lang.String, int) */ public int getAxisIndex() { return axis.getAxisId(); }
/** * The joystick index. * * @return joystick index. * * @see InputManager#getJoysticks() */ public int getJoyIndex() { return axis.getJoystick().getJoyId(); }
@Override public JoystickAxis getAxis(String logicalId) { for( JoystickAxis axis : axes ) { if( axis.getLogicalId().equals(logicalId) ) return axis; } return null; }
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 );
addInfo( " '" + a.getName() + "' id:'" + a.getLogicalId() + "' analog:" + a.isAnalog(), 1 );
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); }
id.getName() + "_x", comp.isAnalog(), comp.isRelative(), comp.getDeadZone() ); logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + id.getName() + "_x", povX.getName() ); addAxis(povX); povY = new DefaultJoystickAxis( getInputManager(), id.getName() + "_y", comp.isAnalog(), comp.isRelative(), comp.getDeadZone() ); logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + id.getName() + "_y", povY.getName() ); addAxis(povY);
int axis = evt.getAxisIndex(); float value = evt.getValue(); float effectiveDeadZone = Math.max(globalAxisDeadZone, evt.getAxis().getDeadZone()); if (value < effectiveDeadZone && value > -effectiveDeadZone) { int hash1 = JoyAxisTrigger.joyAxisHash(joyId, axis, true);
protected void mapJoystick( Joystick joystick ) { // Map it differently if there are Z axis if( joystick.getAxis( JoystickAxis.Z_ROTATION ) != null && joystick.getAxis( JoystickAxis.Z_AXIS ) != null ) { // Make the left stick move joystick.getXAxis().assignAxis( CameraInput.FLYCAM_STRAFERIGHT, CameraInput.FLYCAM_STRAFELEFT ); joystick.getYAxis().assignAxis( CameraInput.FLYCAM_BACKWARD, CameraInput.FLYCAM_FORWARD ); // And the right stick control the camera joystick.getAxis( JoystickAxis.Z_ROTATION ).assignAxis( CameraInput.FLYCAM_DOWN, CameraInput.FLYCAM_UP ); joystick.getAxis( JoystickAxis.Z_AXIS ).assignAxis( CameraInput.FLYCAM_RIGHT, CameraInput.FLYCAM_LEFT ); // And let the dpad be up and down joystick.getPovYAxis().assignAxis(CameraInput.FLYCAM_RISE, CameraInput.FLYCAM_LOWER); if( joystick.getButton( "Button 8" ) != null ) { // Let the stanard select button be the y invert toggle joystick.getButton( "Button 8" ).assignButton( CameraInput.FLYCAM_INVERTY ); } } else { joystick.getPovXAxis().assignAxis(CameraInput.FLYCAM_STRAFERIGHT, CameraInput.FLYCAM_STRAFELEFT); joystick.getPovYAxis().assignAxis(CameraInput.FLYCAM_FORWARD, CameraInput.FLYCAM_BACKWARD); joystick.getXAxis().assignAxis(CameraInput.FLYCAM_RIGHT, CameraInput.FLYCAM_LEFT); joystick.getYAxis().assignAxis(CameraInput.FLYCAM_DOWN, CameraInput.FLYCAM_UP); } }
id.getName() + "_x", comp.isAnalog(), comp.isRelative(), comp.getDeadZone() ); logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + id.getName() + "_x", povX.getName() ); addAxis(povX); povY = new DefaultJoystickAxis( getInputManager(), id.getName() + "_y", comp.isAnalog(), comp.isRelative(), comp.getDeadZone() ); logger.log(Level.FINE, "Adding axis: \"{0}\" id:" + id.getName() + "_y", povY.getName() ); addAxis(povY);
int axis = evt.getAxisIndex(); float value = evt.getValue(); float effectiveDeadZone = Math.max(globalAxisDeadZone, evt.getAxis().getDeadZone()); if (value < effectiveDeadZone && value > -effectiveDeadZone) { int hash1 = JoyAxisTrigger.joyAxisHash(joyId, axis, true);
protected void mapJoystick( Joystick joystick ) { // Map it differently if there are Z axis if( joystick.getAxis( JoystickAxis.Z_ROTATION ) != null && joystick.getAxis( JoystickAxis.Z_AXIS ) != null ) { // Make the left stick move joystick.getXAxis().assignAxis( CameraInput.FLYCAM_STRAFERIGHT, CameraInput.FLYCAM_STRAFELEFT ); joystick.getYAxis().assignAxis( CameraInput.FLYCAM_BACKWARD, CameraInput.FLYCAM_FORWARD ); // And the right stick control the camera joystick.getAxis( JoystickAxis.Z_ROTATION ).assignAxis( CameraInput.FLYCAM_DOWN, CameraInput.FLYCAM_UP ); joystick.getAxis( JoystickAxis.Z_AXIS ).assignAxis( CameraInput.FLYCAM_RIGHT, CameraInput.FLYCAM_LEFT ); // And let the dpad be up and down joystick.getPovYAxis().assignAxis(CameraInput.FLYCAM_RISE, CameraInput.FLYCAM_LOWER); if( joystick.getButton( "Button 8" ) != null ) { // Let the stanard select button be the y invert toggle joystick.getButton( "Button 8" ).assignButton( CameraInput.FLYCAM_INVERTY ); } } else { joystick.getPovXAxis().assignAxis(CameraInput.FLYCAM_STRAFERIGHT, CameraInput.FLYCAM_STRAFELEFT); joystick.getPovYAxis().assignAxis(CameraInput.FLYCAM_FORWARD, CameraInput.FLYCAM_BACKWARD); joystick.getXAxis().assignAxis(CameraInput.FLYCAM_RIGHT, CameraInput.FLYCAM_LEFT); joystick.getYAxis().assignAxis(CameraInput.FLYCAM_DOWN, CameraInput.FLYCAM_UP); } }
@Override public int getYAxisIndex() { return povAxisY.getAxisId(); } }
public void onJoyAxisEvent(JoyAxisEvent evt) { setViewedJoystick( evt.getAxis().getJoystick() ); gamepad.setAxisValue( evt.getAxis(), evt.getValue() ); }
@Override public JoystickAxis getAxis(String logicalId) { for( JoystickAxis axis : axes ) { if( axis.getLogicalId().equals(logicalId) ) return axis; } return null; }
@Override public int getYAxisIndex(){ return yAxis.getAxisId(); } }
/** * The joystick index. * * @return joystick index. * * @see InputManager#getJoysticks() */ public int getJoyIndex() { return axis.getJoystick().getJoyId(); }
@Override public int getXAxisIndex() { return povAxisX.getAxisId(); }
@Override public int getXAxisIndex(){ return xAxis.getAxisId(); }
@Override public int getYAxisIndex(){ return yAxis.getAxisId(); } }