https://github.com/repcomm/node-gamepad
Node.js Gamepad API implementation using node-usb
https://github.com/repcomm/node-gamepad
Last synced: 4 months ago
JSON representation
Node.js Gamepad API implementation using node-usb
- Host: GitHub
- URL: https://github.com/repcomm/node-gamepad
- Owner: RepComm
- Created: 2020-07-09T07:11:41.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-27T02:38:46.000Z (almost 4 years ago)
- Last Synced: 2025-07-29T23:12:32.549Z (6 months ago)
- Language: JavaScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# node-gamepad
A partial implementation of the
[Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API)
for node js
## Purpose
Electron support for Gamepad API is still lacking
and I need it for [OpenBF](https://github.com/node-openbf-project/node-openbf-client)
This project uses [node-usb](https://github.com/tessel/node-usb)
And I used these references while deving:
1. [lloeki/xbox_one_controller](https://github.com/lloeki/xbox_one_controller/blob/master/xbox_one_controller/xbox_one_controller_packet.h)
2. [gamepad tester](https://html5gamepad.com/)
3. [usb busy error](https://github.com/tessel/node-usb/issues/174)
## Usage
See `./examples` for more
```javascript
//Analog of navigator.getGamepads();
let gps = Gamepad.getGamepads();
console.log(gps);
```
## Currently implements
1. `Gamepad.getGamepads` - finished
2. `Gamepad` - instancing and most button parsing (not usable just yet)
3. `GamepadButton` - satisfactory
4. `GamepadVendor` - satisfactory
## Status
Nearly ready for alpha testing