Package org.lwjgl.input
Class Controllers
- java.lang.Object
-
- org.lwjgl.input.Controllers
-
public class Controllers extends 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 voidclearEvents()Clear 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 intgetControllerCount()Retrieve a count of the number of controllersstatic booleangetEventButtonState()Gets the state of the button that generated the current eventstatic intgetEventControlIndex()Get the index of the control that caused the current eventstatic longgetEventNanoseconds()Get the timestamp assigned to the current eventstatic ControllergetEventSource()Get the source of the current eventstatic floatgetEventXAxisValue()Get the value on an X axis of the current eventstatic floatgetEventYAxisValue()Get the value on an Y axis of the current eventstatic booleanisCreated()static booleanisEventAxis()Check if the current event was caused by a axisstatic booleanisEventButton()Check if the current event was caused by a buttonstatic booleanisEventPovX()Check if the current event was cause by the POV x-axisstatic booleanisEventPovY()Check if the current event was cause by the POV x-axisstatic booleanisEventXAxis()Check if the current event was caused by movement on the x-axisstatic booleanisEventYAxis()Check 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.
-
-
-
Method Detail
-
create
public static void create() throws LWJGLExceptionInitialise 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
-
-