Gamepad
Handling user input on connected controllers
nx.js supports up to eight connected controllers. Your application can use the web Gamepad API to read the state of these controllers.
The navigator.getGamepads()
function returns an array (always with a length of 8
)
containing either Gamepad
instances, or null
for indicies where the controller is
not connected.
Index 0
of the gamepads array is the "main" gamepad, which is a special case that reports the state of both the first connected controller as well as the handheld mode controller.