Closed andyfleming closed 7 years ago
Example use case: Debugging input:
'use strict'
var GamePad = require( 'node-gamepad' );
var controller = new GamePad('logitech/gamepadf310', {debug: false});
controller.connect();
const buttons = [
'back',
'start',
'dpadLeft',
'dpadRight',
'dpadUp',
'dpadDown',
'A',
'B',
'X',
'Y',
'LB',
'RB',
'LT',
'RT'
]
// Bind a press and release event for each button to see if they are all working
buttons.forEach((btn) => {
controller.on(btn + ':press', function() {
console.log(btn + ':press')
})
controller.on(btn + ':release', function() {
console.log(btn + ':release')
})
})
Related to #20, this makes debugging easier