@vnejs/docs 0.2.67 → 0.2.69

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.
@@ -0,0 +1,5 @@
1
+ # 0.2.68
2
+
3
+ - `plugins/controls/gamepad` — joypad.js is gone. The plugin polls `navigator.getGamepads()` every frame, including a pad already connected at launch. API: `GAMEPAD.BUTTON_PRESS`, `GAMEPAD.BUTTON_RELEASE`, `GAMEPAD.AXIS`, `GAMEPAD.CONNECT`, `GAMEPAD.DISCONNECT`. One pad still sets `CONTROLS.DEVICE_SET` at once.
4
+ - `cli/desktop` — Electron is `41.10.7` (`games/coraline`, `games/checkers`, and `games/vn.skeleton` pin the same). On Windows the host disables `Windows.Gaming.Input` (`disable-features=EnableWindowsGamingInputDataFetcher`) so `navigator.getGamepads()` reads XInput.
5
+ - `compatibility/controls.gamepad/controls.cursor` — stick input comes from `GAMEPAD.AXIS`. Left stick is `CURSOR.SHIFT`, right stick is `CURSOR.SCROLL`.
@@ -2,6 +2,7 @@
2
2
 
3
3
  Engine and public API changes. One file per `@vnejs/docs` release. Newest first.
4
4
 
5
+ - [0.2.68](./0.2.68.md)
5
6
  - [0.2.66](./0.2.66.md)
6
7
  - [0.2.65](./0.2.65.md)
7
8
  - [0.2.64](./0.2.64.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/docs",
3
- "version": "0.2.67",
3
+ "version": "0.2.69",
4
4
  "description": "VNEJS documentation for engine consumers and coding agents",
5
5
  "files": [
6
6
  "*.md",
@@ -40,7 +40,7 @@ None.
40
40
  | `controls` | Handles EMIT, PUSH, POP; sets `shared.isControlsLocked` while an async EMIT handler runs. |
41
41
  | `controls.device` | Holds `currentDevice`; on `DEVICE_SET` emits `DEVICE_CHANGED` only when the type really changes. |
42
42
 
43
- Sources of `DEVICE_SET`: keyboard (keydown) → keyboard; `controls.gamepad.device` (button_press / axis_move) → xbox|playstation by `gamepad.id`; cursor (`mousemove`) → keyboard.
43
+ Sources of `DEVICE_SET`: keyboard (keydown) → keyboard; `controls.gamepad.device` (`GAMEPAD.CONNECT` for one pad, `GAMEPAD.BUTTON_PRESS`, `GAMEPAD.AXIS`) → xbox|playstation by `gamepad.id`; cursor (`mousemove`) → keyboard.
44
44
 
45
45
  ## Related plugins
46
46
 
@@ -2,15 +2,20 @@
2
2
 
3
3
  Package: `@vnejs/plugins.controls.gamepad` · namespace: `GAMEPAD`
4
4
 
5
- Gamepad → abstract control events via joypad.js.
5
+ Gamepad → abstract control events. The plugin polls `navigator.getGamepads()` every frame.
6
6
 
7
7
  ## Events
8
8
 
9
9
  Handler payloads and results are typed through module augmentation of the contract (`VneEventPayloadMap` / `VneEventResultMap`). The types live in `@vnejs/contracts.controls.gamepad`.
10
10
 
11
- | Key | String | Meaning |
12
- | ------ | ------------------ | -------------------------------------------------------------------- |
13
- | `EMIT` | `vne:gamepad:emit` | Proxy a press to `CONTROLS.EMIT` (`{ keys }`) with lock `inProcess`. |
11
+ | Key | String | Meaning |
12
+ | ---------------- | ---------------------------- | ------------------------------------------------------------------------------------------ |
13
+ | `EMIT` | `vne:gamepad:emit` | Proxy a press to `CONTROLS.EMIT` (`{ keys }`) with lock `inProcess`. |
14
+ | `BUTTON_PRESS` | `vne:gamepad:button_press` | Rising edge of a logical button (`{ buttonName, gamepad? }`). |
15
+ | `BUTTON_RELEASE` | `vne:gamepad:button_release` | Falling edge of a logical button (`{ buttonName, gamepad? }`). |
16
+ | `AXIS` | `vne:gamepad:axis` | Stick or trigger axis while `abs(value) > 0.1` (`{ axis, value, gamepad? }`), every frame. |
17
+ | `CONNECT` | `vne:gamepad:connect` | A gamepad index appeared in `navigator.getGamepads()`. Payload is empty. |
18
+ | `DISCONNECT` | `vne:gamepad:disconnect` | A gamepad index left `navigator.getGamepads()`. Payload is empty. |
14
19
 
15
20
  ## Constants
16
21
 
@@ -26,9 +31,9 @@ None.
26
31
 
27
32
  ## Button mapping (W3C / Xbox standard)
28
33
 
29
- After joypad yields logical name `button_N`, button and trigger modules emit `GAMEPAD.EMIT`, and `controls.gamepad` proxies keys to `CONTROLS.EMIT`:
34
+ After the poll yields logical name `button_N`, `controls.gamepad.buttons` emits `GAMEPAD.EMIT`, and `controls.gamepad` proxies keys to `CONTROLS.EMIT`:
30
35
 
31
- | joypad | Physical (standard) | Abstract control |
36
+ | Logical name | Physical (standard) | Abstract control |
32
37
  | ---------------- | ------------------- | ------------------------------------------ |
33
38
  | `button_0` | A / Cross (bottom) | `ACCEPT` |
34
39
  | `button_1` | B / Circle (right) | `BACK` |
@@ -44,13 +49,19 @@ After joypad yields logical name `button_N`, button and trigger modules emit `GA
44
49
 
45
50
  ## Profiles and active pad
46
51
 
47
- joypad.js applies **one** `customButtonMapping` to all devices. On Steam Deck you often see two pads at once (raw HID + Steam Input Xbox virtual); you cannot pick the quiet virtual pad ahead of time.
52
+ On Steam Deck you often see two pads at once (raw HID + Steam Input Xbox virtual); you cannot pick the quiet virtual pad ahead of time.
48
53
 
49
54
  So the plugin:
50
55
 
51
56
  1. If there is one pad — use its profile at once.
52
57
  2. If there are several pads — wait for the **first real press** and lock to the `gamepad.index` that sent it (not ghost Steam Input).
53
- 3. Then ignore events from other indexes; mapping only for the locked pad.
58
+ 3. Then ignore button events from other indexes. The locked pad uses its profile. Other pads stay on identity.
59
+
60
+ `controls.gamepad.poll` reads `navigator.getGamepads()` on init and on every animation frame. A pad that was already connected at launch is in that list, so it does not depend on the browser `gamepadconnected` event.
61
+
62
+ Windows Electron disables `Windows.Gaming.Input` so that list comes from XInput. Proton on Steam Deck fills XInput.
63
+
64
+ `controls.gamepad.device` reads the same list on init and on `CONNECT`. One pad sets `CONTROLS.DEVICE_SET` at once (`DEVICES.XBOX` or `DEVICES.PLAYSTATION` by `gamepad.id`). Several pads still wait for the first real press or stick.
54
65
 
55
66
  Profile priority: `steam-deck` → `playstation` → `nintendo` → `firefox` → `standard`.
56
67
 
@@ -62,7 +73,7 @@ Raw button dump for debugging — separate view plugin [gamepad.debug](../views/
62
73
  | `steam-deck` | preferred without standard + Deck/Steam id (`28de` / `valve` / …) or `?steamDeck=1` | raw HID Deck → W3C |
63
74
  | `playstation` | `mapping !== "standard"` and PS id | raw Square-first → W3C |
64
75
  | `nintendo` | Nintendo/Switch id, including with `standard` | A/B and X/Y for Nintendo confirm |
65
- | `firefox` | Firefox UA and no device profile matched | indexes from joypad.js docs |
76
+ | `firefox` | Firefox UA and no device profile matched | Firefox button indexes |
66
77
 
67
78
  Electron with `STEAM_DECK=1` adds `?steamDeck=1`.
68
79
 
@@ -78,9 +89,10 @@ All mappings — object `CUSTOM_BUTTON_MAPPING` in `plugins/controls/gamepad/src
78
89
 
79
90
  | Module | Role |
80
91
  | -------------------------- | --------------------------------------------------------------------------------------------------------------- |
81
- | `controls.gamepad` | `connect` / `disconnect` → sync profile; `GAMEPAD.EMIT` → `CONTROLS.EMIT` with lock `inProcess`. |
82
- | `controls.gamepad.buttons` | `button_press` / `button_release` → `GAMEPAD.EMIT`; lock active pad. |
83
- | `controls.gamepad.device` | `button_press` / `axis_move` → `CONTROLS.DEVICE_SET` (`DEVICES.XBOX` or `DEVICES.PLAYSTATION` by `gamepad.id`). |
92
+ | `controls.gamepad` | `CONNECT` / `DISCONNECT` → sync profile. Proxy `GAMEPAD.EMIT`. |
93
+ | `controls.gamepad.poll` | Poll `navigator.getGamepads()` every frame. Emit button, axis, connect, and disconnect events. |
94
+ | `controls.gamepad.buttons` | `BUTTON_PRESS` / `BUTTON_RELEASE` → `GAMEPAD.EMIT`; lock active pad. |
95
+ | `controls.gamepad.device` | One pad, `CONNECT`, `BUTTON_PRESS`, or `AXIS` → `CONTROLS.DEVICE_SET` (xbox or playstation). Several pads wait. |
84
96
 
85
97
  ## Related plugins
86
98