public interface Controller
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 |
|---|---|
static int |
PLAYER_IDX_UNSET
returned by
getPlayerIndex() if no player index was set or feature is not supported |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ControllerListener listener)
Adds a new
ControllerListener to this Controller. |
void |
cancelVibration()
Cancel any running vibration.
|
boolean |
canVibrate() |
float |
getAxis(int axisCode) |
int |
getAxisCount() |
boolean |
getButton(int buttonCode) |
ControllerMapping |
getMapping() |
int |
getMaxButtonIndex() |
int |
getMinButtonIndex() |
java.lang.String |
getName() |
int |
getPlayerIndex() |
ControllerPowerLevel |
getPowerLevel() |
java.lang.String |
getUniqueId() |
boolean |
isConnected() |
boolean |
isVibrating() |
void |
removeListener(ControllerListener listener)
Removes the given
ControllerListener |
void |
setPlayerIndex(int index)
Sets the player index of this controller.
|
void |
startVibration(int duration,
float strength)
Starts vibrating this controller, if possible.
|
boolean |
supportsPlayerIndex() |
static final int PLAYER_IDX_UNSET
getPlayerIndex() if no player index was set or feature is not supportedboolean getButton(int buttonCode)
buttonCode - float getAxis(int axisCode)
axisCode - java.lang.String getName()
java.lang.String getUniqueId()
int getMinButtonIndex()
int getMaxButtonIndex()
int getAxisCount()
boolean isConnected()
boolean canVibrate()
boolean isVibrating()
void startVibration(int duration,
float strength)
duration - duration, in millisecondsstrength - value between 0f and 1fvoid cancelVibration()
boolean supportsPlayerIndex()
int getPlayerIndex()
void setPlayerIndex(int index)
index - 0 typically 0 to 3 for player indices, and PLAYER_IDX_UNSET for unsetControllerMapping getMapping()
ControllerPowerLevel getPowerLevel()
ControllerPowerLevel indicating battery state of the connected
controller, or ControllerPowerLevel.POWER_UNKNOWN if information is not presentvoid addListener(ControllerListener listener)
ControllerListener to this Controller. The listener will receive calls in case the state of the
controller changes. The listener will be invoked on the rendering thread.listener - void removeListener(ControllerListener listener)
ControllerListenerlistener -