jbuck/input.js — Issue #8: Abstract Mapping Interface
Author: secretrobotron
Created: 2011-11-13 09:12:18+00:00
State: open

I know we talked about implementing some abstraction over the input names, so that users can attach events to things like "jump" which is tied to every button or something.

Maybe (with some leniency on event-driven paradigm, please):

```javascript
var gamepad,
mapping = { "BUTTON_A": "jump" };
window.addEventListener("MozGamepadConnected", function(e) {
gamepad = new Input.Device(e.gamepad, mapping);
});
gamepad.listen( "jump", function() {
player.jump();
});
```

Code for using a hilariously 8-bit joystick can look effectively the same as code for using a PS3 controller, given that the control scheme for the game is relatively simple (e.g. NES Mario-like controls).