public class SDL2Controller extends java.lang.Object implements RumbleController
| Modifier and Type | Class and Description |
|---|---|
static class |
SDL2Controller.ControllerType |
static class |
SDL2Controller.PowerLevel |
| Modifier and Type | Field and Description |
|---|---|
SDL_Joystick |
joystick |
| Constructor and Description |
|---|
SDL2Controller(SDL2ControllerManager manager,
int device_index) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(com.badlogic.gdx.controllers.ControllerListener listener) |
void |
close() |
com.badlogic.gdx.math.Vector3 |
getAccelerometer(int accelerometerCode) |
float |
getAxis(int axisCode) |
boolean |
getButton(int buttonCode) |
java.lang.String |
getName() |
int |
getPlayerIndex() |
com.badlogic.gdx.controllers.PovDirection |
getPov(int povCode) |
SDL2Controller.PowerLevel |
getPowerLevel() |
boolean |
getSliderX(int sliderCode) |
boolean |
getSliderY(int sliderCode) |
SDL2Controller.ControllerType |
getType() |
boolean |
isConnected() |
void |
removeListener(com.badlogic.gdx.controllers.ControllerListener listener) |
boolean |
rumble(float leftMagnitude,
float rightMagnitude,
int duration_ms)
Vibrate the controller using the new rumble API
This will return false if the controller doesn't support vibration or if SDL was unable to start
vibration (maybe the controller doesn't support left/right vibration, maybe it was unplugged in the
middle of trying, etc...)
|
void |
setAccelerometerSensitivity(float sensitivity) |
java.lang.String |
toString() |
public final SDL_Joystick joystick
public SDL2Controller(SDL2ControllerManager manager, int device_index) throws SDL_Error
SDL_Errorpublic boolean isConnected()
public void addListener(com.badlogic.gdx.controllers.ControllerListener listener)
addListener in interface com.badlogic.gdx.controllers.Controllerpublic void removeListener(com.badlogic.gdx.controllers.ControllerListener listener)
removeListener in interface com.badlogic.gdx.controllers.Controllerpublic boolean getButton(int buttonCode)
getButton in interface com.badlogic.gdx.controllers.Controllerpublic float getAxis(int axisCode)
getAxis in interface com.badlogic.gdx.controllers.Controllerpublic com.badlogic.gdx.controllers.PovDirection getPov(int povCode)
getPov in interface com.badlogic.gdx.controllers.Controllerpublic boolean getSliderX(int sliderCode)
getSliderX in interface com.badlogic.gdx.controllers.Controllerpublic boolean getSliderY(int sliderCode)
getSliderY in interface com.badlogic.gdx.controllers.Controllerpublic com.badlogic.gdx.math.Vector3 getAccelerometer(int accelerometerCode)
getAccelerometer in interface com.badlogic.gdx.controllers.Controllerpublic void setAccelerometerSensitivity(float sensitivity)
setAccelerometerSensitivity in interface com.badlogic.gdx.controllers.Controllerpublic java.lang.String getName()
getName in interface com.badlogic.gdx.controllers.Controllerpublic java.lang.String toString()
toString in class java.lang.Objectpublic void close()
public boolean rumble(float leftMagnitude,
float rightMagnitude,
int duration_ms)
rumble in interface RumbleControllerleftMagnitude - The speed for the left motor to vibrate (this should be between 0 and 1)rightMagnitude - The speed for the right motor to vibrate (this should be between 0 and 1)public SDL2Controller.PowerLevel getPowerLevel()
public SDL2Controller.ControllerType getType()
public int getPlayerIndex()