Package rosequartz.input
Class Gamepad
java.lang.Object
rosequartz.input.Gamepad
- Direct Known Subclasses:
NullGamepad
Represents a physical gamepad.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a gamepad axis (like joystick x or y, or the triggers).static classRepresents a gamepad button. -
Method Summary
Modifier and TypeMethodDescriptiongetAxes(Gamepad.Axis x, Gamepad.Axis y)Gets the value of two axes and puts them into a vec2.floatgetAxis(Gamepad.Axis a)Gets the value of an axis.booleanGets if a button is currently pressed.getName()Gets the name of the gamepad.booleanhasAxis(Gamepad.Axis a)Gets if the gamepad has an axis.booleanGets if the gamepad has a button.booleanGets if the gamepad is still connected.
-
Method Details
-
getName
Gets the name of the gamepad.- Returns:
- gamepad name
-
hasButton
Gets if the gamepad has a button.- Parameters:
b- button to check- Returns:
- gamepad has button
-
getButton
Gets if a button is currently pressed. If the button does not exist, it returns false.- Parameters:
b- button to check- Returns:
- button pressed
-
hasAxis
Gets if the gamepad has an axis.- Parameters:
a- axis to check- Returns:
- gamepad has axis
-
getAxis
Gets the value of an axis. If the axis does not exist, it returns 0.- Parameters:
a- axis to check- Returns:
- axis value
-
getAxes
Gets the value of two axes and puts them into a vec2. If an axis does not exist, it puts 0.- Parameters:
x- axis for value xy- axis for value y- Returns:
- axis value
-
isConnected
public boolean isConnected()Gets if the gamepad is still connected.- Returns:
- gamepad connected
-