Skip to content

Abstract Mapping Interface #8

@secretrobotron

Description

@secretrobotron

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):

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).

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