Updated the joystick test to indicate when the new LEFT_TRIGGER/RIGHT_TRIGGER

axes are used.
Also changed the console output to include the logical ID of triggered axes instead
of just the name.
accellbaker
Paul Speed 6 years ago
parent 54b812ca71
commit 59af265398
  1. 22
      jme3-examples/src/main/java/jme3test/input/TestJoystick.java

@ -290,7 +290,7 @@ public class TestJoystick extends SimpleApplication {
public void setAxisValue( JoystickAxis axis, float value ) {
System.out.println( "Axis:" + axis.getName() + "=" + value );
System.out.println( "Axis:" + axis.getName() + "(id:" + axis.getLogicalId() + ")=" + value );
if( axis == axis.getJoystick().getXAxis() ) {
setXAxis(value);
} else if( axis == axis.getJoystick().getYAxis() ) {
@ -304,6 +304,22 @@ public class TestJoystick extends SimpleApplication {
setZAxis(value);
} else if( axis == axis.getJoystick().getAxis(JoystickAxis.Z_ROTATION) ) {
setZRotation(-value);
} else if( axis == axis.getJoystick().getAxis(JoystickAxis.LEFT_TRIGGER) ) {
if( axis.getJoystick().getButton(JoystickButton.BUTTON_6) == null ) {
// left/right triggers sometimes only show up as axes
boolean pressed = value != 0;
if( pressed != buttons.get(JoystickButton.BUTTON_6).isDown() ) {
setButtonValue(JoystickButton.BUTTON_6, pressed);
}
}
} else if( axis == axis.getJoystick().getAxis(JoystickAxis.RIGHT_TRIGGER) ) {
if( axis.getJoystick().getButton(JoystickButton.BUTTON_7) == null ) {
// left/right triggers sometimes only show up as axes
boolean pressed = value != 0;
if( pressed != buttons.get(JoystickButton.BUTTON_7).isDown() ) {
setButtonValue(JoystickButton.BUTTON_7, pressed);
}
}
} else if( axis == axis.getJoystick().getPovXAxis() ) {
if( lastPovX < 0 ) {
setButtonValue( "POV -X", false );
@ -426,6 +442,10 @@ public class TestJoystick extends SimpleApplication {
System.out.println( getName() + " state:" + state );
}
public boolean isDown() {
return state > 0;
}
public void down() {
state++;
resetState();

Loading…
Cancel
Save