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.
This commit is contained in:
parent
54b812ca71
commit
59af265398
@ -290,7 +290,7 @@ public class TestJoystick extends SimpleApplication {
|
|||||||
|
|
||||||
public void setAxisValue( JoystickAxis axis, float value ) {
|
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() ) {
|
if( axis == axis.getJoystick().getXAxis() ) {
|
||||||
setXAxis(value);
|
setXAxis(value);
|
||||||
} else if( axis == axis.getJoystick().getYAxis() ) {
|
} else if( axis == axis.getJoystick().getYAxis() ) {
|
||||||
@ -304,6 +304,22 @@ public class TestJoystick extends SimpleApplication {
|
|||||||
setZAxis(value);
|
setZAxis(value);
|
||||||
} else if( axis == axis.getJoystick().getAxis(JoystickAxis.Z_ROTATION) ) {
|
} else if( axis == axis.getJoystick().getAxis(JoystickAxis.Z_ROTATION) ) {
|
||||||
setZRotation(-value);
|
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() ) {
|
} else if( axis == axis.getJoystick().getPovXAxis() ) {
|
||||||
if( lastPovX < 0 ) {
|
if( lastPovX < 0 ) {
|
||||||
setButtonValue( "POV -X", false );
|
setButtonValue( "POV -X", false );
|
||||||
@ -426,6 +442,10 @@ public class TestJoystick extends SimpleApplication {
|
|||||||
System.out.println( getName() + " state:" + state );
|
System.out.println( getName() + " state:" + state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDown() {
|
||||||
|
return state > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void down() {
|
public void down() {
|
||||||
state++;
|
state++;
|
||||||
resetState();
|
resetState();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user