public interface GamePad
Modifier and Type | Method and Description |
---|---|
void |
addListener(GamePadListener listener)
Adds a
GamePadListener to listen to state changes |
org.mini2Dx.gdx.math.Vector3 |
getAccelerometer(int accelerometerCode)
Returns the current accelerometer value
|
float |
getAccelerometerSensitivity()
Returns the accelerometer sensitivity
|
float |
getAxis(int axisCode)
Returns the current value of an axis
|
GamePadType |
getGamePadType()
Returns the
GamePadType |
java.lang.String |
getInstanceId()
Returns the ID for this
GamePad . |
java.lang.String |
getModelInfo()
Returns the model information present by the hardware/driver (e.g.
|
int |
getPlayerIndex()
Returns the player assigned to this gamepad
|
PovState |
getPov(int povCode)
Returns the current value of a PoV (Dpad)
|
float |
getVibrationStrength()
Returns the strength of the vibration/rumble
|
boolean |
isAccelerometerSupported()
Returns if this gamepad has accelerometer functionality
|
boolean |
isButtonDown(int buttonCode)
Returns if a specific button is currently pressed down
|
boolean |
isButtonUp(int buttonCode)
Returns if a specific button is currently released (not pressed down)
|
boolean |
isConnected()
Returns if this
GamePad is connected |
boolean |
isPlayerIndicesSupported()
Returns if this game pad supports assigning player numbers to it
|
boolean |
isVibrateSupported()
Returns if this gamepad has vibrate/rumble functionality
|
boolean |
isVibrating()
Returns if this gamepad is currently vibrating/rumbling
|
void |
removeListener(GamePadListener listener)
Removes a
GamePadListener |
void |
setAccelerometerSensitivity(float sensitivity)
Sets the accelerometer sensitivity
|
void |
setPlayerIndex(int playerIndex)
Sets the player assigned to this gamepad
|
void |
startVibration(float strength)
Starts vibrating/rumbling the gamepad
|
void |
stopVibration()
Stops the vibrating/rumbling of the gamepad
|
GamePadType getGamePadType()
GamePadType
GamePadType.UNKNOWN
if unknownjava.lang.String getInstanceId()
GamePad
.
When supported by the driver, if multiple gamepads are connected each will have a unique instance id.
Otherwise, this will fallback for to the name of the device returned by the driver.
If a gamepad is unplugged and reconnected, it will have the same ID.java.lang.String getModelInfo()
boolean isConnected()
GamePad
is connectedboolean isPlayerIndicesSupported()
int getPlayerIndex()
void setPlayerIndex(int playerIndex)
playerIndex
- -1 if unassignedboolean isVibrateSupported()
boolean isVibrating()
float getVibrationStrength()
void startVibration(float strength)
strength
- A value between 0f and 1fvoid stopVibration()
boolean isButtonDown(int buttonCode)
buttonCode
- The button code (Note: these may vary per platform)boolean isButtonUp(int buttonCode)
buttonCode
- The button code (Note: these may vary per platform)float getAxis(int axisCode)
axisCode
- The axis code (Note: these may vary per platform)PovState getPov(int povCode)
povCode
- The PoV code (Note: these may vary per platform)PovState
boolean isAccelerometerSupported()
org.mini2Dx.gdx.math.Vector3 getAccelerometer(int accelerometerCode)
accelerometerCode
- The accelerometer code (Note: these may vary per platform)float getAccelerometerSensitivity()
void setAccelerometerSensitivity(float sensitivity)
sensitivity
- The sensitivity where 0.0 is lowest, 1.0 is highestvoid addListener(GamePadListener listener)
GamePadListener
to listen to state changeslistener
- The GamePadListener
to addvoid removeListener(GamePadListener listener)
GamePadListener
listener
- The GamePadListener
to remove