Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ardean/jsgamepad
:video_game: W3C Gamepad API Simplified & Implementation fixes
https://github.com/ardean/jsgamepad
fixes gamepad gamepad-api gamepad-library jsgamepad w3c w3c-gamepad w3c-gamepad-api
Last synced: 4 days ago
JSON representation
:video_game: W3C Gamepad API Simplified & Implementation fixes
- Host: GitHub
- URL: https://github.com/ardean/jsgamepad
- Owner: ardean
- License: mit
- Created: 2017-02-06T21:26:13.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-18T10:28:36.000Z (over 7 years ago)
- Last Synced: 2024-11-09T20:08:28.987Z (11 days ago)
- Topics: fixes, gamepad, gamepad-api, gamepad-library, jsgamepad, w3c, w3c-gamepad, w3c-gamepad-api
- Language: JavaScript
- Homepage: https://ardean.github.io/jsGamepad/
- Size: 172 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsGamepad
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![License][license-image]][license-url]**W3C Gamepad API Simplified & Implementation fixes**
[Demo](https://ardean.github.io/jsGamepad/)
## Specification
[Gamepad API, W3C](https://w3c.github.io/gamepad/)## Fixes
This lib fixes a bug in Chrome, where the `connected` event will be emitted instead of the `disconnected` event.
## Usage
I suggest you to use [jspm](http://jspm.io/) as your package manager.
```js
import gamepad from "jsgamepad";gamepad.on("connected", (gamepad) => {
console.log("connected " + gamepad.index);
}).on("disconnected", (gamepad) => {
console.log("disconnected " + gamepad.index);
}).on("buttonPressed", ({ button, buttonIndex, gamepad }) => {
console.log("pressed " + buttonIndex);
}).on("buttonReleased", ({ button, buttonIndex, gamepad }) => {
console.log("released " + buttonIndex);
});// start loop for buttons and axes detection
gamepad.watch();
```### Directly in a browser
Please checkout the [index-dist.html](https://ardean.github.io/jsGamepad/index-dist.html) file for direct usage in a browser.
## TODO
- API
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/jsgamepad.svg
[npm-url]: https://npmjs.org/package/jsgamepad
[downloads-image]: https://img.shields.io/npm/dm/jsgamepad.svg
[downloads-url]: https://npmjs.org/package/jsgamepad
[license-image]: https://img.shields.io/npm/l/jsgamepad.svg
[license-url]: LICENSE