Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
ardean committed Feb 6, 2017
0 parents commit 6486a7e
Show file tree
Hide file tree
Showing 18 changed files with 11,511 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
jspm_packages
npm-debug.log
.DS_Store
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 ardean

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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
Loading

0 comments on commit 6486a7e

Please sign in to comment.