Package com.jme3.input
Class AbstractJoystick
java.lang.Object
com.jme3.input.AbstractJoystick
- All Implemented Interfaces:
Joystick
- Direct Known Subclasses:
AndroidJoystickJoyInput14.AndroidJoystick
,AndroidSensorJoyInput.AndroidSensorJoystick
,GlfwJoystickInput.GlfwJoystick
,JInputJoyInput.JInputJoystick
A joystick represents a single joystick that is installed in the system.
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractJoystick
(InputManager inputManager, JoyInput joyInput, int joyId, String name) Creates a new joystick instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAxis
(JoystickAxis axis) protected void
addButton
(JoystickButton button) void
assignAxis
(String positiveMapping, String negativeMapping, int axisId) Deprecated.Use JoystickAxis.assignAxis() instead.void
assignButton
(String mappingName, int buttonId) Deprecated.Use JoystickButton.assignButton() instead.getAxes()
Returns a read-only list of all joystick axes for this Joystick.Returns the JoystickAxis with the specified logical ID.int
Returns the number of axes on this joystick.Returns the JoystickButton with the specified logical ID.int
Returns the number of buttons on this joystick.Returns a read-only list of all joystick buttons for this Joystick.protected InputManager
int
getJoyId()
Returns the joyId of this joystick.protected JoyInput
getName()
Returns the name of this joystick.int
Gets the index number for the X axis on the joystick.int
Gets the index number for the Y axis on the joystick.void
rumble
(float amount) Rumbles the joystick for the given amount/magnitude.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.jme3.input.Joystick
getPovXAxis, getPovYAxis, getXAxis, getYAxis
-
Constructor Details
-
AbstractJoystick
Creates a new joystick instance. Only used internally.- Parameters:
inputManager
- (alias created)joyInput
- (alias created)joyId
- ID to assign to the instancename
- name to assign to the instance
-
-
Method Details
-
getInputManager
-
getJoyInput
-
addAxis
-
addButton
-
rumble
public void rumble(float amount) Rumbles the joystick for the given amount/magnitude. -
assignButton
Deprecated.Use JoystickButton.assignButton() instead.Assign the mapping name to receive events from the given button index on the joystick.- Specified by:
assignButton
in interfaceJoystick
- Parameters:
mappingName
- The mapping to receive joystick button events.buttonId
- The button index.- See Also:
-
assignAxis
Deprecated.Use JoystickAxis.assignAxis() instead.Assign the mappings to receive events from the given joystick axis.- Specified by:
assignAxis
in interfaceJoystick
- Parameters:
positiveMapping
- The mapping to receive events when the axis is negativenegativeMapping
- The mapping to receive events when the axis is positiveaxisId
- The axis index.- See Also:
-
getAxis
Description copied from interface:Joystick
Returns the JoystickAxis with the specified logical ID. -
getAxes
Returns a read-only list of all joystick axes for this Joystick. -
getAxisCount
public int getAxisCount()Returns the number of axes on this joystick.- Specified by:
getAxisCount
in interfaceJoystick
- Returns:
- the number of axes on this joystick.
-
getButton
Description copied from interface:Joystick
Returns the JoystickButton with the specified logical ID. -
getButtons
Returns a read-only list of all joystick buttons for this Joystick.- Specified by:
getButtons
in interfaceJoystick
- Returns:
- an unmodifiable list of pre-existing instances
-
getButtonCount
public int getButtonCount()Returns the number of buttons on this joystick.- Specified by:
getButtonCount
in interfaceJoystick
- Returns:
- the number of buttons on this joystick.
-
getName
Returns the name of this joystick. -
getJoyId
public int getJoyId()Returns the joyId of this joystick. -
getXAxisIndex
public int getXAxisIndex()Gets the index number for the X axis on the joystick.E.g. for most gamepads, the left control stick X axis will be returned.
- Specified by:
getXAxisIndex
in interfaceJoystick
- Returns:
- The axis index for the X axis for this joystick.
- See Also:
-
getYAxisIndex
public int getYAxisIndex()Gets the index number for the Y axis on the joystick.E.g. for most gamepads, the left control stick Y axis will be returned.
- Specified by:
getYAxisIndex
in interfaceJoystick
- Returns:
- The axis index for the Y axis for this joystick.
- See Also:
-
toString
-