# Controllers (LWJGL API)
Date: 2015-07-28

## org.lwjgl.input
Class Controllers

    java.lang.Object
      org.lwjgl.input.Controllers

    public class Controllers

extends java.lang.Object

The collection of controllers currently connected.

Author:
  Kevin Glass

Constructor Summary
`Controllers()`

Method Summary
`static void` `clearEvents()` Clear any events stored for the controllers in this set
`static void` `create()` Initialise the controllers collection
`static void` `destroy()` Destroys any resources used by the controllers
`static Controller` `getController(int index)` Get a controller from the collection
`static int` `getControllerCount()` Retrieve a count of the number of controllers
`static boolean` `getEventButtonState()` Gets the state of the button that generated the current event
`static int` `getEventControlIndex()` Get the index of the control that caused the current event
`static long` `getEventNanoseconds()` Get the timestamp assigned to the current event
`static Controller` `getEventSource()` Get the source of the current event
`static float` `getEventXAxisValue()` Get the value on an X axis of the current event
`static float` `getEventYAxisValue()` Get the value on an Y axis of the current event
`static boolean` `isCreated()`
`static boolean` `isEventAxis()` Check if the current event was caused by a axis
`static boolean` `isEventButton()` Check if the current event was caused by a button
`static boolean` `isEventPovX()` Check if the current event was cause by the POV x-axis
`static boolean` `isEventPovY()` Check if the current event was cause by the POV x-axis
`static boolean` `isEventXAxis()` Check if the current event was caused by movement on the x-axis
`static boolean` `isEventYAxis()` Check if the current event was caused by movement on the y-axis
`static boolean` `next()` Move to the next event that has been stored.
`static void` `poll()` Poll the controllers available.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Controllers

    public Controllers()

Method Detail

### create

    public static void create()
                       throws LWJGLException

  Initialise the controllers collection

  Throws:
    `LWJGLException` - Indicates a failure to initialise the controller library.

### getController

    public static Controller getController(int index)

  Get a controller from the collection

  Parameters:
    `index` - The index of the controller to retrieve
  Returns:
    The controller requested

### getControllerCount

    public static int getControllerCount()

  Retrieve a count of the number of controllers

  Returns:
    The number of controllers available

### poll

    public static void poll()

  Poll the controllers available. This will both update their state and generate events that must be cleared.

### clearEvents

    public static void clearEvents()

  Clear any events stored for the controllers in this set

### next

    public static boolean next()

  Move to the next event that has been stored.

  Returns:
    True if there is still an event to process

### isCreated

    public static boolean isCreated()

  Returns:
    True if Controllers has been created

### destroy

    public static void destroy()

  Destroys any resources used by the controllers

### getEventSource

    public static Controller getEventSource()

  Get the source of the current event

  Returns:
    The source of the current event

### getEventControlIndex

    public static int getEventControlIndex()

  Get the index of the control that caused the current event

  Returns:
    The index of the control that cause the current event

### isEventButton

    public static boolean isEventButton()

  Check if the current event was caused by a button

  Returns:
    True if the current event was caused by a button

### isEventAxis

    public static boolean isEventAxis()

  Check if the current event was caused by a axis

  Returns:
    True if the current event was caused by a axis

### isEventXAxis

    public static boolean isEventXAxis()

  Check if the current event was caused by movement on the x-axis

  Returns:
    True if the current event was cause by movement on the x-axis

### isEventYAxis

    public static boolean isEventYAxis()

  Check if the current event was caused by movement on the y-axis

  Returns:
    True if the current event was caused by movement on the y-axis

### isEventPovX

    public static boolean isEventPovX()

  Check if the current event was cause by the POV x-axis

  Returns:
    True if the current event was caused by the POV x-axis

### isEventPovY

    public static boolean isEventPovY()

  Check if the current event was cause by the POV x-axis

  Returns:
    True if the current event was caused by the POV x-axis

### getEventNanoseconds

    public static long getEventNanoseconds()

  Get the timestamp assigned to the current event

  Returns:
    The timestamp assigned to the current event

### getEventButtonState

    public static boolean getEventButtonState()

  Gets the state of the button that generated the current event

  Returns:
    True if button was down, or false if released

### getEventXAxisValue

    public static float getEventXAxisValue()

  Get the value on an X axis of the current event

  Returns:
    The value on a x axis of the current event

### getEventYAxisValue

    public static float getEventYAxisValue()

  Get the value on an Y axis of the current event

  Returns:
    The value on a y axis of the current event

Copyright © 2002-2009 lwjgl.org. All Rights Reserved.