Package 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
Constructors Constructor Description Controllers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearEvents()
Clear any events stored for the controllers in this setstatic void
create()
Initialise the controllers collectionstatic void
destroy()
Destroys any resources used by the controllersstatic Controller
getController(int index)
Get a controller from the collectionstatic int
getControllerCount()
Retrieve a count of the number of controllersstatic boolean
getEventButtonState()
Gets the state of the button that generated the current eventstatic int
getEventControlIndex()
Get the index of the control that caused the current eventstatic long
getEventNanoseconds()
Get the timestamp assigned to the current eventstatic Controller
getEventSource()
Get the source of the current eventstatic float
getEventXAxisValue()
Get the value on an X axis of the current eventstatic float
getEventYAxisValue()
Get the value on an Y axis of the current eventstatic boolean
isCreated()
static boolean
isEventAxis()
Check if the current event was caused by a axisstatic boolean
isEventButton()
Check if the current event was caused by a buttonstatic boolean
isEventPovX()
Check if the current event was cause by the POV x-axisstatic boolean
isEventPovY()
Check if the current event was cause by the POV x-axisstatic boolean
isEventXAxis()
Check if the current event was caused by movement on the x-axisstatic boolean
isEventYAxis()
Check if the current event was caused by movement on the y-axisstatic boolean
next()
Move to the next event that has been stored.static void
poll()
Poll the controllers available.
-
-
-
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
-
-