public abstract class AbstractJoystick extends java.lang.Object implements Joystick
Modifier | Constructor and Description |
---|---|
protected |
AbstractJoystick(InputManager inputManager,
JoyInput joyInput,
int joyId,
java.lang.String name)
Creates a new joystick instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAxis(JoystickAxis axis) |
protected void |
addButton(JoystickButton button) |
void |
assignAxis(java.lang.String positiveMapping,
java.lang.String negativeMapping,
int axisId)
Deprecated.
Use JoystickAxis.assignAxis() instead.
|
void |
assignButton(java.lang.String mappingName,
int buttonId)
Deprecated.
Use JoystickButton.assignButton() instead.
|
java.util.List<JoystickAxis> |
getAxes()
Returns a read-only list of all joystick axes for this Joystick.
|
JoystickAxis |
getAxis(java.lang.String logicalId)
Returns the JoystickAxis with the specified logical ID.
|
int |
getAxisCount()
Returns the number of axes on this joystick.
|
JoystickButton |
getButton(java.lang.String logicalId)
Returns the JoystickButton with the specified logical ID.
|
int |
getButtonCount()
Returns the number of buttons on this joystick.
|
java.util.List<JoystickButton> |
getButtons()
Returns a read-only list of all joystick buttons for this Joystick.
|
protected InputManager |
getInputManager() |
int |
getJoyId()
Returns the joyId of this joystick.
|
protected JoyInput |
getJoyInput() |
java.lang.String |
getName()
Returns the name of this joystick.
|
int |
getXAxisIndex()
Gets the index number for the X axis on the joystick.
|
int |
getYAxisIndex()
Gets the index number for the Y axis on the joystick.
|
void |
rumble(float amount)
Rumbles the joystick for the given amount/magnitude.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPovXAxis, getPovYAxis, getXAxis, getYAxis
protected AbstractJoystick(InputManager inputManager, JoyInput joyInput, int joyId, java.lang.String name)
inputManager
- (alias created)joyInput
- (alias created)joyId
- ID to assign to the instancename
- name to assign to the instanceprotected InputManager getInputManager()
protected JoyInput getJoyInput()
protected void addAxis(JoystickAxis axis)
protected void addButton(JoystickButton button)
public void rumble(float amount)
@Deprecated public void assignButton(java.lang.String mappingName, int buttonId)
assignButton
in interface Joystick
mappingName
- The mapping to receive joystick button events.buttonId
- The button index.Joystick.getButtonCount()
@Deprecated public void assignAxis(java.lang.String positiveMapping, java.lang.String negativeMapping, int axisId)
assignAxis
in interface Joystick
positiveMapping
- The mapping to receive events when the axis is negativenegativeMapping
- The mapping to receive events when the axis is positiveaxisId
- The axis index.Joystick.getAxisCount()
public JoystickAxis getAxis(java.lang.String logicalId)
Joystick
public java.util.List<JoystickAxis> getAxes()
public int getAxisCount()
getAxisCount
in interface Joystick
public JoystickButton getButton(java.lang.String logicalId)
Joystick
public java.util.List<JoystickButton> getButtons()
getButtons
in interface Joystick
public int getButtonCount()
getButtonCount
in interface Joystick
public java.lang.String getName()
public int getJoyId()
public int getXAxisIndex()
E.g. for most gamepads, the left control stick X axis will be returned.
getXAxisIndex
in interface Joystick
Joystick.assignAxis(java.lang.String, java.lang.String, int)
public int getYAxisIndex()
E.g. for most gamepads, the left control stick Y axis will be returned.
getYAxisIndex
in interface Joystick
Joystick.assignAxis(java.lang.String, java.lang.String, int)
public java.lang.String toString()
toString
in class java.lang.Object