You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

19 lines
678 B

$(document).on("viewinit", () ->
# An array containing the connected gamepads (see Gamepad class)
salet.view.gamepads = []
jQuery.ajax({
dataType: 'json',
url: 'mappings.json',
success: (data) ->
salet.view.gamepadmappings = data
window.addEventListener("gamepadconnected", (e) ->
salet.view.gamepads[e.gamepad.index] = new Gamepad(e.gamepad)
)
window.addEventListener("gamepaddisconnected", (e) ->
salet.view.gamepads[e.gamepad.index] = undefined
)
if (typeof navigator.getGamepads == "function")
for pad in navigator.getGamepads()
salet.view.gamepads[pad.index] = new Gamepad(pad)
})
)