com.jme3.input
Class Joystick

java.lang.Object
  extended by com.jme3.input.Joystick

public final class Joystick
extends java.lang.Object

A joystick represents a single joystick that is installed in the system.


Constructor Summary
Joystick(InputManager inputManager, JoyInput joyInput, int joyId, java.lang.String name, int buttonCount, int axisCount, int xAxis, int yAxis)
          Creates a new joystick instance.
 
Method Summary
 void assignAxis(java.lang.String positiveMapping, java.lang.String negativeMapping, int axisId)
          Assign the mappings to receive events from the given joystick axis.
 void assignButton(java.lang.String mappingName, int buttonId)
          Assign the mapping name to receive events from the given button index on the joystick.
 int getAxisCount()
          Returns the number of axes on this joystick.
 int getButtonCount()
          Returns the number of buttons on this joystick.
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Joystick

public Joystick(InputManager inputManager,
                JoyInput joyInput,
                int joyId,
                java.lang.String name,
                int buttonCount,
                int axisCount,
                int xAxis,
                int yAxis)
Creates a new joystick instance. Only used internally.

Method Detail

rumble

public void rumble(float amount)
Rumbles the joystick for the given amount/magnitude.

Parameters:
amount - The amount to rumble. Should be between 0 and 1.

assignButton

public void assignButton(java.lang.String mappingName,
                         int buttonId)
Assign the mapping name to receive events from the given button index on the joystick.

Parameters:
mappingName - The mapping to receive joystick button events.
buttonId - The button index.
See Also:
getButtonCount()

assignAxis

public void assignAxis(java.lang.String positiveMapping,
                       java.lang.String negativeMapping,
                       int axisId)
Assign the mappings to receive events from the given joystick axis.

Parameters:
positiveMapping - The mapping to receive events when the axis is negative
negativeMapping - The mapping to receive events when the axis is positive
axisId - The axis index.
See Also:
getAxisCount()

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.

Returns:
The axis index for the X axis for this joystick.
See Also:
assignAxis(java.lang.String, java.lang.String, int)

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.

Returns:
The axis index for the Y axis for this joystick.
See Also:
assignAxis(java.lang.String, java.lang.String, int)

getAxisCount

public int getAxisCount()
Returns the number of axes on this joystick.

Returns:
the number of axes on this joystick.

getButtonCount

public int getButtonCount()
Returns the number of buttons on this joystick.

Returns:
the number of buttons on this joystick.

getName

public java.lang.String getName()
Returns the name of this joystick.

Returns:
the name of this joystick.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object