@vgai/engine 0.5.22 → 0.5.23
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 +6 -3
- package/dist/adapter/adapter-module.d.ts.map +1 -1
- package/dist/adapter/adapter-module.js +2 -4
- package/dist/adapter/adapter-surface.d.ts +1 -1
- package/dist/adapter/adapter-surface.js +1 -1
- package/dist/adapter/authoring.d.ts +19 -21
- package/dist/adapter/authoring.d.ts.map +1 -1
- package/dist/adapter/authoring.js +2 -2
- package/dist/adapter/binding.d.ts +341 -0
- package/dist/adapter/binding.d.ts.map +1 -0
- package/dist/adapter/binding.js +148 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -1
- package/dist/adapter/colyseus-networking-adapter.js +23 -4
- package/dist/adapter/entrypoint-selection-readers.d.ts +24 -0
- package/dist/adapter/entrypoint-selection-readers.d.ts.map +1 -0
- package/dist/adapter/entrypoint-selection-readers.js +63 -0
- package/dist/adapter/entrypoint-selection-source.d.ts.map +1 -1
- package/dist/adapter/entrypoint-selection-source.js +1 -44
- package/dist/adapter/finders/scenes-from-entrypoint-selection.d.ts.map +1 -1
- package/dist/adapter/finders/scenes-from-entrypoint-selection.js +1 -52
- package/dist/adapter/host-context.d.ts +46 -15
- package/dist/adapter/host-context.d.ts.map +1 -1
- package/dist/adapter/host-context.js +2 -9
- package/dist/adapter/index.d.ts +11 -12
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/index.js +9 -10
- package/dist/adapter/ingest/game-contract.d.ts +0 -3
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -1
- package/dist/adapter/ingest/game-contract.js +0 -3
- package/dist/adapter/ingest/scene-capture.d.ts +19 -23
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -1
- package/dist/adapter/ingest/scene-capture.js +143 -17
- package/dist/adapter/ingest/visible-capture-window.d.ts +34 -0
- package/dist/adapter/ingest/visible-capture-window.d.ts.map +1 -1
- package/dist/adapter/native-debug-module.d.ts +31 -5
- package/dist/adapter/native-debug-module.d.ts.map +1 -1
- package/dist/adapter/native-debug-module.js +25 -7
- package/dist/adapter/rapier-physics-adapter.d.ts +31 -1
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -1
- package/dist/adapter/rapier-physics-adapter.js +50 -36
- package/dist/adapter/renderer-config.d.ts +2 -2
- package/dist/adapter/renderer-config.js +2 -2
- package/dist/adapter/root-adapter.d.ts +7 -7
- package/dist/adapter/root-adapter.js +4 -4
- package/dist/adapter/system-adapter.d.ts +45 -7
- package/dist/adapter/system-adapter.d.ts.map +1 -1
- package/dist/adapter/system-seam-contract.d.ts +3 -3
- package/dist/adapter/system-seam-contract.js +3 -3
- package/dist/adapter/system-slot.d.ts +168 -0
- package/dist/adapter/system-slot.d.ts.map +1 -0
- package/dist/adapter/system-slot.js +229 -0
- package/dist/adapter/transform.d.ts +11 -1
- package/dist/adapter/transform.d.ts.map +1 -1
- package/dist/ai/navigation.d.ts +17 -1
- package/dist/ai/navigation.d.ts.map +1 -1
- package/dist/ai/navigation.js +26 -5
- package/dist/animation/anim-graph-types.d.ts +11 -3
- package/dist/animation/anim-graph-types.d.ts.map +1 -1
- package/dist/animation/theatre-clock-binding.d.ts +4 -4
- package/dist/animation/theatre-clock-binding.js +4 -4
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -1
- package/dist/animation/xstate-animation-binding.js +2 -2
- package/dist/animation/xstate-animation-meta.d.ts +13 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -1
- package/dist/animation/xstate-animation-meta.js +14 -0
- package/dist/asset-formats/index.d.ts +4 -7
- package/dist/asset-formats/index.d.ts.map +1 -1
- package/dist/asset-formats/index.js +4 -7
- package/dist/asset-formats/render-env.d.ts +5 -8
- package/dist/asset-formats/render-env.d.ts.map +1 -1
- package/dist/asset-formats/render-env.js +3 -6
- package/dist/asset-parse-error.d.ts +2 -5
- package/dist/asset-parse-error.d.ts.map +1 -1
- package/dist/asset-parse-error.js +2 -5
- package/dist/audio/bus-mixer.d.ts +101 -0
- package/dist/audio/bus-mixer.d.ts.map +1 -0
- package/dist/audio/bus-mixer.js +115 -0
- package/dist/core/frame-pacing.d.ts +1 -1
- package/dist/core/frame-pacing.js +2 -2
- package/dist/core/game-loop.d.ts +1 -3
- package/dist/core/game-loop.d.ts.map +1 -1
- package/dist/core/game-loop.js +1 -3
- package/dist/core/seeded-random.d.ts +1 -1
- package/dist/core/sim-clock.d.ts +5 -6
- package/dist/core/sim-clock.d.ts.map +1 -1
- package/dist/core/sim-clock.js +4 -5
- package/dist/core/types.d.ts +1 -3
- package/dist/core/types.d.ts.map +1 -1
- package/dist/defaults.d.ts +6 -14
- package/dist/defaults.d.ts.map +1 -1
- package/dist/defaults.js +6 -14
- package/dist/dev/register-render-vitals.d.ts +1 -4
- package/dist/dev/register-render-vitals.d.ts.map +1 -1
- package/dist/dev/register-render-vitals.js +1 -4
- package/dist/dev/render-debug-adapter.d.ts +2 -3
- package/dist/dev/render-debug-adapter.d.ts.map +1 -1
- package/dist/dev/render-debug-adapter.js +2 -3
- package/dist/dev/render-vitals.d.ts +3 -3
- package/dist/dev/render-vitals.js +3 -3
- package/dist/dev/webgl-frame-capture.d.ts +1 -1
- package/dist/dev/webgl-frame-capture.js +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/input/host-pointer.d.ts +122 -0
- package/dist/input/host-pointer.d.ts.map +1 -0
- package/dist/input/host-pointer.js +160 -0
- package/dist/input/input-manager.d.ts +18 -5
- package/dist/input/input-manager.d.ts.map +1 -1
- package/dist/input/input-manager.js +33 -13
- package/dist/input/rebind-controller.d.ts.map +1 -1
- package/dist/input/rebind-controller.js +6 -8
- package/dist/input/schema.d.ts.map +1 -1
- package/dist/input/schema.js +56 -28
- package/dist/manifest/filename.d.ts.map +1 -1
- package/dist/manifest/filename.js +8 -12
- package/dist/manifest/load.d.ts +10 -10
- package/dist/manifest/load.d.ts.map +1 -1
- package/dist/manifest/load.js +9 -6
- package/dist/manifest/schema.d.ts +17 -21
- package/dist/manifest/schema.d.ts.map +1 -1
- package/dist/manifest/schema.js +45 -35
- package/dist/physics/collider-dimensions.d.ts +8 -12
- package/dist/physics/collider-dimensions.d.ts.map +1 -1
- package/dist/physics/collider-dimensions.js +8 -12
- package/dist/pixi/scene-capture.d.ts +11 -13
- package/dist/pixi/scene-capture.d.ts.map +1 -1
- package/dist/react/world-state.d.ts +1 -1
- package/dist/react/world-state.d.ts.map +1 -1
- package/dist/render/light-camera-factory.d.ts +5 -7
- package/dist/render/light-camera-factory.d.ts.map +1 -1
- package/dist/render/light-camera-factory.js +8 -11
- package/dist/render/material-factory.js +1 -1
- package/dist/render/render-batch-system.d.ts.map +1 -1
- package/dist/render/render-features.d.ts +17 -6
- package/dist/render/render-features.d.ts.map +1 -1
- package/dist/render/render-features.js +0 -28
- package/dist/runtime/create-runtime.d.ts +34 -25
- package/dist/runtime/create-runtime.d.ts.map +1 -1
- package/dist/runtime/create-runtime.js +218 -93
- package/dist/runtime/debug-registry.d.ts +77 -8
- package/dist/runtime/debug-registry.d.ts.map +1 -1
- package/dist/runtime/debug-registry.js +3 -3
- package/dist/runtime/dev-build.d.ts +2 -2
- package/dist/runtime/dev-build.js +2 -2
- package/dist/runtime/game-input-seams.d.ts +2 -2
- package/dist/runtime/game-input-seams.d.ts.map +1 -1
- package/dist/runtime/game.d.ts +90 -41
- package/dist/runtime/game.d.ts.map +1 -1
- package/dist/runtime/game.js +80 -54
- package/dist/runtime/mount-game.d.ts +0 -16
- package/dist/runtime/mount-game.d.ts.map +1 -1
- package/dist/runtime/mount-game.js +8 -39
- package/dist/runtime/mount-manifest.d.ts +22 -14
- package/dist/runtime/mount-manifest.d.ts.map +1 -1
- package/dist/runtime/mount-manifest.js +18 -18
- package/dist/runtime/playtest.d.ts +22 -0
- package/dist/runtime/playtest.d.ts.map +1 -0
- package/dist/runtime/playtest.js +12 -0
- package/dist/runtime/state-bridge.d.ts +2 -3
- package/dist/runtime/state-bridge.d.ts.map +1 -1
- package/dist/runtime/state-bridge.js +1 -0
- package/dist/setup/setup-audio.d.ts +12 -0
- package/dist/setup/setup-audio.d.ts.map +1 -1
- package/dist/setup/setup-audio.js +9 -10
- package/dist/setup/setup-renderer.d.ts +2 -25
- package/dist/setup/setup-renderer.d.ts.map +1 -1
- package/dist/setup/setup-renderer.js +2 -31
- package/dist/world3d-react/r3f-root-factory.d.ts +7 -7
- package/dist/world3d-react/r3f-root-factory.js +7 -7
- package/dist/world3d-react/rapier-physics-bridge.d.ts +9 -8
- package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -1
- package/dist/world3d-react/rapier-physics-bridge.js +100 -48
- package/package.json +1 -1
- package/schemas/engine-capabilities.json +16 -14
- package/schemas/vgai-project.schema.json +35 -26
- package/src/adapter/adapter-module.ts +2 -4
- package/src/adapter/adapter-surface.ts +1 -1
- package/src/adapter/authoring.ts +19 -21
- package/src/adapter/binding.ts +468 -0
- package/src/adapter/colyseus-networking-adapter.ts +20 -5
- package/src/adapter/entrypoint-selection-readers.ts +66 -0
- package/src/adapter/entrypoint-selection-source.ts +1 -40
- package/src/adapter/finders/scenes-from-entrypoint-selection.ts +1 -48
- package/src/adapter/host-context.ts +45 -15
- package/src/adapter/index.ts +23 -11
- package/src/adapter/ingest/game-contract.ts +0 -3
- package/src/adapter/ingest/scene-capture.ts +190 -39
- package/src/adapter/ingest/visible-capture-window.ts +35 -0
- package/src/adapter/native-debug-module.ts +43 -7
- package/src/adapter/rapier-physics-adapter.ts +76 -20
- package/src/adapter/renderer-config.ts +2 -2
- package/src/adapter/root-adapter.ts +7 -7
- package/src/adapter/system-adapter.ts +43 -8
- package/src/adapter/system-seam-contract.ts +3 -3
- package/src/adapter/system-slot.ts +291 -0
- package/src/adapter/transform.ts +18 -1
- package/src/ai/navigation.ts +30 -3
- package/src/animation/anim-graph-types.ts +11 -3
- package/src/animation/theatre-clock-binding.ts +4 -4
- package/src/animation/xstate-animation-binding.ts +2 -2
- package/src/animation/xstate-animation-meta.ts +16 -0
- package/src/asset-formats/index.ts +4 -7
- package/src/asset-formats/render-env.ts +3 -6
- package/src/asset-parse-error.ts +2 -5
- package/src/audio/bus-mixer.ts +161 -0
- package/src/core/frame-pacing.ts +2 -2
- package/src/core/game-loop.ts +1 -3
- package/src/core/seeded-random.ts +1 -1
- package/src/core/sim-clock.ts +5 -6
- package/src/core/types.ts +1 -3
- package/src/defaults.ts +6 -14
- package/src/dev/register-render-vitals.ts +1 -4
- package/src/dev/render-debug-adapter.ts +2 -3
- package/src/dev/render-vitals.ts +3 -3
- package/src/dev/webgl-frame-capture.ts +1 -1
- package/src/index.ts +2 -5
- package/src/input/host-pointer.ts +230 -0
- package/src/input/input-manager.ts +34 -13
- package/src/input/input-types.ts +1 -1
- package/src/input/rebind-controller.ts +6 -8
- package/src/input/schema.ts +216 -188
- package/src/manifest/filename.ts +8 -12
- package/src/manifest/load.ts +17 -13
- package/src/manifest/schema.ts +55 -47
- package/src/physics/collider-dimensions.ts +8 -12
- package/src/pixi/scene-capture.ts +12 -15
- package/src/react/world-state.tsx +1 -1
- package/src/render/light-camera-factory.ts +8 -11
- package/src/render/material-factory.ts +1 -1
- package/src/render/render-batch-system.ts +14 -6
- package/src/render/render-features.ts +17 -35
- package/src/runtime/create-runtime.ts +270 -108
- package/src/runtime/debug-registry.ts +84 -8
- package/src/runtime/dev-build.ts +2 -2
- package/src/runtime/game-input-seams.ts +2 -2
- package/src/runtime/game.ts +168 -80
- package/src/runtime/mount-game.ts +8 -56
- package/src/runtime/mount-manifest.ts +43 -34
- package/src/runtime/playtest.ts +22 -0
- package/src/runtime/state-bridge.ts +3 -3
- package/src/setup/setup-audio.ts +21 -11
- package/src/setup/setup-renderer.ts +2 -61
- package/src/world3d-react/r3f-root-factory.tsx +7 -7
- package/src/world3d-react/rapier-physics-bridge.tsx +107 -50
- package/dist/adapter/setup-three-root-adapter.d.ts +0 -86
- package/dist/adapter/setup-three-root-adapter.d.ts.map +0 -1
- package/dist/adapter/setup-three-root-adapter.js +0 -908
- package/dist/animation/clip-map.d.ts +0 -12
- package/dist/animation/clip-map.d.ts.map +0 -1
- package/dist/animation/clip-map.js +0 -31
- package/dist/asset-registry.d.ts +0 -38
- package/dist/asset-registry.d.ts.map +0 -1
- package/dist/asset-registry.js +0 -66
- package/dist/canvas-react/engine-bridge.d.ts +0 -45
- package/dist/canvas-react/engine-bridge.d.ts.map +0 -1
- package/dist/canvas-react/engine-bridge.js +0 -45
- package/dist/canvas-react/pixi-react-adapter.d.ts +0 -77
- package/dist/canvas-react/pixi-react-adapter.d.ts.map +0 -1
- package/dist/canvas-react/pixi-react-adapter.js +0 -294
- package/dist/canvas-react/world-context.d.ts +0 -98
- package/dist/canvas-react/world-context.d.ts.map +0 -1
- package/dist/canvas-react/world-context.js +0 -173
- package/dist/dev/debug-draw.d.ts +0 -24
- package/dist/dev/debug-draw.d.ts.map +0 -1
- package/dist/dev/debug-draw.js +0 -73
- package/dist/render/auto-batcher.d.ts +0 -34
- package/dist/render/auto-batcher.d.ts.map +0 -1
- package/dist/render/auto-batcher.js +0 -140
- package/dist/render/lod.d.ts +0 -13
- package/dist/render/lod.d.ts.map +0 -1
- package/dist/render/lod.js +0 -16
- package/dist/runtime/types.d.ts +0 -303
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -1
- package/dist/world3d-react/engine-bridge.d.ts +0 -47
- package/dist/world3d-react/engine-bridge.d.ts.map +0 -1
- package/dist/world3d-react/engine-bridge.js +0 -73
- package/dist/world3d-react/r3f-adapter.d.ts +0 -58
- package/dist/world3d-react/r3f-adapter.d.ts.map +0 -1
- package/dist/world3d-react/r3f-adapter.js +0 -634
- package/dist/world3d-react/world-context.d.ts +0 -182
- package/dist/world3d-react/world-context.d.ts.map +0 -1
- package/dist/world3d-react/world-context.js +0 -235
- package/src/adapter/setup-three-root-adapter.ts +0 -1032
- package/src/animation/clip-map.ts +0 -34
- package/src/asset-registry.ts +0 -89
- package/src/dev/debug-draw.ts +0 -80
- package/src/render/auto-batcher.ts +0 -168
- package/src/render/lod.ts +0 -17
- package/src/runtime/types.ts +0 -328
package/dist/index.d.ts
CHANGED
|
@@ -10,25 +10,22 @@
|
|
|
10
10
|
* remain the primary way to reach engine internals — reach for a subpath
|
|
11
11
|
* first. This barrel exists only so the package's bare-name entry point is
|
|
12
12
|
* HONEST (resolves to something real and useful) instead of dangling; it
|
|
13
|
-
* covers just the handful of symbols a
|
|
14
|
-
*
|
|
13
|
+
* covers just the handful of symbols a consumer needs to mount a game
|
|
14
|
+
* from its manifest, plus the manifest file
|
|
15
15
|
* entry points. Keep it small when extending it — prefer a new subpath
|
|
16
16
|
* export over growing this file into a firehose.
|
|
17
17
|
*
|
|
18
18
|
* Groups (import order below is alphabetical-by-specifier, per the repo's
|
|
19
19
|
* biome `organizeImports` rule, not by group — see this list instead):
|
|
20
|
-
* - game setup contract: `GameContext`/`GameCleanup`/`GameSetupFn`, `fromSetup`
|
|
21
20
|
* - surface vocabulary: `AdapterSurface`
|
|
22
21
|
* - manifest-driven mount: `mountManifestRoots` + its option/result types
|
|
23
22
|
* - game manifest (vgai.project.json) entry point: `loadGameManifest`
|
|
24
23
|
*/
|
|
25
24
|
export type { AdapterSurface } from './adapter/adapter-surface';
|
|
26
|
-
export { fromSetup } from './adapter/setup-three-root-adapter';
|
|
27
25
|
export { AssetParseError } from './asset-parse-error';
|
|
28
26
|
export type { AdapterRoot, GameManifest, ResolvedAdapter, ResolvedAdapterRoot, ResolvedGameManifest, RootAdapter, } from './manifest';
|
|
29
27
|
export { DEFAULT_SERVER_MODULE, loadGameManifest } from './manifest';
|
|
30
28
|
export type { GameSession } from './runtime/create-runtime';
|
|
31
29
|
export type { MountEntry, MountedManifestSession, MountManifestOptions, } from './runtime/mount-manifest';
|
|
32
30
|
export { mountManifestRoots } from './runtime/mount-manifest';
|
|
33
|
-
export type { GameCleanup, GameContext, GameSetupFn } from './runtime/types';
|
|
34
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EACV,WAAW,EACX,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,YAAY,EACV,UAAU,EACV,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,19 +10,17 @@
|
|
|
10
10
|
* remain the primary way to reach engine internals — reach for a subpath
|
|
11
11
|
* first. This barrel exists only so the package's bare-name entry point is
|
|
12
12
|
* HONEST (resolves to something real and useful) instead of dangling; it
|
|
13
|
-
* covers just the handful of symbols a
|
|
14
|
-
*
|
|
13
|
+
* covers just the handful of symbols a consumer needs to mount a game
|
|
14
|
+
* from its manifest, plus the manifest file
|
|
15
15
|
* entry points. Keep it small when extending it — prefer a new subpath
|
|
16
16
|
* export over growing this file into a firehose.
|
|
17
17
|
*
|
|
18
18
|
* Groups (import order below is alphabetical-by-specifier, per the repo's
|
|
19
19
|
* biome `organizeImports` rule, not by group — see this list instead):
|
|
20
|
-
* - game setup contract: `GameContext`/`GameCleanup`/`GameSetupFn`, `fromSetup`
|
|
21
20
|
* - surface vocabulary: `AdapterSurface`
|
|
22
21
|
* - manifest-driven mount: `mountManifestRoots` + its option/result types
|
|
23
22
|
* - game manifest (vgai.project.json) entry point: `loadGameManifest`
|
|
24
23
|
*/
|
|
25
|
-
export { fromSetup } from './adapter/setup-three-root-adapter';
|
|
26
24
|
export { AssetParseError } from './asset-parse-error';
|
|
27
25
|
export { DEFAULT_SERVER_MODULE, loadGameManifest } from './manifest';
|
|
28
26
|
export { mountManifestRoots } from './runtime/mount-manifest';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host POINTER stream, in the game's own coordinate space — the DOM edge
|
|
3
|
+
* `InputManager`'s touch backends (`setTouchButton` / `setTouchStick`) and any
|
|
4
|
+
* pointer-position read need, and which the manager itself deliberately does
|
|
5
|
+
* not own.
|
|
6
|
+
*
|
|
7
|
+
* `InputManager` listens on `window` for keyboard, mouse and focus, in CLIENT
|
|
8
|
+
* pixels, because an action map is surface-agnostic. A pointer is not: a tap is
|
|
9
|
+
* only meaningful relative to the surface it landed on, and a game's own
|
|
10
|
+
* coordinate space is usually NOT that surface's CSS pixels — a fixed design
|
|
11
|
+
* resolution presented by uniformly scaling and letterboxing is the common
|
|
12
|
+
* case, and a hit-test against a UI rect authored in design pixels has to
|
|
13
|
+
* happen in one space with the pointer. That mapping needs a surface and a
|
|
14
|
+
* design size the manager has no way to know, so it lives here, beside it.
|
|
15
|
+
*
|
|
16
|
+
* What this owns, and nothing more:
|
|
17
|
+
*
|
|
18
|
+
* - **Position** — the last pointer position over the surface, mapped into the
|
|
19
|
+
* design space. `setPosition` is the headless door (a harness or a game
|
|
20
|
+
* command driving the game with no DOM), the same shape as
|
|
21
|
+
* `InputManager.addMouseDelta`: inject through the accumulator the reader
|
|
22
|
+
* already reads, never a synthetic `pointermove`.
|
|
23
|
+
* - **Touches** — a per-frame queue of {@link HostPointerTouch} records with
|
|
24
|
+
* DENSE finger indices, drained by the game's own frame. `pointerId` is the
|
|
25
|
+
* browser's opaque, monotonically growing handle; a touch API that reports
|
|
26
|
+
* "finger 0 and finger 1" wants the lowest free slot, reused the moment a
|
|
27
|
+
* finger lifts, which is what {@link HostPointerTouch.index} is.
|
|
28
|
+
* - **Cursor** — the CSS cursor applied to the surface, because the surface is
|
|
29
|
+
* resolved here and nowhere else.
|
|
30
|
+
*
|
|
31
|
+
* **Gating.** Every listener returns early unless
|
|
32
|
+
* `InputManager.isInputActive()` — the SAME predicate the manager's own
|
|
33
|
+
* `keydown`/`mousemove` listeners pass, so play-mode isolation and window
|
|
34
|
+
* blur suppress pointer position and touches exactly as they suppress a key.
|
|
35
|
+
* The predicate is read from the manager rather than recomposed here
|
|
36
|
+
* (`isEnabled() && isFocused()` written out a second time is how a looser gate
|
|
37
|
+
* drifts in: a blurred or typing tab kept updating a pointer position under
|
|
38
|
+
* exactly that duplication). Text-entry focus is deliberately NOT part of it,
|
|
39
|
+
* matching `onMouseMove` rather than `onKeyDown` — moving a finger is not
|
|
40
|
+
* typing.
|
|
41
|
+
*
|
|
42
|
+
* **Ownership.** Owns its four pointer listeners on the resolved owner, the
|
|
43
|
+
* touch queue and the finger-index table. Shares the `InputManager`, which is
|
|
44
|
+
* the game's and is never mutated here — this reports; what a control DOES
|
|
45
|
+
* with a finger (which rect owns it, whether that becomes a `setTouchButton`)
|
|
46
|
+
* belongs to the UI that draws the control. Teardown is {@link
|
|
47
|
+
* HostPointer.dispose}, and only that: `InputManager.dispose` does not reach
|
|
48
|
+
* these listeners.
|
|
49
|
+
*
|
|
50
|
+
* Headless (no `window`): construction succeeds and binds nothing. Position is
|
|
51
|
+
* whatever {@link HostPointer.setPosition} last wrote, and the touch queue
|
|
52
|
+
* stays empty.
|
|
53
|
+
*/
|
|
54
|
+
import type { InputManager } from './input-manager';
|
|
55
|
+
import type { Vector2 } from './input-types';
|
|
56
|
+
/** One finger edge the host pointer stream produced. */
|
|
57
|
+
export interface HostPointerTouch {
|
|
58
|
+
/**
|
|
59
|
+
* `'start'` when the finger went down on the surface, `'move'` while it
|
|
60
|
+
* drags, `'end'` when it lifted or the browser cancelled it. A cancel is an
|
|
61
|
+
* end: the finger is gone either way, and a control that treats them
|
|
62
|
+
* differently is holding a button nothing will ever release.
|
|
63
|
+
*/
|
|
64
|
+
readonly phase: 'start' | 'move' | 'end';
|
|
65
|
+
/**
|
|
66
|
+
* DENSE finger index — the lowest slot free when this finger went down, and
|
|
67
|
+
* free again the moment it lifts. NOT the browser's `pointerId`, which never
|
|
68
|
+
* reuses a value and is therefore useless as "which finger is this".
|
|
69
|
+
*/
|
|
70
|
+
readonly index: number;
|
|
71
|
+
/** Position in the design space (see {@link HostPointerOptions.designSize}). */
|
|
72
|
+
readonly position: Vector2;
|
|
73
|
+
}
|
|
74
|
+
/** What {@link createHostPointer} needs. */
|
|
75
|
+
export interface HostPointerOptions {
|
|
76
|
+
/** The game's own manager — read for its gate, never written. */
|
|
77
|
+
readonly input: InputManager;
|
|
78
|
+
/**
|
|
79
|
+
* The render surface pointer positions are relative to.
|
|
80
|
+
*
|
|
81
|
+
* A GETTER rather than an element because a renderer usually mints its
|
|
82
|
+
* canvas after the game's services exist. Absent (or returning `null`) falls
|
|
83
|
+
* back to the event's own target element, and listening falls back to
|
|
84
|
+
* `window` — which is what makes a finger that starts on the canvas and
|
|
85
|
+
* drags over a DOM overlay keep reporting.
|
|
86
|
+
*/
|
|
87
|
+
readonly surface?: (() => HTMLElement | null) | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The game's own logical resolution, if it has one. Surface CSS pixels are
|
|
90
|
+
* mapped into it, so a pointer and a UI rect authored at this size share one
|
|
91
|
+
* space regardless of how the host scaled and letterboxed the surface.
|
|
92
|
+
*
|
|
93
|
+
* Absent: positions are reported in the surface's own CSS pixels, and the
|
|
94
|
+
* position before any event is `{x: 0, y: 0}`. Present: the position before
|
|
95
|
+
* any event is the CENTRE of the design space — a pointer that has never
|
|
96
|
+
* moved is better described as the middle of the view than as a corner it
|
|
97
|
+
* was never at.
|
|
98
|
+
*/
|
|
99
|
+
readonly designSize?: Vector2 | undefined;
|
|
100
|
+
}
|
|
101
|
+
/** The host pointer stream bound to one surface. One per mounted game. */
|
|
102
|
+
export interface HostPointer {
|
|
103
|
+
/** The last pointer position, in the design space. */
|
|
104
|
+
getPosition(): Vector2;
|
|
105
|
+
/** Headless / harness door onto {@link getPosition}'s value. */
|
|
106
|
+
setPosition(position: Vector2): void;
|
|
107
|
+
/**
|
|
108
|
+
* Drain the touch records queued since the last call. Returns them in
|
|
109
|
+
* arrival order and empties the queue, so a frame that drains sees each
|
|
110
|
+
* finger edge exactly once.
|
|
111
|
+
*/
|
|
112
|
+
takeTouches(): readonly HostPointerTouch[];
|
|
113
|
+
/**
|
|
114
|
+
* Set the CSS `cursor` applied to the surface. Applied on the next pointer
|
|
115
|
+
* move over it, which is also when the surface is known.
|
|
116
|
+
*/
|
|
117
|
+
setCursor(cursor: string): void;
|
|
118
|
+
/** Remove the listeners this owns. */
|
|
119
|
+
dispose(): void;
|
|
120
|
+
}
|
|
121
|
+
export declare function createHostPointer(options: HostPointerOptions): HostPointer;
|
|
122
|
+
//# sourceMappingURL=host-pointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-pointer.d.ts","sourceRoot":"","sources":["../../src/input/host-pointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAU7C,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,4CAA4C;AAC5C,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1D;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC3C;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,WAAW,IAAI,OAAO,CAAC;IACvB,gEAAgE;IAChE,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,WAAW,IAAI,SAAS,gBAAgB,EAAE,CAAC;IAC3C;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,sCAAsC;IACtC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAgG1E"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host POINTER stream, in the game's own coordinate space — the DOM edge
|
|
3
|
+
* `InputManager`'s touch backends (`setTouchButton` / `setTouchStick`) and any
|
|
4
|
+
* pointer-position read need, and which the manager itself deliberately does
|
|
5
|
+
* not own.
|
|
6
|
+
*
|
|
7
|
+
* `InputManager` listens on `window` for keyboard, mouse and focus, in CLIENT
|
|
8
|
+
* pixels, because an action map is surface-agnostic. A pointer is not: a tap is
|
|
9
|
+
* only meaningful relative to the surface it landed on, and a game's own
|
|
10
|
+
* coordinate space is usually NOT that surface's CSS pixels — a fixed design
|
|
11
|
+
* resolution presented by uniformly scaling and letterboxing is the common
|
|
12
|
+
* case, and a hit-test against a UI rect authored in design pixels has to
|
|
13
|
+
* happen in one space with the pointer. That mapping needs a surface and a
|
|
14
|
+
* design size the manager has no way to know, so it lives here, beside it.
|
|
15
|
+
*
|
|
16
|
+
* What this owns, and nothing more:
|
|
17
|
+
*
|
|
18
|
+
* - **Position** — the last pointer position over the surface, mapped into the
|
|
19
|
+
* design space. `setPosition` is the headless door (a harness or a game
|
|
20
|
+
* command driving the game with no DOM), the same shape as
|
|
21
|
+
* `InputManager.addMouseDelta`: inject through the accumulator the reader
|
|
22
|
+
* already reads, never a synthetic `pointermove`.
|
|
23
|
+
* - **Touches** — a per-frame queue of {@link HostPointerTouch} records with
|
|
24
|
+
* DENSE finger indices, drained by the game's own frame. `pointerId` is the
|
|
25
|
+
* browser's opaque, monotonically growing handle; a touch API that reports
|
|
26
|
+
* "finger 0 and finger 1" wants the lowest free slot, reused the moment a
|
|
27
|
+
* finger lifts, which is what {@link HostPointerTouch.index} is.
|
|
28
|
+
* - **Cursor** — the CSS cursor applied to the surface, because the surface is
|
|
29
|
+
* resolved here and nowhere else.
|
|
30
|
+
*
|
|
31
|
+
* **Gating.** Every listener returns early unless
|
|
32
|
+
* `InputManager.isInputActive()` — the SAME predicate the manager's own
|
|
33
|
+
* `keydown`/`mousemove` listeners pass, so play-mode isolation and window
|
|
34
|
+
* blur suppress pointer position and touches exactly as they suppress a key.
|
|
35
|
+
* The predicate is read from the manager rather than recomposed here
|
|
36
|
+
* (`isEnabled() && isFocused()` written out a second time is how a looser gate
|
|
37
|
+
* drifts in: a blurred or typing tab kept updating a pointer position under
|
|
38
|
+
* exactly that duplication). Text-entry focus is deliberately NOT part of it,
|
|
39
|
+
* matching `onMouseMove` rather than `onKeyDown` — moving a finger is not
|
|
40
|
+
* typing.
|
|
41
|
+
*
|
|
42
|
+
* **Ownership.** Owns its four pointer listeners on the resolved owner, the
|
|
43
|
+
* touch queue and the finger-index table. Shares the `InputManager`, which is
|
|
44
|
+
* the game's and is never mutated here — this reports; what a control DOES
|
|
45
|
+
* with a finger (which rect owns it, whether that becomes a `setTouchButton`)
|
|
46
|
+
* belongs to the UI that draws the control. Teardown is {@link
|
|
47
|
+
* HostPointer.dispose}, and only that: `InputManager.dispose` does not reach
|
|
48
|
+
* these listeners.
|
|
49
|
+
*
|
|
50
|
+
* Headless (no `window`): construction succeeds and binds nothing. Position is
|
|
51
|
+
* whatever {@link HostPointer.setPosition} last wrote, and the touch queue
|
|
52
|
+
* stays empty.
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* Cap on the undrained touch queue. A game that drains every frame cannot
|
|
56
|
+
* reach it — this is the bound for one that never drains at all (a project
|
|
57
|
+
* that reads no touches, on a device that has them), so the queue is a RING:
|
|
58
|
+
* the newest records win and the oldest are dropped.
|
|
59
|
+
*/
|
|
60
|
+
const TOUCH_QUEUE_MAX = 256;
|
|
61
|
+
export function createHostPointer(options) {
|
|
62
|
+
const { input, surface: surfaceOf, designSize } = options;
|
|
63
|
+
let position = designSize
|
|
64
|
+
? { x: designSize.x / 2, y: designSize.y / 2 }
|
|
65
|
+
: { x: 0, y: 0 };
|
|
66
|
+
let cursor = 'default';
|
|
67
|
+
const touches = [];
|
|
68
|
+
/** Browser `pointerId` -> dense finger index, for fingers currently down. */
|
|
69
|
+
const fingerOfPointer = new Map();
|
|
70
|
+
const freeFinger = () => {
|
|
71
|
+
const taken = new Set(fingerOfPointer.values());
|
|
72
|
+
let index = 0;
|
|
73
|
+
while (taken.has(index))
|
|
74
|
+
index += 1;
|
|
75
|
+
return index;
|
|
76
|
+
};
|
|
77
|
+
const queue = (touch) => {
|
|
78
|
+
touches.push(touch);
|
|
79
|
+
if (touches.length > TOUCH_QUEUE_MAX)
|
|
80
|
+
touches.shift();
|
|
81
|
+
};
|
|
82
|
+
const queueTouch = (event, point) => {
|
|
83
|
+
if (event.type === 'pointerdown') {
|
|
84
|
+
const index = freeFinger();
|
|
85
|
+
fingerOfPointer.set(event.pointerId, index);
|
|
86
|
+
queue({ phase: 'start', index, position: point });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// A move or a release from a pointer that never went down on this surface
|
|
90
|
+
// is not one of our fingers.
|
|
91
|
+
const index = fingerOfPointer.get(event.pointerId);
|
|
92
|
+
if (index === undefined)
|
|
93
|
+
return;
|
|
94
|
+
if (event.type === 'pointerup' || event.type === 'pointercancel') {
|
|
95
|
+
fingerOfPointer.delete(event.pointerId);
|
|
96
|
+
queue({ phase: 'end', index, position: point });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
queue({ phase: 'move', index, position: point });
|
|
100
|
+
};
|
|
101
|
+
/** A client-space event as a point in the design space, via the surface rect
|
|
102
|
+
* the host actually presented it at. */
|
|
103
|
+
const toDesignSpace = (event, rect) => {
|
|
104
|
+
const x = event.clientX - rect.left;
|
|
105
|
+
const y = event.clientY - rect.top;
|
|
106
|
+
if (!designSize)
|
|
107
|
+
return { x, y };
|
|
108
|
+
return { x: (x * designSize.x) / rect.width, y: (y * designSize.y) / rect.height };
|
|
109
|
+
};
|
|
110
|
+
const onPointer = (event) => {
|
|
111
|
+
// The manager's own gate, read from the manager. See this module's header
|
|
112
|
+
// for why it is not recomposed here.
|
|
113
|
+
if (!input.isInputActive())
|
|
114
|
+
return;
|
|
115
|
+
const surface = surfaceOf?.() ?? (event.target instanceof HTMLElement ? event.target : null);
|
|
116
|
+
if (surface === null)
|
|
117
|
+
return;
|
|
118
|
+
const rect = surface.getBoundingClientRect();
|
|
119
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
120
|
+
return;
|
|
121
|
+
const point = toDesignSpace(event, rect);
|
|
122
|
+
if (event.type === 'pointermove') {
|
|
123
|
+
// Every pointer type moves the position — a stylus and a dragging finger
|
|
124
|
+
// are as much "where the pointer is" as a mouse. Only the TOUCH queue is
|
|
125
|
+
// touch-only.
|
|
126
|
+
position = point;
|
|
127
|
+
surface.style.cursor = cursor;
|
|
128
|
+
}
|
|
129
|
+
// A mouse or a pen is not a finger. A control that answered them here would
|
|
130
|
+
// steal the clicks of a player who cannot see it.
|
|
131
|
+
if (event.pointerType === 'touch')
|
|
132
|
+
queueTouch(event, point);
|
|
133
|
+
};
|
|
134
|
+
const KINDS = ['pointerdown', 'pointermove', 'pointerup', 'pointercancel'];
|
|
135
|
+
const owner = typeof window === 'undefined' ? null : (surfaceOf?.() ?? window);
|
|
136
|
+
if (owner !== null) {
|
|
137
|
+
for (const kind of KINDS)
|
|
138
|
+
owner.addEventListener(kind, onPointer);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
getPosition() {
|
|
142
|
+
return position;
|
|
143
|
+
},
|
|
144
|
+
setPosition(next) {
|
|
145
|
+
position = { x: next.x, y: next.y };
|
|
146
|
+
},
|
|
147
|
+
takeTouches() {
|
|
148
|
+
return touches.splice(0, touches.length);
|
|
149
|
+
},
|
|
150
|
+
setCursor(next) {
|
|
151
|
+
cursor = next;
|
|
152
|
+
},
|
|
153
|
+
dispose() {
|
|
154
|
+
if (owner === null)
|
|
155
|
+
return;
|
|
156
|
+
for (const kind of KINDS)
|
|
157
|
+
owner.removeEventListener(kind, onPointer);
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
@@ -116,7 +116,7 @@ export declare class InputManager {
|
|
|
116
116
|
* action}`) emitted whenever a scheduled entry is discarded because its
|
|
117
117
|
* target tick's input phase never ran. Wired by whoever constructs this
|
|
118
118
|
* `InputManager` with access to a `DebugRegistry`
|
|
119
|
-
* (`
|
|
119
|
+
* (`world3d-react/r3f-root-factory.tsx`, the same seed spot as
|
|
120
120
|
* `setVirtualInputTarget`/`setInputActionsSource`) — `null` (the
|
|
121
121
|
* default) for a bare/headless `InputManager`, in which case a drop
|
|
122
122
|
* stays silent (matching pre-D15/T-D15.5 behavior). */
|
|
@@ -269,14 +269,14 @@ export declare class InputManager {
|
|
|
269
269
|
* already read as inert/zeroed by every getter, matching pre-F1 behavior
|
|
270
270
|
* for a typo'd action name. */
|
|
271
271
|
private assertValueType;
|
|
272
|
-
/** The names of all registered actions (
|
|
273
|
-
*
|
|
272
|
+
/** The names of all registered actions (the `game.input.actions` debug seam
|
|
273
|
+
* enumerates these — `runtime/game-input-seams.ts`). */
|
|
274
274
|
actionNames(): string[];
|
|
275
275
|
/**
|
|
276
276
|
* Poll gamepads and virtual look stick (call at start of frame).
|
|
277
277
|
*
|
|
278
278
|
* `tick` (D15/T-D15.3/.5) — the GAME tick this call services. Pass the
|
|
279
|
-
* live, shared `Game` tick counter here (`
|
|
279
|
+
* live, shared `Game` tick counter here (`world3d-react/r3f-root-factory.tsx` does,
|
|
280
280
|
* via `DebugRegistry.getGameTick()`) so `scheduleActionAtTick`'s numbering
|
|
281
281
|
* never drifts from the actual game tick — the bug an earlier revision of
|
|
282
282
|
* this feature had: an InputManager-LOCAL counter, incremented once per
|
|
@@ -492,6 +492,19 @@ export declare class InputManager {
|
|
|
492
492
|
* constructor). Distinct from {@link isEnabled}, which is the editor's
|
|
493
493
|
* explicit play-mode gate. */
|
|
494
494
|
isFocused(): boolean;
|
|
495
|
+
/**
|
|
496
|
+
* The gate every REAL-DEVICE listener here passes: {@link isEnabled} AND
|
|
497
|
+
* {@link isFocused}. Public because the DOM edge this class deliberately
|
|
498
|
+
* does not own — `host-pointer.ts`, the pointer stream behind the touch
|
|
499
|
+
* backends — must pass the SAME gate, and a caller writing
|
|
500
|
+
* `isEnabled() && isFocused()` out for itself is how a looser one drifts in
|
|
501
|
+
* (a pointer adapter that checked only `isEnabled` kept updating position
|
|
502
|
+
* for a blurred tab). Read it; do not recompose it.
|
|
503
|
+
*
|
|
504
|
+
* Machine input (`setVirtualAction` and the tick-scheduled actuations) is
|
|
505
|
+
* deliberately NOT this gate — see `machineInputActive`.
|
|
506
|
+
*/
|
|
507
|
+
isInputActive(): boolean;
|
|
495
508
|
/** Whether the pointer is currently locked to {@link requestPointerLock}'s
|
|
496
509
|
* element (F2, spec §12 "pointer lock") — tracked via the real
|
|
497
510
|
* `pointerlockchange` event. */
|
|
@@ -807,7 +820,7 @@ export declare class InputManager {
|
|
|
807
820
|
* `'input.schedule.dropped'` (`{tick, action}`) whenever it discards a
|
|
808
821
|
* scheduled entry for a tick whose input phase never ran. Called once by
|
|
809
822
|
* whoever constructs this `InputManager` with a `DebugRegistry` behind it
|
|
810
|
-
* (`
|
|
823
|
+
* (`world3d-react/r3f-root-factory.tsx`), the same seed spot as
|
|
811
824
|
* `setVirtualInputTarget`/`setInputActionsSource` — never called directly
|
|
812
825
|
* by gameplay code. */
|
|
813
826
|
setDebugEmit(fn: ((event: string, detail?: unknown) => void) | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-manager.d.ts","sourceRoot":"","sources":["../../src/input/input-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,OAAO,EACR,MAAM,eAAe,CAAC;AA4BvB;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAG,wBAAwB,CAAU;IAClD,QAAQ,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;gBAE5B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE;CAQjE;AAED;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAG,qBAAqB,CAAU;IAC/C,QAAQ,CAAC,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;gBAE3B,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;CAQ9C;
|
|
1
|
+
{"version":3,"file":"input-manager.d.ts","sourceRoot":"","sources":["../../src/input/input-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,e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B,IAAI,IAAI;IAI1B,6DAA6D;IAC7D,gBAAgB,IAAI,OAAO;IAI3B;;;mBAGe;IACf,aAAa,IAAI;QACf,OAAO,EAAE,CAAC,CAAC;QACX,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG;gBAAE,CAAC,EAAE,MAAM,CAAC;gBAAC,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,EAAE,CAAC;KACjG;IAID,uDAAuD;IACvD,kBAAkB,CAAC,OAAO,EAAE,WAAW;IAWvC;;;;;;;;;;;OAWG;IACH,eAAe;IAYf,+BAA+B;IAC/B,OAAO;CAoBR"}
|
|
@@ -152,10 +152,16 @@ const INPUT_TRACE_CAP = 2000;
|
|
|
152
152
|
* controls. `setTouchButton(sourceId, pressed)` feeds a digital action
|
|
153
153
|
* (edge-tracked like `mouse_button`); `setTouchStick(sourceId, value)`
|
|
154
154
|
* feeds a vector2 action (deadzone-rescaled like a gamepad stick). These
|
|
155
|
-
* are the injectable entry points
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
155
|
+
* are the injectable entry points an on-screen touch UI calls, and they
|
|
156
|
+
* are the UPPER half of the touch story. The LOWER half — the DOM
|
|
157
|
+
* pointer stream itself, as dense finger indices mapped into the game's
|
|
158
|
+
* own design space and gated on `isInputActive()` — is
|
|
159
|
+
* `input/host-pointer.ts` (`createHostPointer`), beside this file; a
|
|
160
|
+
* control drains its `takeTouches()` and calls the setters above.
|
|
161
|
+
* What is deliberately still NOT here is the control layer in between:
|
|
162
|
+
* which rect owns which finger, and how a knob's offset becomes a stick
|
|
163
|
+
* vector, is the shape of the UI drawing the control, so it belongs to
|
|
164
|
+
* that UI and there is no first-party one to generalize from yet.
|
|
159
165
|
* - Focus gating — `blur`/`focus` on `window` (guarded, real DOM only) now
|
|
160
166
|
* drop input the same way `setEnabled(false)` does (flushing held
|
|
161
167
|
* key/mouse/touch-button state) without touching the `enabled` flag the
|
|
@@ -392,7 +398,7 @@ export class InputManager {
|
|
|
392
398
|
// caller never tells `poll()` which tick it's servicing (every existing
|
|
393
399
|
// bare/headless caller — tests, a mount with no `Game` shell behind it —
|
|
394
400
|
// keeps this exact pre-existing behavior, zero regression). The REAL
|
|
395
|
-
// per-world wiring (`
|
|
401
|
+
// per-world wiring (`world3d-react/r3f-root-factory.tsx`) instead passes the
|
|
396
402
|
// shared `Game`-level tick counter into every `poll(tick)` call — this is
|
|
397
403
|
// deliberate: an InputManager-local counter drifts from the actual game
|
|
398
404
|
// tick for a paused/frozen world (its `poll()` isn't called every game
|
|
@@ -422,7 +428,7 @@ export class InputManager {
|
|
|
422
428
|
* action}`) emitted whenever a scheduled entry is discarded because its
|
|
423
429
|
* target tick's input phase never ran. Wired by whoever constructs this
|
|
424
430
|
* `InputManager` with access to a `DebugRegistry`
|
|
425
|
-
* (`
|
|
431
|
+
* (`world3d-react/r3f-root-factory.tsx`, the same seed spot as
|
|
426
432
|
* `setVirtualInputTarget`/`setInputActionsSource`) — `null` (the
|
|
427
433
|
* default) for a bare/headless `InputManager`, in which case a drop
|
|
428
434
|
* stays silent (matching pre-D15/T-D15.5 behavior). */
|
|
@@ -731,8 +737,8 @@ export class InputManager {
|
|
|
731
737
|
`use the getter for '${actual}' instead.`);
|
|
732
738
|
}
|
|
733
739
|
}
|
|
734
|
-
/** The names of all registered actions (
|
|
735
|
-
*
|
|
740
|
+
/** The names of all registered actions (the `game.input.actions` debug seam
|
|
741
|
+
* enumerates these — `runtime/game-input-seams.ts`). */
|
|
736
742
|
actionNames() {
|
|
737
743
|
return [...this.actions.keys()];
|
|
738
744
|
}
|
|
@@ -740,7 +746,7 @@ export class InputManager {
|
|
|
740
746
|
* Poll gamepads and virtual look stick (call at start of frame).
|
|
741
747
|
*
|
|
742
748
|
* `tick` (D15/T-D15.3/.5) — the GAME tick this call services. Pass the
|
|
743
|
-
* live, shared `Game` tick counter here (`
|
|
749
|
+
* live, shared `Game` tick counter here (`world3d-react/r3f-root-factory.tsx` does,
|
|
744
750
|
* via `DebugRegistry.getGameTick()`) so `scheduleActionAtTick`'s numbering
|
|
745
751
|
* never drifts from the actual game tick — the bug an earlier revision of
|
|
746
752
|
* this feature had: an InputManager-LOCAL counter, incremented once per
|
|
@@ -1622,6 +1628,21 @@ export class InputManager {
|
|
|
1622
1628
|
isFocused() {
|
|
1623
1629
|
return this.focused;
|
|
1624
1630
|
}
|
|
1631
|
+
/**
|
|
1632
|
+
* The gate every REAL-DEVICE listener here passes: {@link isEnabled} AND
|
|
1633
|
+
* {@link isFocused}. Public because the DOM edge this class deliberately
|
|
1634
|
+
* does not own — `host-pointer.ts`, the pointer stream behind the touch
|
|
1635
|
+
* backends — must pass the SAME gate, and a caller writing
|
|
1636
|
+
* `isEnabled() && isFocused()` out for itself is how a looser one drifts in
|
|
1637
|
+
* (a pointer adapter that checked only `isEnabled` kept updating position
|
|
1638
|
+
* for a blurred tab). Read it; do not recompose it.
|
|
1639
|
+
*
|
|
1640
|
+
* Machine input (`setVirtualAction` and the tick-scheduled actuations) is
|
|
1641
|
+
* deliberately NOT this gate — see `machineInputActive`.
|
|
1642
|
+
*/
|
|
1643
|
+
isInputActive() {
|
|
1644
|
+
return this.inputActive;
|
|
1645
|
+
}
|
|
1625
1646
|
/** Whether the pointer is currently locked to {@link requestPointerLock}'s
|
|
1626
1647
|
* element (F2, spec §12 "pointer lock") — tracked via the real
|
|
1627
1648
|
* `pointerlockchange` event. */
|
|
@@ -2090,12 +2111,11 @@ export class InputManager {
|
|
|
2090
2111
|
this.touchStickValues.delete(sourceId);
|
|
2091
2112
|
}
|
|
2092
2113
|
// ==========================================================================
|
|
2093
|
-
//
|
|
2094
|
-
// hollowstone's proven `VirtualInput` (`bot/virtual-input.ts`): a bot drives
|
|
2114
|
+
// Action-level virtual input for a synthetic player: a bot drives
|
|
2095
2115
|
// NAMED ACTIONS (not raw devices), and its contributions join action
|
|
2096
2116
|
// resolution at exactly the same points binding contributions do (see
|
|
2097
2117
|
// isPressed/isJustPressed and collectScalarContributions/
|
|
2098
|
-
// collectVector2Contributions above).
|
|
2118
|
+
// collectVector2Contributions above). The gates are split: virtual input
|
|
2099
2119
|
// passes `machineInputActive` (the editor's `enabled` flag only), while
|
|
2100
2120
|
// human input keeps the full `inputActive` (enabled AND focused) gate — a
|
|
2101
2121
|
// synthetic player must keep playing the shared editor tab while the
|
|
@@ -2290,7 +2310,7 @@ export class InputManager {
|
|
|
2290
2310
|
* `'input.schedule.dropped'` (`{tick, action}`) whenever it discards a
|
|
2291
2311
|
* scheduled entry for a tick whose input phase never ran. Called once by
|
|
2292
2312
|
* whoever constructs this `InputManager` with a `DebugRegistry` behind it
|
|
2293
|
-
* (`
|
|
2313
|
+
* (`world3d-react/r3f-root-factory.tsx`), the same seed spot as
|
|
2294
2314
|
* `setVirtualInputTarget`/`setInputActionsSource` — never called directly
|
|
2295
2315
|
* by gameplay code. */
|
|
2296
2316
|
setDebugEmit(fn) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rebind-controller.d.ts","sourceRoot":"","sources":["../../src/input/rebind-controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rebind-controller.d.ts","sourceRoot":"","sources":["../../src/input/rebind-controller.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEnE,uDAAuD;AACvD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,KAAK,CAAC;AAE3C,MAAM,MAAM,WAAW,GACnB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC5E;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,YAAY,CAAC;IACvB,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B,GACD;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC;AAErE,qBAAa,gBAAgB;IAGf,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFlC,OAAO,CAAC,KAAK,CAAmC;gBAEnB,KAAK,EAAE,YAAY;IAEhD,QAAQ,IAAI,WAAW;IAIvB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,UAAsB,EAAE,KAAK,SAAI,GAAG,IAAI;IAIzE,oEAAoE;IACpE,MAAM,IAAI,IAAI;IAId;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW;IAa3C;;;;;;;OAOG;IACH,eAAe,IAAI,WAAW;IAQ9B,OAAO,CAAC,KAAK;CAId"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// all, and the React component becomes a thin, mechanically-verifiable
|
|
8
|
-
// wrapper (see the template component's own doc comment).
|
|
1
|
+
// A framework-free rebinding STATE MACHINE over an `InputManager`.
|
|
2
|
+
// Deliberately has no dependency on React (or any UI library): "listen for the
|
|
3
|
+
// next input, surface a conflict, let the caller decide" is the same flow
|
|
4
|
+
// whether the caller is a React panel or a CLI. Keeping the logic here makes
|
|
5
|
+
// it unit-testable with no DOM/JSX at all, and leaves any UI a thin,
|
|
6
|
+
// mechanically-verifiable wrapper.
|
|
9
7
|
//
|
|
10
8
|
// Flow: `listen(actionName)` -> caller captures the next raw input event
|
|
11
9
|
// itself (a keydown, a gamepad poll, a touch tap — capture is inherently
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/input/schema.ts"],"names":[],"mappings":"AAoCA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/input/schema.ts"],"names":[],"mappings":"AAoCA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAqN7E;gGACgG;AAChG,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAa1B,CAAC;AAE9B,sEAAsE;AACtE,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CA0B1C,CAAC;AAEZ;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAOjB,CAAC"}
|