ControllerListener instances can be registered with the Controller to receive events in case
the controller's state changes. Listeners will be invoked on the rendering thread.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | PLAYER_IDX_UNSET
returned by |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public boolean | Returns: whether the connected controller or the current controller implementation can rumble. Note that this is no guarantee that the connected controller itself can vibrate.
|
| public float | |
| public int | Returns: number of axis of this controller. Axis indices start at 0, so the maximum axis index is one under this value.
|
| public boolean | |
| public ControllerMapping | Returns: button and axis mapping for this controller (or platform). The connected controller might not support all features.
|
| public int | |
| public int | |
| public String | |
| public int | Returns: 0-based player index of this controller, or PLAYER_IDX_UNSET if none is set
|
| public ControllerPowerLevel | Returns: value of enumControllerPowerLevel indicating battery state of the connected
controller, or ControllerPowerLevel#POWER_UNKNOWN if information is not present
|
| public String | Returns: unique ID to recognize this controller if more than one of the same controller models are connected. Use this to map a controller to a player, but do not use it to save a button mapping.
|
| public boolean | Returns: true when this Controller is still connected, false if it already disconnected
|
| public boolean | |
| public void | |
| public void | setPlayerIndex(int
0 typically 0 to 3 for player indices, and PLAYER_IDX_UNSET for unset index)Sets the player index of this controller. |
| public void | startVibration(int
duration, in milliseconds duration, float value between 0f and 1f strength)Starts vibrating this controller, if possible. |
| public boolean | Returns: whether the connected controller (or the implementation) can return and set the current player index
|
| PLAYER_IDX_UNSET | back to summary |
|---|---|
| public static final int PLAYER_IDX_UNSET returned by | |
| addListener | back to summary |
|---|---|
| public void addListener(ControllerListener listener) Adds a new | |
| cancelVibration | back to summary |
|---|---|
| public void cancelVibration() Cancel any running vibration. May not be supported by implementations | |
| canVibrate | back to summary |
|---|---|
public boolean canVibrate()
| |
| getAxis | back to summary |
|---|---|
public float getAxis(int axisCode)
| |
| getAxisCount | back to summary |
|---|---|
public int getAxisCount()
| |
| getButton | back to summary |
|---|---|
public boolean getButton(int buttonCode)
| |
| getMapping | back to summary |
|---|---|
public ControllerMapping getMapping()
| |
| getMaxButtonIndex | back to summary |
|---|---|
public int getMaxButtonIndex()
| |
| getMinButtonIndex | back to summary |
|---|---|
public int getMinButtonIndex()
| |
| getName | back to summary |
|---|---|
public String getName()
| |
| getPlayerIndex | back to summary |
|---|---|
public int getPlayerIndex()
| |
| getPowerLevel | back to summary |
|---|---|
public ControllerPowerLevel getPowerLevel()
| |
| getUniqueId | back to summary |
|---|---|
public String getUniqueId()
| |
| isConnected | back to summary |
|---|---|
public boolean isConnected()
| |
| isVibrating | back to summary |
|---|---|
public boolean isVibrating()
| |
| removeListener | back to summary |
|---|---|
| public void removeListener(ControllerListener listener) Removes the given | |
| setPlayerIndex | back to summary |
|---|---|
| public void setPlayerIndex(int index) Sets the player index of this controller. Please note that this does not always set indication lights of controllers, it is just an internal representation on some platforms
| |
| startVibration | back to summary |
|---|---|
| public void startVibration(int duration, float strength) Starts vibrating this controller, if possible.
| |
| supportsPlayerIndex | back to summary |
|---|---|
public boolean supportsPlayerIndex()
| |