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

public Class Controllers

extends Object
Class Inheritance
Imports
com.badlogic.gdx.Application, .Application.ApplicationType, .Gdx, .LifecycleListener, com.badlogic.gdx.utils.Array, .GdxRuntimeException, .ObjectMap, com.badlogic.gdx.utils.reflect.ClassReflection

Provides access to connected Controller instances. Query the available controllers via getControllers(), add and remove global ControllerListener instances via addListener(ControllerListener) and removeListener(ControllerListener). The listeners will be invoked on the rendering thread. The global listeners will be invoked for all events generated by all controllers. Polling a Controller can be done by invoking one of its getter methods.
Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
pack-priv static final ObjectMap<Application, ControllerManager>
public static String
preferredManager

The class name of a preferred ControllerManager.

private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
addListener(ControllerListener listener)

Add a global ControllerListener that can react to events from all Controller instances.

public static void
clearListeners()

Removes every global ControllerListener previously added.

public static Array<Controller>

Returns:

the connected controllers
getControllers
()

Returns an array of connected Controller instances.

public static Controller

Returns:

the controller the player used most recently. This might return null if there is no controller connected or the last used connector disconnected
getCurrent
()

public static Array<ControllerListener>
getListeners()

Returns all listeners currently registered.

private static ControllerManager
private static void
public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

managersback to summary
pack-priv static final ObjectMap<Application, ControllerManager> managers
preferredManagerback to summary
public static String preferredManager

The class name of a preferred ControllerManager. If this is null then an appropriate ControllerManager will automatically be selected. This must be set before any controllers or managers are found.

TAGback to summary
private static final String TAG

Constructor Detail

Controllersback to summary
public Controllers()

Method Detail

addListenerback to summary
public static void addListener(ControllerListener listener)

Add a global ControllerListener that can react to events from all Controller instances. The listener will be invoked on the rendering thread.

clearListenersback to summary
public static void clearListeners()

Removes every global ControllerListener previously added.

getControllersback to summary
public static Array<Controller> getControllers()

Returns an array of connected Controller instances. This method should only be called on the rendering thread.

Returns:Array<Controller>

the connected controllers

getCurrentback to summary
public static Controller getCurrent()
Returns:Controller

the controller the player used most recently. This might return null if there is no controller connected or the last used connector disconnected

getListenersback to summary
public static Array<ControllerListener> getListeners()

Returns all listeners currently registered. Modifying this array will result in undefined behaviour.

getManagerback to summary
private static ControllerManager getManager()
initializeback to summary
private static void initialize()
removeListenerback to summary
public static void removeListener(ControllerListener listener)

Removes a global ControllerListener. The method must be called on the rendering thread.