Static variables

@:value({ A : 0, B : 1, X : 2, Y : 3, LB : 4, RB : 5, LT : 6, RT : 7, back : 8, start : 9, analogClick : 10, ranalogClick : 11, dpadUp : 12, dpadDown : 13, dpadLeft : 14, dpadRight : 15, analogX : 18, analogY : 19, ranalogX : 20, ranalogY : 21, names : ["A", "B", "X", "Y", "LB", "RB", "LT", "RT", "Select", "Start", "LCLK", "RCLK", "DUp", "DDown", "DLeft", "DRight", "LX", "LY", "RX", "RY"] })staticCONFIG_JS_DS4:{start:Int, ranalogY:Int, ranalogX:Int, ranalogClick:Int, names:Array<String>, dpadUp:Int, dpadRight:Int, dpadLeft:Int, dpadDown:Int, back:Int, analogY:Int, analogX:Int, analogClick:Int, Y:Int, X:Int, RT:Int, RB:Int, LT:Int, LB:Int, B:Int, A:Int} = { A : 0, B : 1, X : 2, Y : 3, LB : 4, RB : 5, LT : 6, RT : 7, back : 8, start : 9, analogClick : 10, ranalogClick : 11, dpadUp : 12, dpadDown : 13, dpadLeft : 14, dpadRight : 15, analogX : 18, analogY : 19, ranalogX : 20, ranalogY : 21, names : ["A", "B", "X", "Y", "LB", "RB", "LT", "RT", "Select", "Start", "LCLK", "RCLK", "DUp", "DDown", "DLeft", "DRight", "LX", "LY", "RX", "RY"] }

Mapping for Dualshock 4

@:value({ A : 1, B : 2, X : 0, Y : 3, LB : 4, RB : 5, LT : 6, RT : 7, back : 8, start : 9, analogClick : 10, ranalogClick : 11, dpadUp : 9000, dpadDown : 9000, dpadLeft : 9000, dpadRight : 9000, analogX : 18, analogY : 19, ranalogX : 20, ranalogY : 23, names : ["A", "B", "X", "Y", "LB", "RB", "LT", "RT", "Select", "Start", "LCLK", "RCLK", "DUp", "DDown", "DLeft", "DRight", "LX", "LY", "RX", "RY"] })staticCONFIG_JS_DS4_FF:{start:Int, ranalogY:Int, ranalogX:Int, ranalogClick:Int, names:Array<String>, dpadUp:Int, dpadRight:Int, dpadLeft:Int, dpadDown:Int, back:Int, analogY:Int, analogX:Int, analogClick:Int, Y:Int, X:Int, RT:Int, RB:Int, LT:Int, LB:Int, B:Int, A:Int} = { A : 1, B : 2, X : 0, Y : 3, LB : 4, RB : 5, LT : 6, RT : 7, back : 8, start : 9, analogClick : 10, ranalogClick : 11, dpadUp : 9000, dpadDown : 9000, dpadLeft : 9000, dpadRight : 9000, analogX : 18, analogY : 19, ranalogX : 20, ranalogY : 23, names : ["A", "B", "X", "Y", "LB", "RB", "LT", "RT", "Select", "Start", "LCLK", "RCLK", "DUp", "DDown", "DLeft", "DRight", "LX", "LY", "RX", "RY"] }

Mapping for Dualshock 4 (Firefox)

D-Pad isn't working

@:value({ A : 0, B : 1, X : 2, Y : 3, LB : 4, RB : 5, LT : 6, RT : 7, back : 8, start : 9, analogClick : 10, ranalogClick : 11, dpadUp : 12, dpadDown : 13, dpadLeft : 14, dpadRight : 15, analogX : 17, analogY : 18, ranalogX : 19, ranalogY : 20, names : ["A", "B", "X", "Y", "LB", "RB", "LT", "RT", "Select", "Start", "LCLK", "RCLK", "DUp", "DDown", "DLeft", "DRight", "LX", "LY", "RX", "RY"] })staticCONFIG_JS_STD:{start:Int, ranalogY:Int, ranalogX:Int, ranalogClick:Int, names:Array<String>, dpadUp:Int, dpadRight:Int, dpadLeft:Int, dpadDown:Int, back:Int, analogY:Int, analogX:Int, analogClick:Int, Y:Int, X:Int, RT:Int, RB:Int, LT:Int, LB:Int, B:Int, A:Int} = { A : 0, B : 1, X : 2, Y : 3, LB : 4, RB : 5, LT : 6, RT : 7, back : 8, start : 9, analogClick : 10, ranalogClick : 11, dpadUp : 12, dpadDown : 13, dpadLeft : 14, dpadRight : 15, analogX : 17, analogY : 18, ranalogX : 19, ranalogY : 20, names : ["A", "B", "X", "Y", "LB", "RB", "LT", "RT", "Select", "Start", "LCLK", "RCLK", "DUp", "DDown", "DLeft", "DRight", "LX", "LY", "RX", "RY"] }

Standard mapping

@:value(CONFIG_JS_STD)staticDEFAULT_CONFIG:PadConfig = CONFIG_JS_STD

Static methods

staticcreateDummy():Pad

Creates a new dummy unconnected game pad, which can be used instead of checking for null everytime. Use wait() to get real physical game pad access.

staticpickConfig(name:String):PadConfig

staticwait(onPad:Pad ‑> Void):Void

Wait until a gamepad gets connected. On some platforms, this might require the user to press a button until it activates

Variables

@:value(0.1)axisDeadZone:Float = 0.1

@:value([])buttons:Array<Bool> = []

@:value(DEFAULT_CONFIG)config:PadConfig = DEFAULT_CONFIG

@:value(true)read onlyconnected:Bool = true

@:value(-1)index:Int = -1

read onlyname:String

@:value([])prevValues:Array<Float> = []

read onlyrxAxis:Float

read onlyryAxis:Float

@:value([])values:Array<Float> = []

read onlyxAxis:Float

read onlyyAxis:Float

Methods

isDown(button:Int):Bool

isPressed(button:Int):Bool

isReleased(button:Int):Bool

dynamiconDisconnect():Void

reset():Void

rumble(strength:Float, time_s:Float):Void