Fork me on GitHub
View source

package haxepunk.input

class Gamepad

A gamepad.

Static variables

View source

static deadZone : Float

Determines the gamepad's deadZone. Anything under this value will be considered 0 to prevent jitter.

View source

static read only gamepadCount : Int

Returns the number of connected gamepads

View source

static gamepads : Map<Int, Gamepad>

Static functions

View source

static gamepad (id : GamepadID) : Null<Gamepad>

Returns a gamepad object, or null if none exists at this ID.


Parameters:
id   

The id of the gamepad, starting with 0


Returns:

A Gamepad object

Variables

write only axis : Map<Int, Float>

Each axis contained in an array.

buttons : Map<Int, JoyButtonState>

A map of buttons and their states

connected : Bool

If the gamepad is currently connected.

hat : Vector2

A Point containing the gamepad's hat value.

id : Int

Functions

View source

check (button : GamepadButton) : Bool

If the gamepad button is held down. Omit argument to check for any button.


Parameters:
button   

The button index to check.

View source

checkInput (input : InputType) : Bool

View source

defineAxis (input : InputType, axis : GamepadAxis, minValue : Float = 0, maxValue : Float = 1) : Void

View source

defineButton (input : InputType, buttons : Array<GamepadButton>) : Void

View source

getAxis (a : Int) : Float

Returns the axis value (from 0 to 1)


Parameters:
a   

The axis index to retrieve starting at 0

View source

pressed (button : GamepadButton) : Bool

View source

released (button : GamepadButton) : Bool

If the gamepad button was released this frame. Omit argument to check for any button.


Parameters:
button   

The button index to check.

View source

update () : Void