rezoner / playground

Playground.js is a framework for your javascript based games. It gives you out-of-box access to essentials like mouse, keyboard, sound and well designed architecture that you can expand to your needs.
MIT License
466 stars 50 forks source link

gamepad analog sticks not working #14

Open Rybar opened 9 years ago

Rybar commented 9 years ago

gamepads[n].sticks[n] values remain undefined at runtime with stick activity, buttons are working fine.

Here's my little test app:

playground({

  //container: exampleContainer,

  gamepaddown: function(data) {

    this.button = data.button;
    this.gamepad = data.gamepad;

  },

  render: function() {

    this.layer.clear("#0af");

    var text = 
      "last pressed button is " + this.button + 
      " on gamepad " + this.gamepad;

    this.layer
      .font("24px 'arial'")
      .fillStyle("#fff")
      .fillText(text, 16, 32)
      .fillText(this.gamepads[0].sticks[1].x + " " + this.gamepads[0].sticks[0].y, 16, 96);

  }

});

I'm on Windows 7, with a Microsoft wireless dongle, xbox 360 gamepad, Latest Chrome browser.