Top Description Fields Constructors Methods
com.badlogic.gdx.controllers

pack-priv abstract Class AbstractController

extends Object
implements Disposable, Controller
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.controllers.Controller, com.badlogic.gdx.utils.Disposable
Imports
com.badlogic.gdx.utils.Array, .Disposable

AbstractController to be used by new Controller implementations. Provides listener notification implementations and default return values

Field Summary

Modifier and TypeField and Description
private boolean
private final Array<ControllerListener>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public void
public boolean
public void
dispose()

Implements com.badlogic.gdx.utils.Disposable.dispose.

Releases all resources of this object.

public int
public boolean
public boolean
protected void
notifyListenersAxisMoved(int axisNum, float value)

protected void
protected void
public void
public void
setPlayerIndex(int
0 typically 0 to 3 for player indices, and PLAYER_IDX_UNSET for unset
index
)

Implements com.badlogic.gdx.controllers.Controller.setPlayerIndex.

Sets the player index of this controller.

public void
startVibration(int
duration, in milliseconds
duration
,
float
value between 0f and 1f
strength
)

Implements com.badlogic.gdx.controllers.Controller.startVibration.

Starts vibrating this controller, if possible.

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectedback to summary
private boolean connected
listenersback to summary
private final Array<ControllerListener> listeners

Constructor Detail

AbstractControllerback to summary
pack-priv AbstractController()

Method Detail

addListenerback to summary
public void addListener(ControllerListener controllerListener)

Implements com.badlogic.gdx.controllers.Controller.addListener.

Doc from com.badlogic.gdx.controllers.Controller.addListener.

Adds a new 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.

Annotations
@Override
cancelVibrationback to summary
public void cancelVibration()

Implements com.badlogic.gdx.controllers.Controller.cancelVibration.

Doc from com.badlogic.gdx.controllers.Controller.cancelVibration.

Cancel any running vibration. May not be supported by implementations

Annotations
@Override
canVibrateback to summary
public boolean canVibrate()

Implements com.badlogic.gdx.controllers.Controller.canVibrate.

Returns:boolean

Doc from com.badlogic.gdx.controllers.Controller.canVibrate.

whether the connected controller or the current controller implementation can rumble. Note that this is no guarantee that the connected controller itself can vibrate.

Annotations
@Override
disposeback to summary
public void dispose()

Implements com.badlogic.gdx.utils.Disposable.dispose.

Doc from com.badlogic.gdx.utils.Disposable.dispose.

Releases all resources of this object.

Annotations
@Override
getPlayerIndexback to summary
public int getPlayerIndex()

Implements com.badlogic.gdx.controllers.Controller.getPlayerIndex.

Returns:int

Doc from com.badlogic.gdx.controllers.Controller.getPlayerIndex.

0-based player index of this controller, or PLAYER_IDX_UNSET if none is set

Annotations
@Override
isConnectedback to summary
public boolean isConnected()

Implements com.badlogic.gdx.controllers.Controller.isConnected.

Returns:boolean

Doc from com.badlogic.gdx.controllers.Controller.isConnected.

true when this Controller is still connected, false if it already disconnected

Annotations
@Override
isVibratingback to summary
public boolean isVibrating()

Implements com.badlogic.gdx.controllers.Controller.isVibrating.

Returns:boolean

Doc from com.badlogic.gdx.controllers.Controller.isVibrating.

if the controller is currently rumbling

Annotations
@Override
notifyListenersAxisMovedback to summary
protected void notifyListenersAxisMoved(int axisNum, float value)
notifyListenersButtonDownback to summary
protected void notifyListenersButtonDown(int button)
notifyListenersButtonUpback to summary
protected void notifyListenersButtonUp(int button)
removeListenerback to summary
public void removeListener(ControllerListener controllerListener)

Implements com.badlogic.gdx.controllers.Controller.removeListener.

Doc from com.badlogic.gdx.controllers.Controller.removeListener.

Removes the given ControllerListener

Annotations
@Override
setPlayerIndexback to summary
public void setPlayerIndex(int index)

Implements com.badlogic.gdx.controllers.Controller.setPlayerIndex.

Doc from com.badlogic.gdx.controllers.Controller.setPlayerIndex.

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

Parameters
index:int

0 typically 0 to 3 for player indices, and PLAYER_IDX_UNSET for unset

Annotations
@Override
startVibrationback to summary
public void startVibration(int duration, float strength)

Implements com.badlogic.gdx.controllers.Controller.startVibration.

Doc from com.badlogic.gdx.controllers.Controller.startVibration.

Starts vibrating this controller, if possible.

Parameters
duration:int

duration, in milliseconds

strength:float

value between 0f and 1f

Annotations
@Override
supportsPlayerIndexback to summary
public boolean supportsPlayerIndex()

Implements com.badlogic.gdx.controllers.Controller.supportsPlayerIndex.

Returns:boolean

Doc from com.badlogic.gdx.controllers.Controller.supportsPlayerIndex.

whether the connected controller (or the implementation) can return and set the current player index

Annotations
@Override