@nativescript/canvas-gamepad 3.0.0-alpha.17 → 3.0.0
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.
- package/README.md +1 -0
- package/backend.linux.d.ts +1 -0
- package/backend.linux.js +2 -0
- package/backend.linux.js.map +1 -0
- package/backend.windows.d.ts +1 -2
- package/backend.windows.js +1 -25
- package/backend.windows.js.map +1 -1
- package/napi.d.ts +2 -0
- package/napi.js +27 -0
- package/napi.js.map +1 -0
- package/package.json +4 -2
- package/platforms/linux/lib/arm64/canvasgamepad.node +0 -0
- package/platforms/linux/lib/x64/canvasgamepad.node +0 -0
- package/platforms/windows/arm64/canvasgamepad.node +0 -0
- package/platforms/windows/x64/canvasgamepad.node +0 -0
- package/platforms/android/canvas_gamepad.aar +0 -0
package/README.md
CHANGED
|
@@ -47,6 +47,7 @@ Monitoring starts on the first `getGamepads()` call or gamepad listener.
|
|
|
47
47
|
| iOS, tvOS, visionOS | GameController `GCExtendedGamepad` | The Siri Remote stays mapped to keyboard events. `valueChangedHandler` on each controller is taken over. |
|
|
48
48
|
| Android | `KeyEvent` / `MotionEvent` from gamepad and joystick sources | Events from connected controllers are consumed at the activity window, so B no longer triggers Back while the API is in use. |
|
|
49
49
|
| Windows | `Windows.Gaming.Input.Gamepad` | Build the native module with `make windows-gamepad`. |
|
|
50
|
+
| Linux | evdev through [gilrs](https://gitlab.com/gilrs-project/gilrs), mapped with SDL's controller database | Needs read access to `/dev/input/event*`: desktop sessions grant it to gamepads via `uaccess`; otherwise add the user to the `input` group or a udev rule. Hot-plug is watched on the GLib main loop. Build with `tools/scripts/build-linux.sh canvas-gamepad-napi`. |
|
|
50
51
|
|
|
51
52
|
## License
|
|
52
53
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createBackend } from './napi';
|
package/backend.linux.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.linux.js","sourceRoot":"","sources":["../../../packages/canvas-gamepad/backend.linux.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC"}
|
package/backend.windows.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function createBackend(): GamepadBackend;
|
|
1
|
+
export { createBackend } from './napi';
|
package/backend.windows.js
CHANGED
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const Native = __non_webpack_require__('system_lib://canvasgamepad.node');
|
|
3
|
-
export function createBackend() {
|
|
4
|
-
let poller;
|
|
5
|
-
let notify;
|
|
6
|
-
let target;
|
|
7
|
-
const poll = (buffer) => {
|
|
8
|
-
const changed = poller.poll(buffer);
|
|
9
|
-
for (let i = 0; changed !== 0 && i < MAX_GAMEPADS; i++) {
|
|
10
|
-
if (changed & (1 << i)) {
|
|
11
|
-
const connected = buffer[i * SLOT_STRIDE + SLOT_CONNECTED] === 1;
|
|
12
|
-
notify(i, connected, connected ? poller.id(i) : '');
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
return {
|
|
17
|
-
start(buffer, onConnection) {
|
|
18
|
-
target = buffer;
|
|
19
|
-
notify = onConnection;
|
|
20
|
-
poller = new Native.NSCGamepadPoller(() => poll(target));
|
|
21
|
-
poll(buffer);
|
|
22
|
-
},
|
|
23
|
-
poll,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
1
|
+
export { createBackend } from './napi';
|
|
26
2
|
//# sourceMappingURL=backend.windows.js.map
|
package/backend.windows.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.windows.js","sourceRoot":"","sources":["../../../packages/canvas-gamepad/backend.windows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"backend.windows.js","sourceRoot":"","sources":["../../../packages/canvas-gamepad/backend.windows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC"}
|
package/napi.d.ts
ADDED
package/napi.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MAX_GAMEPADS, SLOT_CONNECTED, SLOT_STRIDE } from './common';
|
|
2
|
+
const Native = __non_webpack_require__('system_lib://canvasgamepad.node');
|
|
3
|
+
// Windows and Linux poller (canvasgamepad.node); both report through the same slot layout.
|
|
4
|
+
export function createBackend() {
|
|
5
|
+
let poller;
|
|
6
|
+
let notify;
|
|
7
|
+
let target;
|
|
8
|
+
const poll = (buffer) => {
|
|
9
|
+
const changed = poller.poll(buffer);
|
|
10
|
+
for (let i = 0; changed !== 0 && i < MAX_GAMEPADS; i++) {
|
|
11
|
+
if (changed & (1 << i)) {
|
|
12
|
+
const connected = buffer[i * SLOT_STRIDE + SLOT_CONNECTED] === 1;
|
|
13
|
+
notify(i, connected, connected ? poller.id(i) : '');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
start(buffer, onConnection) {
|
|
19
|
+
target = buffer;
|
|
20
|
+
notify = onConnection;
|
|
21
|
+
poller = new Native.NSCGamepadPoller(() => poll(target));
|
|
22
|
+
poll(buffer);
|
|
23
|
+
},
|
|
24
|
+
poll,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=napi.js.map
|
package/napi.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"napi.js","sourceRoot":"","sources":["../../../packages/canvas-gamepad/napi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAuB,MAAM,UAAU,CAAC;AAS1F,MAAM,MAAM,GAAiF,uBAAuB,CAAC,iCAAiC,CAAC,CAAC;AAExJ,2FAA2F;AAC3F,MAAM,UAAU,aAAa;IAC5B,IAAI,MAAqB,CAAC;IAC1B,IAAI,MAA+D,CAAC;IACpE,IAAI,MAAoB,CAAC;IAEzB,MAAM,IAAI,GAAG,CAAC,MAAoB,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;YACxD,IAAI,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBACxB,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,GAAG,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;gBACjE,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACrD,CAAC;QACF,CAAC;IACF,CAAC,CAAC;IAEF,OAAO;QACN,KAAK,CAAC,MAAM,EAAE,YAAY;YACzB,MAAM,GAAG,MAAM,CAAC;YAChB,MAAM,GAAG,YAAY,CAAC;YACtB,MAAM,GAAG,IAAI,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YACzD,IAAI,CAAC,MAAM,CAAC,CAAC;QACd,CAAC;QACD,IAAI;KACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nativescript/canvas-gamepad",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Gamepad API (navigator.getGamepads) for NativeScript",
|
|
5
5
|
"main": "index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"platforms": {
|
|
9
9
|
"ios": "6.0.0",
|
|
10
10
|
"android": "6.0.0",
|
|
11
|
-
"windows": "9.1.0"
|
|
11
|
+
"windows": "9.1.0",
|
|
12
|
+
"linux": "0.1.0-alpha.5"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"iOS",
|
|
23
24
|
"Android",
|
|
24
25
|
"Windows",
|
|
26
|
+
"Linux",
|
|
25
27
|
"Gamepad"
|
|
26
28
|
],
|
|
27
29
|
"author": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|