You use the functions in this module to figure out, given a Gamepad
object,
the buttons and axis that the user is activating on that gamepad.
You can get the List
of Gamepad
objects from either the
Gamepad.Simple
module or the
Gamepad.Advanced.
Private.Gamepad
A gamepad with a known mapping. You can use all control getters to query its state.
getIndex : Gamepad -> Basics.Int
Get the index of a gamepad. To match the LED indicator on XBOX gamepads, indices start from 1.
getIndex gamepad == 2
This type defines names for all available digital controls, whose
state can be either True
or False
.
Since the names cover all controls defined the W3C draft, they are used also when when remapping the gamepad to declare which action should be bound to which control.
isPressed : Gamepad -> Digital -> Basics.Bool
Returns True
if the button is currently being held down.
wasClicked : Gamepad -> Digital -> Basics.Bool
Returns True
when a button changes from being up to being held down.
wasReleased : Gamepad -> Digital -> Basics.Bool
Returns True
when a button changes from being held down to going back up.
dpadPosition : Gamepad -> { x : Basics.Int, y : Basics.Int }
X and Y coordinates (-1, 0 or +1) of the digital pad.
Some controls can be accessed also as analog and this type defines special names for them.
value : Gamepad -> Analog -> Basics.Float
Returns a single value from an analog control.
leftStickPosition : Gamepad -> { x : Basics.Float, y : Basics.Float }
X and Y coordinates (-1 to +1) of the left stick.
rightStickPosition : Gamepad -> { x : Basics.Float, y : Basics.Float }
X and Y coordinates (-1 to +1) of the right stick.
digitalToString : Digital -> String
This function is mostly used internally, you probably don't need it.