input.bindGamepad
bindGamepad(index: number, button: object, keyCode: number) → {}
Associate a gamepad event to a keycode
// enable the keyboard
me.input.bindKey(me.input.KEY.X, "shoot");
...
// map the lower face button on the first gamepad to the X key
me.input.bindGamepad(0, {type:"buttons", code: me.input.GAMEPAD.BUTTONS.FACE_1}, me.input.KEY.X);
// map the left axis value on the first gamepad to the LEFT key
me.input.bindGamepad(0, {type:"axes", code: me.input.GAMEPAD.AXES.LX, threshold: -0.5}, me.input.KEY.LEFT);
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
index | number |
Gamepad index |
||
button | object |
Button/Axis definition |
||
button.type | string |
"buttons" or "axes" |
||
button.code | number |
button or axis code id (See input.GAMEPAD.BUTTONS, input.GAMEPAD.AXES) |
||
button.threshold | number |
<optional> |
1 |
value indicating when the axis should trigger the keycode (e.g. -0.5 or 0.5) |
keyCode | number |
(See input.KEY) |
Type | Description |
---|