Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/gkey
An index of gamepad input mappings for controllers using the HTML5 gamepad API
https://github.com/hughsk/gkey
Last synced: 12 days ago
JSON representation
An index of gamepad input mappings for controllers using the HTML5 gamepad API
- Host: GitHub
- URL: https://github.com/hughsk/gkey
- Owner: hughsk
- License: other
- Created: 2013-06-23T13:31:15.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-06-23T13:37:31.000Z (over 11 years ago)
- Last Synced: 2024-10-17T16:41:12.239Z (22 days ago)
- Language: JavaScript
- Size: 95.7 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# gkey #
A list of human-readable names for Browser-friendly gamepads. Currently only
supports generic/Xbox-like controllers, but if you have the opportunity to test
with others then submit a pull request and I'll merge it in!## Installation ##
``` bash
npm install gkey
```## Usage ##
See [gp-controls](http://github.com/hughsk/gp-controls) for an example
implementation.``` javascript
var generic = require('gkey/generic')
var xbox = require('gkey/xbox')var gamepad = navigator.getGamepads()[0]
console.log(generic.buttons[0], gamepad.buttons[0]) // "" 1
console.log(xbox.buttons[0], gamepad.buttons[0]) // "" 1console.log(generic.axes[0], gamepad.buttons[0]) // "" -0.75
console.log(xbox.axes[0], gamepad.buttons[0]) // "" -0.75
```