Description

Keyboard, Gamepad et accelerometer

Example

Keyboard:

var canvas =    CE.defines("canvas_id").
                extend(Input).
                ready(function() {
                    canvas.Scene.call("Map");
                });

canvas.Scene.new({
     name: "Map",
     ready: function(stage) {

        canvas.Input.keyDown(Input.Bottom);
        canvas.Input.keyDown(Input.A, function() {
            console.log("A pressed");
        });
        canvas.Input.keyUp(Input.A, function() {
            console.log("A released");
        });

     },
     render: function(stage) {

        if (canvas.Input.isPressed(Input.Bottom)) {
            console.log("Bottom pressed");
        }

        stage.refresh();
     }
}); 

Gamepad :

In header (http://www.gamepadjs.com)

&lt;script src="extends/gamepad.js"></script&gt;

Script :

var canvas =    CE.defines("canvas_id").
                extend(Input).
                ready(function() {
                    canvas.Scene.call("Map");
                });

canvas.Scene.new({
     name: "Map",
     ready: function(stage) {

        this.gamepad = canvas.Input.Gamepad.init(function() {
           console.log("Gamepad connected");
        }, function() {
            console.log("Gamepad disconnected");
        });

        this.gamepad.addListener("faceButton0", function() {
           console.log("A pressed");
        }, function() {
           console.log("A released");
        });

        canvas.Input.keyDown(Input.Right, function() {
           // Code
        });
        this.gamepad.addListener("dpadRight", Input.Right);

     },
     render: function(stage) {

        this.gamepad.update();

        stage.refresh();
     }
}); 

Discussion