sgraham / gamepad.js

Gamepad access in browsers via Gamepad API
http://www.gamepadjs.com/
255 stars 52 forks source link

added XBox controller mapping for Chrome under Linux #7

Open panzi opened 12 years ago

panzi commented 12 years ago

The XBox controller has the same layout under Linux as under Windows (in Chrome - couldn't get gamepads to work with Firefox), except it exposes one button more: the XBox button. I just mapped it like this: into.xboxButton = raw.buttons[16]; I guess this button has a special function and cannot be used under Windows? Under Linux it's a button as any other.

Also I've fixed a typo (on one place raw was written as Raw), added missing semicolons (;) and limited the framerate of the example to 30fps in order to reduce CPU usage.

inequation commented 12 years ago

Sorry to spoil your fun, but... You put your code in the wrong file. ;) gamepad_uncompressed.js is just an intermediate file, changes should be made to gamepad_no_images.js and then build.py should be run. Check out my fork to see the differences, specifically commits 480b5b3d7a7120c9dd7728a3fc4f3542bfaaae11 and 398ab39d34f79c4ef431d96932f680492923b6a5.