Skip to content

Use objects instead of arrays for buttons/axes mappings #19

@cvan

Description

@cvan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions