Package com.jme3.input
Class DefaultJoystickAxis
java.lang.Object
com.jme3.input.DefaultJoystickAxis
- All Implemented Interfaces:
JoystickAxis
- Direct Known Subclasses:
AndroidSensorJoyInput.AndroidSensorJoystickAxis
Default implementation of the JoystickAxis interface.
-
Field Summary
Fields inherited from interface com.jme3.input.JoystickAxis
LEFT_TRIGGER, POV_X, POV_Y, RIGHT_TRIGGER, X_AXIS, Y_AXIS, Z_AXIS, Z_ROTATION -
Constructor Summary
ConstructorsConstructorDescriptionDefaultJoystickAxis(InputManager inputManager, Joystick parent, int axisIndex, String name, String logicalId, boolean isAnalog, boolean isRelative, float deadZone) Creates a new joystick axis instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidassignAxis(String positiveMapping, String negativeMapping) Assign the mappings to receive events from the given joystick axis.intReturns the axisId of this joystick axis.floatReturns the suggested dead zone for this axis.Returns the joystick to which this axis object belongs.Returns the logical identifier of this joystick axis.getName()Returns the name of this joystick.booleanisAnalog()Returns true if this is an analog axis, meaning the values are a continuous range instead of 1, 0, and -1.booleanReturns true if this axis presents relative values.voidsetDeadZone(float f) Sets/overrides the dead zone for this axis.toString()
-
Constructor Details
-
DefaultJoystickAxis
public DefaultJoystickAxis(InputManager inputManager, Joystick parent, int axisIndex, String name, String logicalId, boolean isAnalog, boolean isRelative, float deadZone) Creates a new joystick axis instance. Only used internally.- Parameters:
inputManager- (alias created)parent- (alias created)axisIndex- index for the new axisname- name for the new axislogicalId- logical identifier for the new axisisAnalog- true→continuous range, false→discrete valuesisRelative- true→presents relative valuesdeadZone- the radius of the dead zone
-
-
Method Details
-
assignAxis
Assign the mappings to receive events from the given joystick axis.- Specified by:
assignAxisin interfaceJoystickAxis- Parameters:
positiveMapping- The mapping to receive events when the axis is negativenegativeMapping- The mapping to receive events when the axis is positive
-
getJoystick
Returns the joystick to which this axis object belongs.- Specified by:
getJoystickin interfaceJoystickAxis- Returns:
- the pre-existing instance
-
getName
Returns the name of this joystick.- Specified by:
getNamein interfaceJoystickAxis- Returns:
- the name of this joystick.
-
getLogicalId
Returns the logical identifier of this joystick axis.- Specified by:
getLogicalIdin interfaceJoystickAxis- Returns:
- the logical identifier of this joystick.
-
getAxisId
public int getAxisId()Returns the axisId of this joystick axis.- Specified by:
getAxisIdin interfaceJoystickAxis- Returns:
- the axisId of this joystick axis.
-
isAnalog
public boolean isAnalog()Returns true if this is an analog axis, meaning the values are a continuous range instead of 1, 0, and -1.- Specified by:
isAnalogin interfaceJoystickAxis- Returns:
- true if analog, otherwise false
-
isRelative
public boolean isRelative()Returns true if this axis presents relative values.- Specified by:
isRelativein interfaceJoystickAxis- Returns:
- true if relative, otherwise false
-
getDeadZone
public float getDeadZone()Returns the suggested dead zone for this axis. Values less than this can be safely ignored.- Specified by:
getDeadZonein interfaceJoystickAxis- Returns:
- the radius of the dead zone
-
setDeadZone
public void setDeadZone(float f) Sets/overrides the dead zone for this axis. This indicates that values within +/- deadZone should be ignored.- Parameters:
f- the desired radius
-
toString
-