Package org.lwjgl.input
Class Controllers
java.lang.Object
org.lwjgl.input.Controllers
The collection of controllers currently connected.
- Author:
- Kevin Glass
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidClear any events stored for the controllers in this setstatic voidcreate()Initialise the controllers collectionstatic voiddestroy()Destroys any resources used by the controllersstatic ControllergetController(int index) Get a controller from the collectionstatic intRetrieve a count of the number of controllersstatic booleanGets the state of the button that generated the current eventstatic intGet the index of the control that caused the current eventstatic longGet the timestamp assigned to the current eventstatic ControllerGet the source of the current eventstatic floatGet the value on an X axis of the current eventstatic floatGet the value on an Y axis of the current eventstatic booleanstatic booleanCheck if the current event was caused by a axisstatic booleanCheck if the current event was caused by a buttonstatic booleanCheck if the current event was cause by the POV x-axisstatic booleanCheck if the current event was cause by the POV x-axisstatic booleanCheck if the current event was caused by movement on the x-axisstatic booleanCheck if the current event was caused by movement on the y-axisstatic booleannext()Move to the next event that has been stored.static voidpoll()Poll the controllers available.
-
Constructor Details
-
Controllers
public Controllers()
-
-
Method Details
-
create
Initialise the controllers collection- Throws:
LWJGLException- Indicates a failure to initialise the controller library.
-
getController
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
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
-