class Gamepad
package kha.input
Static methods
staticnotifyOnConnect(?connectListener:(index:Int) ‑> Void, ?disconnectListener:(index:Int) ‑> Void):Void
Use this event to get connected gamepad index
and listen to it with Gamepad.get(index).notify(axisListener, buttonListener)
.
Remember to also check Gamepad.get(0)
, gamepads may already be connected before the application was initialized.
staticremoveConnect(?connectListener:(index:Int) ‑> Void, ?disconnectListener:(index:Int) ‑> Void):Void
Variables
Methods
notify(?axisListener:(axisId:Int, value:Float) ‑> Void, ?buttonListener:(buttonId:Int, value:Float) ‑> Void):Void
In axisListener
, axisId
is axis id (for example axis == 0
is L-stick x
, 1
is L-stick y
, 2
is R-stick x
, 3
is R-stick y
, ...) and value
is in -1.0 - 1.0
range.
In buttonListener
, buttonId
is pressed button id (layout depends on vendor
), and value
is in 0 - 1.0
range how hard the button is pressed.