| Modifier and Type | Field and Description |
|---|---|
| private static final float | |
| private long | |
| private boolean[] | |
| private int | |
| private boolean[] |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public void | |
| private void | |
| public boolean | Returns: Whether or not the controller was able to be vibrated (i.e. if haptics are supported)The intensity of the left rumble motor (this should be between 0 and 1) leftMagnitude, float The intensity of the right rumble motor (this should be between 0 and 1) rightMagnitude, int duration_ms)Vibrate the controller using the new rumble API Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. |
| private void | |
| public float | Returns: The current state of the requested axis.The ControllerAxis to check the state of toCheck)Returns the current state of a passed axis. |
| public int | Returns: The instance ID of the current controllerReturns the instance ID of the current controller, which uniquely identifies the device from the time it is connected until it is disconnected. |
| public int | |
| public String | Returns: The the name of this controllerReturns the implementation dependent name of this controller. |
| public int | |
| public ControllerPowerLevel | Returns: current power level of game controller, seeControllerPowerLevel enum values
|
| public boolean | isAxisAvailable(ControllerAxis
The ControllerAxis to check toCheck)Returns if passed axis is available on controller. |
| public boolean | isButtonAvailable(ControllerButton
The ControllerButton to check toCheck)Returns if a given button is available on controller. |
| public boolean | Returns: Whether or not the button has just been pressed.The ControllerButton to check the state of toCheck)Returns whether or not a given button has just been pressed since you last made a query about that button (either through this method, isButtonPressed(), or through the ControllerState side of things). |
| public boolean | Returns: Whether or not the button is pressed.The ControllerButton to check the state of toCheck)Returns whether or not a given button has been pressed. |
| public boolean | Returns: Whether or not the controller is plugged in.Return whether or not the controller is currently connected. |
| private native boolean | |
| private native boolean | |
| private native boolean | |
| private native int | |
| private native boolean | |
| private native void | |
| private native long | |
| private native boolean | |
| private native int | |
| private native String | |
| private native int | |
| private native int | |
| private native boolean | |
| private native void | |
| public boolean | Returns: whether or not the controller could successfully reconnect.Close and reconnect to the native gamepad at the index associated with this ControllerIndex object. |
| public void | |
| private void |
| AXIS_MAX_VAL | back to summary |
|---|---|
| private static final float AXIS_MAX_VAL | |
| controllerPtr | back to summary |
|---|---|
| private long controllerPtr | |
| heldDownButtons | back to summary |
|---|---|
| private boolean[] heldDownButtons | |
| index | back to summary |
|---|---|
| private int index | |
| justPressedButtons | back to summary |
|---|---|
| private boolean[] justPressedButtons | |
| ControllerIndex | back to summary |
|---|---|
| pack-priv ControllerIndex(int index) Constructor. Builds a controller at the given index and attempts to connect to it. This is only accessible in the Jamepad package, so people can't go trying to make controllers before the native library is loaded or initialized.
| |
| canVibrate | back to summary |
|---|---|
public boolean canVibrate() throws ControllerUnpluggedException
| |
| close | back to summary |
|---|---|
| public void close() Close the connection to this controller. | |
| connectController | back to summary |
|---|---|
| private void connectController() | |
| doVibration | back to summary |
|---|---|
| public boolean doVibration(float leftMagnitude, float rightMagnitude, int duration_ms) throws ControllerUnpluggedException Vibrate the controller using the new rumble API Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. 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...)
| |
| ensureConnected | back to summary |
|---|---|
| private void ensureConnected() throws ControllerUnpluggedException Convenience method to throw an exception if the controller is not connected. | |
| getAxisState | back to summary |
|---|---|
| public float getAxisState(ControllerAxis toCheck) throws ControllerUnpluggedException Returns the current state of a passed axis.
| |
| getDeviceInstanceID | back to summary |
|---|---|
| public int getDeviceInstanceID() throws ControllerUnpluggedException Returns the instance ID of the current controller, which uniquely identifies the device from the time it is connected until it is disconnected.
| |
| getIndex | back to summary |
|---|---|
| public int getIndex() Returns the index of the current controller.
| |
| getName | back to summary |
|---|---|
| public String getName() throws ControllerUnpluggedException Returns the implementation dependent name of this controller.
| |
| getPlayerIndex | back to summary |
|---|---|
public int getPlayerIndex() throws ControllerUnpluggedException
| |
| getPowerLevel | back to summary |
|---|---|
public ControllerPowerLevel getPowerLevel() throws ControllerUnpluggedException
| |
| isAxisAvailable | back to summary |
|---|---|
| public boolean isAxisAvailable(ControllerAxis toCheck) throws ControllerUnpluggedException Returns if passed axis is available on controller.
| |
| isButtonAvailable | back to summary |
|---|---|
| public boolean isButtonAvailable(ControllerButton toCheck) throws ControllerUnpluggedException Returns if a given button is available on controller.
| |
| isButtonJustPressed | back to summary |
|---|---|
| public boolean isButtonJustPressed(ControllerButton toCheck) throws ControllerUnpluggedException Returns whether or not a given button has just been pressed since you last made a query about that button (either through this method, isButtonPressed(), or through the ControllerState side of things). If the button was not pressed the last time you checked but is now, this method will return true.
| |
| isButtonPressed | back to summary |
|---|---|
| public boolean isButtonPressed(ControllerButton toCheck) throws ControllerUnpluggedException Returns whether or not a given button has been pressed.
| |
| isConnected | back to summary |
|---|---|
| public boolean isConnected() Return whether or not the controller is currently connected. This first checks that the controller was successfully connected to our SDL backend. Then we check if the controller is currently plugged in.
| |
| nativeAxisAvailable | back to summary |
|---|---|
| private native boolean nativeAxisAvailable(long controllerPtr, int axisIndex) | |
| nativeButtonAvailable | back to summary |
|---|---|
| private native boolean nativeButtonAvailable(long controllerPtr, int buttonIndex) | |
| nativeCanVibrate | back to summary |
|---|---|
| private native boolean nativeCanVibrate(long controllerPtr) | |
| nativeCheckAxis | back to summary |
|---|---|
| private native int nativeCheckAxis(long controllerPtr, int axisIndex) | |
| nativeCheckButton | back to summary |
|---|---|
| private native boolean nativeCheckButton(long controllerPtr, int buttonIndex) | |
| nativeClose | back to summary |
|---|---|
| private native void nativeClose(long controllerPtr) | |
| nativeConnectController | back to summary |
|---|---|
| private native long nativeConnectController(int index) | |
| nativeDoVibration | back to summary |
|---|---|
| private native boolean nativeDoVibration(long controllerPtr, int leftMagnitude, int rightMagnitude, int duration_ms) | |
| nativeGetDeviceInstanceID | back to summary |
|---|---|
| private native int nativeGetDeviceInstanceID(long controllerPtr) | |
| nativeGetName | back to summary |
|---|---|
| private native String nativeGetName(long controllerPtr) | |
| nativeGetPlayerIndex | back to summary |
|---|---|
| private native int nativeGetPlayerIndex(long controllerPtr) | |
| nativeGetPowerLevel | back to summary |
|---|---|
| private native int nativeGetPowerLevel(long controllerPtr) | |
| nativeIsConnected | back to summary |
|---|---|
| private native boolean nativeIsConnected(long controllerPtr) | |
| nativeSetPlayerIndex | back to summary |
|---|---|
| private native void nativeSetPlayerIndex(long controllerPtr, int index) | |
| reconnectController | back to summary |
|---|---|
| public boolean reconnectController() Close and reconnect to the native gamepad at the index associated with this ControllerIndex object. This is will refresh the gamepad represented here. This should be called if something is plugged in or unplugged.
| |
| setPlayerIndex | back to summary |
|---|---|
| public void setPlayerIndex(int index) throws ControllerUnpluggedException Sets player index. At the time being, this doesn't seem to change the indication lights on a controller on Windows, Linux and Mac, but only an internal representation index.
| |
| updateButton | back to summary |
|---|---|
| private void updateButton(int buttonIndex) throws ControllerUnpluggedException | |