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
ConstructorsModifierConstructorDescriptionprotectedAbstractJoystick(InputManager inputManager, JoyInput joyInput, int joyId, String name) Creates a new joystick instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAxis(JoystickAxis axis) protected voidaddButton(JoystickButton button) voidassignAxis(String positiveMapping, String negativeMapping, int axisId) Deprecated.Use JoystickAxis.assignAxis() instead.voidassignButton(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.intReturns the number of axes on this joystick.Returns the JoystickButton with the specified logical ID.intReturns the number of buttons on this joystick.Returns a read-only list of all joystick buttons for this Joystick.protected InputManagerintgetJoyId()Returns the joyId of this joystick.protected JoyInputgetName()Returns the name of this joystick.intGets the index number for the X axis on the joystick.intGets the index number for the Y axis on the joystick.voidrumble(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, waitMethods 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:
assignButtonin 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:
assignAxisin 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:JoystickReturns 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:
getAxisCountin interfaceJoystick- Returns:
- the number of axes on this joystick.
-
getButton
Description copied from interface:JoystickReturns the JoystickButton with the specified logical ID. -
getButtons
Returns a read-only list of all joystick buttons for this Joystick.- Specified by:
getButtonsin interfaceJoystick- Returns:
- an unmodifiable list of pre-existing instances
-
getButtonCount
public int getButtonCount()Returns the number of buttons on this joystick.- Specified by:
getButtonCountin 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:
getXAxisIndexin 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:
getYAxisIndexin interfaceJoystick- Returns:
- The axis index for the Y axis for this joystick.
- See Also:
-
toString
-