@sensslen/node-gamepad 1.0.8-beta.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +38 -38
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,60 +1,63 @@
1
1
  # node-gamepad [![CodeFactor](https://www.codefactor.io/repository/github/sensslen/node-gamepad/badge)](https://www.codefactor.io/repository/github/sensslen/node-gamepad)
2
2
 
3
- > node-gamepad is a package for node that allows you to effortlessly interface your node applications with a variety of gamepad controllers.
4
- > Please note that XBOX 360 Controllers (and all of their derivatives) are known to behave bad. Thus this library does not support these kinds of Controllers.
3
+ `node-gamepad` is a Node.js package for interfacing your applications with a variety of gamepad controllers. It is written in TypeScript and provides type definitions for a better development experience.
4
+
5
+ > **Note:** XBOX 360 Controllers (and all of their derivatives) are known to behave badly and are **not supported** by this library.
5
6
 
6
7
  ## Installation
7
8
 
8
- ```js
9
+ ```sh
9
10
  npm install @sensslen/node-gamepad
10
11
  ```
11
12
 
12
13
  ### Supported Controllers
13
14
 
14
- 1. snes/tomee
15
- 1. snes/retrolink
16
- 1. ps3/dualshock3
17
- 1. ps4/dualshock4
18
- 1. n64/retrolink
19
- 1. logitech/rumblepad2
20
- 1. logitech/dualaction
21
- 1. logitech/gamepadf310
22
- 1. logitech/gamepadf710
23
- 1. microsoft/sidewinder-precision-2
15
+ The following controllers are actively maintained and tested:
16
+
17
+ - Logitech Rumblepad 2
18
+ - Logitech Gamepad F310
19
+ - Logitech Gamepad F710
20
+
21
+ You can also create your own controller definitions by providing a custom configuration to the constructor. Contributions for additional controller support are welcome!
22
+
24
23
 
25
24
  ## How to Use
26
25
 
27
- Plug in a supported controller and run a variation of the code below (with an actual supported controller).
28
- Slternatively you can also run the code below and then plug in a supported controller.
26
+ Plug in a supported controller and run a variation of the code below (with an actual supported controller). Alternatively, you can also run the code below and then plug in a supported controller.
29
27
 
30
- ### Code Example
28
+ ### TypeScript Example
31
29
 
32
30
  ```ts
33
- import { NodeGamepad } from 'node-gamepad';
34
- import * as f310 from 'node-gamepad/controllers/logitech/gamepadf310';
31
+ import { NodeGamepad } from '@sensslen/node-gamepad';
32
+ import * as f310 from '@sensslen/node-gamepad/controllers/logitech/gamepadf310';
35
33
 
36
- let gamepad = new NodeGamepad(f310);
34
+ const gamepad = new NodeGamepad(f310);
37
35
 
38
36
  gamepad.start();
39
37
 
40
- gamepad.on('connected', function () {
41
- console.log('connected');
38
+ gamepad.on('connected', () => {
39
+ console.log('connected');
42
40
  });
43
- gamepad.on('disconnected', function () {
44
- console.log('disconnected');
41
+ gamepad.on('disconnected', () => {
42
+ console.log('disconnected');
45
43
  });
46
44
 
47
- gamepad.on('up:press', function () {
48
- console.log('up');
45
+ gamepad.on('up:press', () => {
46
+ console.log('up');
49
47
  });
50
- gamepad.on('down:press', function () {
51
- console.log('down');
48
+ gamepad.on('down:press', () => {
49
+ console.log('down');
52
50
  });
53
51
 
54
- // dont forget to stop when you are finished: gamepad.stop()
55
- // the gamepad class also registers for app termination just in case
52
+ // Don't forget to stop when you are finished:
53
+ // gamepad.stop();
54
+ // The gamepad class also registers for app termination just in case.
56
55
  ```
57
56
 
57
+
58
+ > **Note:** Type definitions are included for all event handlers and configuration objects. JavaScript users also benefit from improved autocompletion and documentation in modern editors.
59
+
60
+
58
61
  ## Supported Events
59
62
 
60
63
  This package supports up to 3 different types of components: joysticks, buttons and statuses (like battery level, charging, etc). It's possible that a controller could make use of all 3 different components or even introduce additional components. The idea here is the dictionary file will dictate how the controller will be used and how to read data from it.
@@ -74,19 +77,16 @@ A status value is read from a pin on the hardware and then can be mapped to a "s
74
77
 
75
78
  1. `{name}:change`
76
79
 
80
+
77
81
  ## Contributing Controllers
78
82
 
79
- Please feel free to provide your own custom controller
80
- configurations to the constructor. It would b highly appreciated if you make the configuration publically available by opening a pull request.
81
83
 
82
- ## License
84
+ You are welcome to provide your own custom controller configurations to the constructor. Contributions of new controller definitions are highly appreciated. Please consider making them publicly available by opening a pull request.
83
85
 
84
- The MIT License (MIT)
86
+ ---
85
87
 
86
- Copyright (c) 2021 Simon Ensslen and contributors
88
+ > **Note:** This project is written in [TypeScript](https://www.typescriptlang.org/), providing type definitions and improved editor support. It can be used from both TypeScript and JavaScript projects. Type definitions are included for all event handlers and configuration objects. JavaScript users also benefit from improved autocompletion and documentation in modern editors.
87
89
 
88
- 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:
89
-
90
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
90
+ ## License
91
91
 
92
- 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.
92
+ This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sensslen/node-gamepad",
3
- "version": "1.0.8-beta.7",
3
+ "version": "1.0.8",
4
4
  "description": "node-gamepad is a package for node that allows you to effortlessly interface your node applications with a variety of gamepad controllers. This is a port of node-gamepad library to typescript by also removing some of the restrictions implied by this library (namely allowing gamepads to be subcleassed and also improving usb interaction)",
5
5
  "homepage": "https://github.com/sensslen/node-gamepad",
6
6
  "bugs": {