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
ConstructorDescriptionDefaultJoystickAxis
(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 TypeMethodDescriptionvoid
assignAxis
(String positiveMapping, String negativeMapping) Assign the mappings to receive events from the given joystick axis.int
Returns the axisId of this joystick axis.float
Returns 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.boolean
isAnalog()
Returns true if this is an analog axis, meaning the values are a continuous range instead of 1, 0, and -1.boolean
Returns true if this axis presents relative values.void
setDeadZone
(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:
assignAxis
in 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:
getJoystick
in interfaceJoystickAxis
- Returns:
- the pre-existing instance
-
getName
Returns the name of this joystick.- Specified by:
getName
in interfaceJoystickAxis
- Returns:
- the name of this joystick.
-
getLogicalId
Returns the logical identifier of this joystick axis.- Specified by:
getLogicalId
in interfaceJoystickAxis
- Returns:
- the logical identifier of this joystick.
-
getAxisId
public int getAxisId()Returns the axisId of this joystick axis.- Specified by:
getAxisId
in 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:
isAnalog
in interfaceJoystickAxis
- Returns:
- true if analog, otherwise false
-
isRelative
public boolean isRelative()Returns true if this axis presents relative values.- Specified by:
isRelative
in 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:
getDeadZone
in 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
-