HTML5-JavaScript-Gamepad-Controller-Library icon indicating copy to clipboard operation
HTML5-JavaScript-Gamepad-Controller-Library copied to clipboard

Use objects instead of arrays for buttons/axes mappings

Open cvan opened this issue 11 years ago • 0 comments

It's kind of hard to read (count) the indices in the arrays to figure out which buttons/axes are mapped to which indices. It would be nice if we could specify the buttons and axes mappings as an object with each key being the constant string (e.g., 'LEFT_TOP_SHOULDER') instead of the index (e.g., 4).

Buttons: https://github.com/kallaspriit/HTML5-JavaScript-Gamepad-Controller-Library/blob/af601ac2/gamepad.js#L481 https://github.com/kallaspriit/HTML5-JavaScript-Gamepad-Controller-Library/blob/af601ac2/gamepad.js#L424-L430

Axes: https://github.com/kallaspriit/HTML5-JavaScript-Gamepad-Controller-Library/blob/af601ac2/gamepad.js#L484 https://github.com/kallaspriit/HTML5-JavaScript-Gamepad-Controller-Library/blob/af601ac2/gamepad.js#L438

cvan avatar Jul 16 '14 01:07 cvan