@vgai/engine 0.2.0 → 0.3.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 +3 -1
- package/dist/adapter/authoring.d.ts +404 -0
- package/dist/adapter/authoring.d.ts.map +1 -0
- package/dist/adapter/authoring.js +22 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts +43 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
- package/dist/adapter/colyseus-networking-adapter.js +38 -0
- package/dist/adapter/first-party-systems.d.ts +38 -0
- package/dist/adapter/first-party-systems.d.ts.map +1 -0
- package/dist/adapter/first-party-systems.js +77 -0
- package/dist/adapter/game-adapter.d.ts +133 -0
- package/dist/adapter/game-adapter.d.ts.map +1 -0
- package/dist/adapter/game-adapter.js +10 -0
- package/dist/adapter/host-context.d.ts +73 -0
- package/dist/adapter/host-context.d.ts.map +1 -0
- package/dist/adapter/host-context.js +16 -0
- package/dist/adapter/index.d.ts +22 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +15 -0
- package/dist/adapter/ingest/game-contract.d.ts +53 -0
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
- package/dist/adapter/ingest/game-contract.js +30 -0
- package/dist/adapter/ingest/overlay-applier.d.ts +118 -0
- package/dist/adapter/ingest/overlay-applier.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-applier.js +132 -0
- package/dist/adapter/ingest/overlay-apply.d.ts +60 -0
- package/dist/adapter/ingest/overlay-apply.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-apply.js +101 -0
- package/dist/adapter/ingest/overlay-file.d.ts +79 -0
- package/dist/adapter/ingest/overlay-file.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-file.js +66 -0
- package/dist/adapter/ingest/overlay-report.d.ts +113 -0
- package/dist/adapter/ingest/overlay-report.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-report.js +103 -0
- package/dist/adapter/ingest/scene-capture.d.ts +97 -0
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
- package/dist/adapter/ingest/scene-capture.js +248 -0
- package/dist/adapter/ingest/upstream-pin.d.ts +47 -0
- package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
- package/dist/adapter/ingest/upstream-pin.js +50 -0
- package/dist/adapter/loop-gate-report.d.ts +34 -0
- package/dist/adapter/loop-gate-report.d.ts.map +1 -0
- package/dist/adapter/loop-gate-report.js +37 -0
- package/dist/adapter/rapier-physics-adapter.d.ts +12 -0
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
- package/dist/adapter/rapier-physics-adapter.js +46 -0
- package/dist/adapter/system-adapter.d.ts +133 -0
- package/dist/adapter/system-adapter.d.ts.map +1 -0
- package/dist/adapter/system-adapter.js +13 -0
- package/dist/adapter/transform.d.ts +18 -0
- package/dist/adapter/transform.d.ts.map +1 -0
- package/dist/adapter/transform.js +1 -0
- package/dist/adapter/vgai-scene-game-adapter.d.ts +116 -0
- package/dist/adapter/vgai-scene-game-adapter.d.ts.map +1 -0
- package/dist/adapter/vgai-scene-game-adapter.js +714 -0
- package/dist/adapter/world-kind.d.ts +30 -0
- package/dist/adapter/world-kind.d.ts.map +1 -0
- package/dist/adapter/world-kind.js +18 -0
- package/dist/ai/navigation.d.ts +64 -0
- package/dist/ai/navigation.d.ts.map +1 -0
- package/dist/ai/navigation.js +133 -0
- package/dist/animation/anim-graph-types.d.ts +25 -0
- package/dist/animation/anim-graph-types.d.ts.map +1 -0
- package/dist/animation/anim-graph-types.js +1 -0
- package/dist/animation/animation-clock.d.ts +213 -0
- package/dist/animation/animation-clock.d.ts.map +1 -0
- package/dist/animation/animation-clock.js +301 -0
- package/dist/animation/blend-node.d.ts +22 -0
- package/dist/animation/blend-node.d.ts.map +1 -0
- package/dist/animation/blend-node.js +97 -0
- package/dist/animation/camera-ownership.d.ts +250 -0
- package/dist/animation/camera-ownership.d.ts.map +1 -0
- package/dist/animation/camera-ownership.js +169 -0
- package/dist/animation/cinematic-cues.d.ts +200 -0
- package/dist/animation/cinematic-cues.d.ts.map +1 -0
- package/dist/animation/cinematic-cues.js +213 -0
- package/dist/animation/clip-map.d.ts +12 -0
- package/dist/animation/clip-map.d.ts.map +1 -0
- package/dist/animation/clip-map.js +37 -0
- package/dist/animation/gsap-registration.d.ts +119 -0
- package/dist/animation/gsap-registration.d.ts.map +1 -0
- package/dist/animation/gsap-registration.js +92 -0
- package/dist/animation/theatre-clock-binding.d.ts +89 -0
- package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
- package/dist/animation/theatre-clock-binding.js +29 -0
- package/dist/animation/theatre-director.d.ts +242 -0
- package/dist/animation/theatre-director.d.ts.map +1 -0
- package/dist/animation/theatre-director.js +235 -0
- package/dist/animation/theatre-object-binding.d.ts +305 -0
- package/dist/animation/theatre-object-binding.d.ts.map +1 -0
- package/dist/animation/theatre-object-binding.js +351 -0
- package/dist/animation/xstate-animation-binding.d.ts +111 -0
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
- package/dist/animation/xstate-animation-binding.js +307 -0
- package/dist/animation/xstate-animation-meta.d.ts +228 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
- package/dist/animation/xstate-animation-meta.js +221 -0
- package/dist/assets.d.ts +26 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +55 -0
- package/dist/audio/index.d.ts +4 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +24 -0
- package/dist/audio/tone-clock-binding.d.ts +75 -0
- package/dist/audio/tone-clock-binding.d.ts.map +1 -0
- package/dist/audio/tone-clock-binding.js +29 -0
- package/dist/audio/tone-context.d.ts +114 -0
- package/dist/audio/tone-context.d.ts.map +1 -0
- package/dist/audio/tone-context.js +39 -0
- package/dist/audio/tone-offline-render.d.ts +90 -0
- package/dist/audio/tone-offline-render.d.ts.map +1 -0
- package/dist/audio/tone-offline-render.js +56 -0
- package/dist/audio/wav-encode.d.ts +38 -0
- package/dist/audio/wav-encode.d.ts.map +1 -0
- package/dist/audio/wav-encode.js +97 -0
- package/dist/core/game-loop.d.ts +21 -0
- package/dist/core/game-loop.d.ts.map +1 -0
- package/dist/core/game-loop.js +130 -0
- package/dist/core/system-runner.d.ts +120 -0
- package/dist/core/system-runner.d.ts.map +1 -0
- package/dist/core/system-runner.js +286 -0
- package/dist/core/types.d.ts +58 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +25 -0
- package/dist/data/data-asset.d.ts +101 -0
- package/dist/data/data-asset.d.ts.map +1 -0
- package/dist/data/data-asset.js +122 -0
- package/dist/data/data-check-core.d.ts +110 -0
- package/dist/data/data-check-core.d.ts.map +1 -0
- package/dist/data/data-check-core.js +178 -0
- package/dist/data/data-ref.d.ts +79 -0
- package/dist/data/data-ref.d.ts.map +1 -0
- package/dist/data/data-ref.js +130 -0
- package/dist/data/vite-plugin-data.d.ts +79 -0
- package/dist/data/vite-plugin-data.d.ts.map +1 -0
- package/dist/data/vite-plugin-data.js +217 -0
- package/dist/dev/console-bridge.d.ts +22 -0
- package/dist/dev/console-bridge.d.ts.map +1 -0
- package/dist/dev/console-bridge.js +71 -0
- package/dist/dev/debug-draw.d.ts +24 -0
- package/dist/dev/debug-draw.d.ts.map +1 -0
- package/dist/dev/debug-draw.js +73 -0
- package/dist/dev/logger.d.ts +30 -0
- package/dist/dev/logger.d.ts.map +1 -0
- package/dist/dev/logger.js +90 -0
- package/dist/ecs/component-manager.d.ts +189 -0
- package/dist/ecs/component-manager.d.ts.map +1 -0
- package/dist/ecs/component-manager.js +676 -0
- package/dist/ecs/game-component.d.ts +97 -0
- package/dist/ecs/game-component.d.ts.map +1 -0
- package/dist/ecs/game-component.js +80 -0
- package/dist/ecs/hmr-swap-report.d.ts +53 -0
- package/dist/ecs/hmr-swap-report.d.ts.map +1 -0
- package/dist/ecs/hmr-swap-report.js +55 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/input/input-manager.d.ts +596 -0
- package/dist/input/input-manager.d.ts.map +1 -0
- package/dist/input/input-manager.js +1564 -0
- package/dist/input/input-types.d.ts +171 -0
- package/dist/input/input-types.d.ts.map +1 -0
- package/dist/input/input-types.js +1 -0
- package/dist/input/prompt-labels.d.ts +21 -0
- package/dist/input/prompt-labels.d.ts.map +1 -0
- package/dist/input/prompt-labels.js +121 -0
- package/dist/input/rebind-controller.d.ts +59 -0
- package/dist/input/rebind-controller.d.ts.map +1 -0
- package/dist/input/rebind-controller.js +85 -0
- package/dist/input/schema.d.ts +16 -0
- package/dist/input/schema.d.ts.map +1 -0
- package/dist/input/schema.js +228 -0
- package/dist/loader.d.ts +43 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +59 -0
- package/dist/manifest/index.d.ts +5 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +8 -0
- package/dist/manifest/load-file.d.ts +4 -0
- package/dist/manifest/load-file.d.ts.map +1 -0
- package/dist/manifest/load-file.js +14 -0
- package/dist/manifest/load.d.ts +117 -0
- package/dist/manifest/load.d.ts.map +1 -0
- package/dist/manifest/load.js +255 -0
- package/dist/manifest/schema.d.ts +173 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +302 -0
- package/dist/physics/collision-system.d.ts +41 -0
- package/dist/physics/collision-system.d.ts.map +1 -0
- package/dist/physics/collision-system.js +64 -0
- package/dist/physics/physics-registry.d.ts +45 -0
- package/dist/physics/physics-registry.d.ts.map +1 -0
- package/dist/physics/physics-registry.js +65 -0
- package/dist/physics/transform-writer.d.ts +16 -0
- package/dist/physics/transform-writer.d.ts.map +1 -0
- package/dist/physics/transform-writer.js +38 -0
- package/dist/physics/trigger-dispatch.d.ts +24 -0
- package/dist/physics/trigger-dispatch.d.ts.map +1 -0
- package/dist/physics/trigger-dispatch.js +80 -0
- package/dist/react/game-state.d.ts +105 -0
- package/dist/react/game-state.d.ts.map +1 -0
- package/dist/react/game-state.js +144 -0
- package/dist/react/use-data.d.ts +60 -0
- package/dist/react/use-data.d.ts.map +1 -0
- package/dist/react/use-data.js +96 -0
- package/dist/react/use-selection.d.ts +75 -0
- package/dist/react/use-selection.d.ts.map +1 -0
- package/dist/react/use-selection.js +90 -0
- package/dist/render/auto-batcher.d.ts +34 -0
- package/dist/render/auto-batcher.d.ts.map +1 -0
- package/dist/render/auto-batcher.js +140 -0
- package/dist/render/render-batch-system.d.ts +33 -0
- package/dist/render/render-batch-system.d.ts.map +1 -0
- package/dist/render/render-batch-system.js +230 -0
- package/dist/render/render-features.d.ts +47 -0
- package/dist/render/render-features.d.ts.map +1 -0
- package/dist/render/render-features.js +105 -0
- package/dist/render/render-settings.d.ts +36 -0
- package/dist/render/render-settings.d.ts.map +1 -0
- package/dist/render/render-settings.js +51 -0
- package/dist/runtime/create-runtime.d.ts +280 -0
- package/dist/runtime/create-runtime.d.ts.map +1 -0
- package/dist/runtime/create-runtime.js +795 -0
- package/dist/runtime/frame-selector-cache.d.ts +41 -0
- package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
- package/dist/runtime/frame-selector-cache.js +65 -0
- package/dist/runtime/game.d.ts +433 -0
- package/dist/runtime/game.d.ts.map +1 -0
- package/dist/runtime/game.js +569 -0
- package/dist/runtime/input-router.d.ts +78 -0
- package/dist/runtime/input-router.d.ts.map +1 -0
- package/dist/runtime/input-router.js +171 -0
- package/dist/runtime/mount-game.d.ts +129 -0
- package/dist/runtime/mount-game.d.ts.map +1 -0
- package/dist/runtime/mount-game.js +152 -0
- package/dist/runtime/mount-manifest.d.ts +119 -0
- package/dist/runtime/mount-manifest.d.ts.map +1 -0
- package/dist/runtime/mount-manifest.js +204 -0
- package/dist/runtime/render-audio-control.d.ts +110 -0
- package/dist/runtime/render-audio-control.d.ts.map +1 -0
- package/dist/runtime/render-audio-control.js +111 -0
- package/dist/runtime/render-control.d.ts +291 -0
- package/dist/runtime/render-control.d.ts.map +1 -0
- package/dist/runtime/render-control.js +264 -0
- package/dist/runtime/render-seed.d.ts +57 -0
- package/dist/runtime/render-seed.d.ts.map +1 -0
- package/dist/runtime/render-seed.js +74 -0
- package/dist/runtime/scene-ui-bridge.d.ts +69 -0
- package/dist/runtime/scene-ui-bridge.d.ts.map +1 -0
- package/dist/runtime/scene-ui-bridge.js +23 -0
- package/dist/runtime/scene-ui-data.d.ts +13 -0
- package/dist/runtime/scene-ui-data.d.ts.map +1 -0
- package/dist/runtime/scene-ui-data.js +92 -0
- package/dist/runtime/state-bridge.d.ts +47 -0
- package/dist/runtime/state-bridge.d.ts.map +1 -0
- package/dist/runtime/state-bridge.js +53 -0
- package/dist/runtime/types.d.ts +179 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +1 -0
- package/dist/scene/asset-loaders.d.ts +79 -0
- package/dist/scene/asset-loaders.d.ts.map +1 -0
- package/dist/scene/asset-loaders.js +141 -0
- package/dist/scene/asset-paths.d.ts +11 -0
- package/dist/scene/asset-paths.d.ts.map +1 -0
- package/dist/scene/asset-paths.js +108 -0
- package/dist/scene/asset-ref-check.d.ts +88 -0
- package/dist/scene/asset-ref-check.d.ts.map +1 -0
- package/dist/scene/asset-ref-check.js +214 -0
- package/dist/scene/asset-registry.d.ts +30 -0
- package/dist/scene/asset-registry.d.ts.map +1 -0
- package/dist/scene/asset-registry.js +50 -0
- package/dist/scene/collider-dimensions.d.ts +63 -0
- package/dist/scene/collider-dimensions.d.ts.map +1 -0
- package/dist/scene/collider-dimensions.js +98 -0
- package/dist/scene/component-registry.d.ts +17 -0
- package/dist/scene/component-registry.d.ts.map +1 -0
- package/dist/scene/component-registry.js +28 -0
- package/dist/scene/defaults.d.ts +252 -0
- package/dist/scene/defaults.d.ts.map +1 -0
- package/dist/scene/defaults.js +151 -0
- package/dist/scene/geometries/index.d.ts +8 -0
- package/dist/scene/geometries/index.d.ts.map +1 -0
- package/dist/scene/geometries/index.js +7 -0
- package/dist/scene/geometries/terrain.d.ts +2 -0
- package/dist/scene/geometries/terrain.d.ts.map +1 -0
- package/dist/scene/geometries/terrain.js +37 -0
- package/dist/scene/geometry-registry.d.ts +24 -0
- package/dist/scene/geometry-registry.d.ts.map +1 -0
- package/dist/scene/geometry-registry.js +20 -0
- package/dist/scene/instance-registry.d.ts +36 -0
- package/dist/scene/instance-registry.d.ts.map +1 -0
- package/dist/scene/instance-registry.js +55 -0
- package/dist/scene/instancers/grid.d.ts +2 -0
- package/dist/scene/instancers/grid.d.ts.map +1 -0
- package/dist/scene/instancers/grid.js +36 -0
- package/dist/scene/instancers/index.d.ts +8 -0
- package/dist/scene/instancers/index.d.ts.map +1 -0
- package/dist/scene/instancers/index.js +7 -0
- package/dist/scene/light-camera-factory.d.ts +23 -0
- package/dist/scene/light-camera-factory.d.ts.map +1 -0
- package/dist/scene/light-camera-factory.js +68 -0
- package/dist/scene/material-factory.d.ts +17 -0
- package/dist/scene/material-factory.d.ts.map +1 -0
- package/dist/scene/material-factory.js +197 -0
- package/dist/scene/material-registry.d.ts +40 -0
- package/dist/scene/material-registry.d.ts.map +1 -0
- package/dist/scene/material-registry.js +44 -0
- package/dist/scene/materials/index.d.ts +8 -0
- package/dist/scene/materials/index.d.ts.map +1 -0
- package/dist/scene/materials/index.js +7 -0
- package/dist/scene/materials/water.d.ts +2 -0
- package/dist/scene/materials/water.d.ts.map +1 -0
- package/dist/scene/materials/water.js +54 -0
- package/dist/scene/parse.d.ts +23 -0
- package/dist/scene/parse.d.ts.map +1 -0
- package/dist/scene/parse.js +179 -0
- package/dist/scene/particles-factory.d.ts +33 -0
- package/dist/scene/particles-factory.d.ts.map +1 -0
- package/dist/scene/particles-factory.js +282 -0
- package/dist/scene/scene-apply.d.ts +109 -0
- package/dist/scene/scene-apply.d.ts.map +1 -0
- package/dist/scene/scene-apply.js +326 -0
- package/dist/scene/scene-diff-schema.d.ts +285 -0
- package/dist/scene/scene-diff-schema.d.ts.map +1 -0
- package/dist/scene/scene-diff-schema.js +92 -0
- package/dist/scene/scene-diff-types.d.ts +40 -0
- package/dist/scene/scene-diff-types.d.ts.map +1 -0
- package/dist/scene/scene-diff-types.js +14 -0
- package/dist/scene/scene-loader.d.ts +177 -0
- package/dist/scene/scene-loader.d.ts.map +1 -0
- package/dist/scene/scene-loader.js +1213 -0
- package/dist/scene/scene-query.d.ts +11 -0
- package/dist/scene/scene-query.d.ts.map +1 -0
- package/dist/scene/scene-query.js +63 -0
- package/dist/scene/scene-types.d.ts +10 -0
- package/dist/scene/scene-types.d.ts.map +1 -0
- package/dist/scene/scene-types.js +8 -0
- package/dist/scene/scene-version.d.ts +26 -0
- package/dist/scene/scene-version.d.ts.map +1 -0
- package/dist/scene/scene-version.js +34 -0
- package/dist/scene/schema/animation.d.ts +8 -0
- package/dist/scene/schema/animation.d.ts.map +1 -0
- package/dist/scene/schema/animation.js +42 -0
- package/dist/scene/schema/audio.d.ts +13 -0
- package/dist/scene/schema/audio.d.ts.map +1 -0
- package/dist/scene/schema/audio.js +22 -0
- package/dist/scene/schema/camera.d.ts +28 -0
- package/dist/scene/schema/camera.d.ts.map +1 -0
- package/dist/scene/schema/camera.js +17 -0
- package/dist/scene/schema/collider.d.ts +40 -0
- package/dist/scene/schema/collider.d.ts.map +1 -0
- package/dist/scene/schema/collider.js +55 -0
- package/dist/scene/schema/entity-ref.d.ts +31 -0
- package/dist/scene/schema/entity-ref.d.ts.map +1 -0
- package/dist/scene/schema/entity-ref.js +61 -0
- package/dist/scene/schema/entity.d.ts +1036 -0
- package/dist/scene/schema/entity.d.ts.map +1 -0
- package/dist/scene/schema/entity.js +153 -0
- package/dist/scene/schema/environment.d.ts +425 -0
- package/dist/scene/schema/environment.d.ts.map +1 -0
- package/dist/scene/schema/environment.js +357 -0
- package/dist/scene/schema/index.d.ts +39 -0
- package/dist/scene/schema/index.d.ts.map +1 -0
- package/dist/scene/schema/index.js +20 -0
- package/dist/scene/schema/instances.d.ts +14 -0
- package/dist/scene/schema/instances.d.ts.map +1 -0
- package/dist/scene/schema/instances.js +28 -0
- package/dist/scene/schema/joint.d.ts +23 -0
- package/dist/scene/schema/joint.d.ts.map +1 -0
- package/dist/scene/schema/joint.js +23 -0
- package/dist/scene/schema/light.d.ts +38 -0
- package/dist/scene/schema/light.d.ts.map +1 -0
- package/dist/scene/schema/light.js +26 -0
- package/dist/scene/schema/material.d.ts +199 -0
- package/dist/scene/schema/material.d.ts.map +1 -0
- package/dist/scene/schema/material.js +99 -0
- package/dist/scene/schema/mesh.d.ts +48 -0
- package/dist/scene/schema/mesh.d.ts.map +1 -0
- package/dist/scene/schema/mesh.js +82 -0
- package/dist/scene/schema/particles.d.ts +2178 -0
- package/dist/scene/schema/particles.d.ts.map +1 -0
- package/dist/scene/schema/particles.js +321 -0
- package/dist/scene/schema/physics.d.ts +56 -0
- package/dist/scene/schema/physics.d.ts.map +1 -0
- package/dist/scene/schema/physics.js +37 -0
- package/dist/scene/schema/scene-file.d.ts +304 -0
- package/dist/scene/schema/scene-file.d.ts.map +1 -0
- package/dist/scene/schema/scene-file.js +262 -0
- package/dist/scene/schema/shadow.d.ts +28 -0
- package/dist/scene/schema/shadow.d.ts.map +1 -0
- package/dist/scene/schema/shadow.js +20 -0
- package/dist/scene/schema/spline.d.ts +25 -0
- package/dist/scene/schema/spline.d.ts.map +1 -0
- package/dist/scene/schema/spline.js +15 -0
- package/dist/scene/schema/tuples.d.ts +12 -0
- package/dist/scene/schema/tuples.d.ts.map +1 -0
- package/dist/scene/schema/tuples.js +14 -0
- package/dist/scene/schema/ui.d.ts +880 -0
- package/dist/scene/schema/ui.d.ts.map +1 -0
- package/dist/scene/schema/ui.js +506 -0
- package/dist/scene/user-data.d.ts +171 -0
- package/dist/scene/user-data.d.ts.map +1 -0
- package/dist/scene/user-data.js +137 -0
- package/dist/setup/setup-audio.d.ts +20 -0
- package/dist/setup/setup-audio.d.ts.map +1 -0
- package/dist/setup/setup-audio.js +41 -0
- package/dist/setup/setup-particles.d.ts +17 -0
- package/dist/setup/setup-particles.d.ts.map +1 -0
- package/dist/setup/setup-particles.js +16 -0
- package/dist/setup/setup-physics.d.ts +25 -0
- package/dist/setup/setup-physics.d.ts.map +1 -0
- package/dist/setup/setup-physics.js +51 -0
- package/dist/setup/setup-renderer.d.ts +69 -0
- package/dist/setup/setup-renderer.d.ts.map +1 -0
- package/dist/setup/setup-renderer.js +363 -0
- package/dist/tools/define-tool.d.ts +105 -0
- package/dist/tools/define-tool.d.ts.map +1 -0
- package/dist/tools/define-tool.js +82 -0
- package/dist/world2d/authoring-2d.d.ts +76 -0
- package/dist/world2d/authoring-2d.d.ts.map +1 -0
- package/dist/world2d/authoring-2d.js +176 -0
- package/dist/world2d/capture-to-scene2d.d.ts +5 -0
- package/dist/world2d/capture-to-scene2d.d.ts.map +1 -0
- package/dist/world2d/capture-to-scene2d.js +49 -0
- package/dist/world2d/collision-2d.d.ts +52 -0
- package/dist/world2d/collision-2d.d.ts.map +1 -0
- package/dist/world2d/collision-2d.js +70 -0
- package/dist/world2d/components-2d.d.ts +47 -0
- package/dist/world2d/components-2d.d.ts.map +1 -0
- package/dist/world2d/components-2d.js +77 -0
- package/dist/world2d/index.d.ts +34 -0
- package/dist/world2d/index.d.ts.map +1 -0
- package/dist/world2d/index.js +32 -0
- package/dist/world2d/ingest-iframe-2d.d.ts +82 -0
- package/dist/world2d/ingest-iframe-2d.d.ts.map +1 -0
- package/dist/world2d/ingest-iframe-2d.js +166 -0
- package/dist/world2d/ingest2d.d.ts +97 -0
- package/dist/world2d/ingest2d.d.ts.map +1 -0
- package/dist/world2d/ingest2d.js +40 -0
- package/dist/world2d/physics2d-registry.d.ts +24 -0
- package/dist/world2d/physics2d-registry.d.ts.map +1 -0
- package/dist/world2d/physics2d-registry.js +38 -0
- package/dist/world2d/pixi-game-adapter.d.ts +107 -0
- package/dist/world2d/pixi-game-adapter.d.ts.map +1 -0
- package/dist/world2d/pixi-game-adapter.js +211 -0
- package/dist/world2d/pixi-surface.d.ts +39 -0
- package/dist/world2d/pixi-surface.d.ts.map +1 -0
- package/dist/world2d/pixi-surface.js +47 -0
- package/dist/world2d/scene-capture-2d.d.ts +43 -0
- package/dist/world2d/scene-capture-2d.d.ts.map +1 -0
- package/dist/world2d/scene-capture-2d.js +92 -0
- package/dist/world2d/scene2d-loader.d.ts +27 -0
- package/dist/world2d/scene2d-loader.d.ts.map +1 -0
- package/dist/world2d/scene2d-loader.js +274 -0
- package/dist/world2d/schema/entity2d.d.ts +102 -0
- package/dist/world2d/schema/entity2d.d.ts.map +1 -0
- package/dist/world2d/schema/entity2d.js +119 -0
- package/dist/world2d/schema/physics2d.d.ts +46 -0
- package/dist/world2d/schema/physics2d.d.ts.map +1 -0
- package/dist/world2d/schema/physics2d.js +45 -0
- package/dist/world2d/schema/sprite.d.ts +42 -0
- package/dist/world2d/schema/sprite.d.ts.map +1 -0
- package/dist/world2d/schema/sprite.js +63 -0
- package/dist/world2d/schema/tilemap.d.ts +15 -0
- package/dist/world2d/schema/tilemap.d.ts.map +1 -0
- package/dist/world2d/schema/tilemap.js +19 -0
- package/dist/world2d/schema/tuples2d.d.ts +20 -0
- package/dist/world2d/schema/tuples2d.d.ts.map +1 -0
- package/dist/world2d/schema/tuples2d.js +19 -0
- package/dist/world2d/system-adapters-2d.d.ts +16 -0
- package/dist/world2d/system-adapters-2d.d.ts.map +1 -0
- package/dist/world2d/system-adapters-2d.js +37 -0
- package/dist/world2d/transform-writer-2d.d.ts +16 -0
- package/dist/world2d/transform-writer-2d.d.ts.map +1 -0
- package/dist/world2d/transform-writer-2d.js +22 -0
- package/dist/world2d/types.d.ts +53 -0
- package/dist/world2d/types.d.ts.map +1 -0
- package/dist/world2d/types.js +1 -0
- package/package.json +18 -4
- package/src/adapter/authoring.ts +10 -0
- package/src/adapter/first-party-systems.ts +23 -34
- package/src/adapter/index.ts +1 -3
- package/src/adapter/system-adapter.ts +15 -22
- package/src/adapter/vgai-scene-game-adapter.ts +5 -14
- package/src/animation/anim-graph-types.ts +12 -43
- package/src/animation/animation-clock.ts +479 -0
- package/src/animation/camera-ownership.ts +467 -0
- package/src/animation/cinematic-cues.ts +451 -0
- package/src/animation/clip-map.ts +41 -0
- package/src/animation/gsap-registration.ts +184 -0
- package/src/animation/theatre-clock-binding.ts +111 -0
- package/src/animation/theatre-director.ts +347 -0
- package/src/animation/theatre-object-binding.ts +661 -0
- package/src/animation/xstate-animation-binding.ts +398 -0
- package/src/animation/xstate-animation-meta.ts +282 -0
- package/src/audio/index.ts +39 -7
- package/src/audio/tone-clock-binding.ts +98 -0
- package/src/audio/tone-context.ts +129 -0
- package/src/audio/tone-offline-render.ts +167 -0
- package/src/audio/wav-encode.ts +119 -0
- package/src/core/game-loop.ts +17 -0
- package/src/core/types.ts +13 -0
- package/src/data/data-asset.ts +167 -0
- package/src/data/data-check-core.ts +242 -0
- package/src/data/data-ref.ts +145 -0
- package/src/data/vite-plugin-data.ts +290 -0
- package/src/index.ts +48 -0
- package/src/input/input-manager.ts +1206 -32
- package/src/input/input-types.ts +155 -3
- package/src/input/prompt-labels.ts +122 -0
- package/src/input/rebind-controller.ts +105 -0
- package/src/input/schema.ts +206 -52
- package/src/react/use-data.ts +114 -0
- package/src/react/use-selection.tsx +135 -0
- package/src/runtime/create-runtime.ts +30 -9
- package/src/runtime/render-audio-control.ts +168 -0
- package/src/runtime/render-control.ts +522 -0
- package/src/runtime/render-seed.ts +79 -0
- package/src/runtime/types.ts +0 -5
- package/src/scene/asset-loaders.ts +10 -36
- package/src/scene/asset-paths.ts +0 -2
- package/src/scene/asset-ref-check.ts +248 -0
- package/src/scene/parse.ts +133 -0
- package/src/scene/scene-loader.ts +81 -96
- package/src/scene/schema/animation.ts +30 -79
- package/src/scene/schema/entity.ts +20 -0
- package/src/scene/schema/index.ts +2 -12
- package/src/scene/user-data.ts +8 -9
- package/src/setup/setup-renderer.ts +9 -2
- package/src/tools/define-tool.ts +152 -0
- package/src/animation/anim-graph.ts +0 -406
- package/src/animation/anim-system.ts +0 -28
- package/src/animation/property-track.ts +0 -178
- package/src/animation/schema.ts +0 -204
- package/src/audio/ambient.ts +0 -300
- package/src/audio/impacts.ts +0 -212
- package/src/audio/movement.ts +0 -140
- package/src/audio/musical.ts +0 -200
- package/src/audio/ui-sounds.ts +0 -171
- package/src/audio/vehicle.ts +0 -235
- package/src/audio/weapons.ts +0 -152
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
import type { ActionValueOf, ActionValueSource, ActionValueType, BindingConflict, BindingPrompt, InputBinding, InputMapFile, PromptDevice, Vector2 } from './input-types';
|
|
2
|
+
/**
|
|
3
|
+
* Maps raw keyboard/mouse/gamepad events → named actions.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* const input = new InputManager();
|
|
7
|
+
* await input.loadMap('inputmaps/default.inputmap.json');
|
|
8
|
+
* // In game loop:
|
|
9
|
+
* input.poll(); // call at start of frame
|
|
10
|
+
* if (input.isPressed('jump')) { ... }
|
|
11
|
+
* if (input.isJustPressed('attack')) { ... }
|
|
12
|
+
* input.endFrame(); // call at end of frame
|
|
13
|
+
*
|
|
14
|
+
* F1 (spec §12 "Define Typed Action Values") — typed action values:
|
|
15
|
+
*
|
|
16
|
+
* Every action DECLARES a value shape (`InputAction.valueType`, defaulted to
|
|
17
|
+
* `'digital'` — see `input-types.ts`'s `ActionValueType`). Each shape has its
|
|
18
|
+
* own typed getter, none of which return `any`:
|
|
19
|
+
*
|
|
20
|
+
* - `'digital'` — `isPressed`/`isJustPressed`/`isJustReleased` -> `boolean`
|
|
21
|
+
* - `'scalar'` — `getScalar` -> `number`
|
|
22
|
+
* - `'vector2'` — `getVector2` -> `Vector2` ({x,y})
|
|
23
|
+
* - `'pointerDelta'` — `getPointerDelta` -> `Vector2`
|
|
24
|
+
* - `'pointerPosition'` — `getPointerPosition` -> `Vector2`
|
|
25
|
+
*
|
|
26
|
+
* Reading an action through the WRONG getter (e.g. `getScalar` on a
|
|
27
|
+
* `'digital'` action) throws — that's the type-safety enforcement point,
|
|
28
|
+
* since actions are declared in data (JSON), not TS types, so there's no
|
|
29
|
+
* compiler backstop otherwise. `readAction(name, expectedType)` is a generic
|
|
30
|
+
* entry point over the same getters, typed via `ActionValueOf<T>`.
|
|
31
|
+
*
|
|
32
|
+
* Each typed getter has a `*Source` sibling (e.g. `getScalarSource`) that
|
|
33
|
+
* returns `ActionValueSource | null` — which binding (and, for gamepad
|
|
34
|
+
* bindings, which connected gamepad, or for injected test bindings, which
|
|
35
|
+
* named source) produced the current value. That's the "device/source
|
|
36
|
+
* metadata" AC.
|
|
37
|
+
*
|
|
38
|
+
* Deadzone + normalization:
|
|
39
|
+
* - scalar: below `deadzone` magnitude -> 0; at/above it, rescaled from 0
|
|
40
|
+
* (at the deadzone edge) to ±1 (at |raw| = 1), sign preserved
|
|
41
|
+
* (`rescaleScalar`).
|
|
42
|
+
* - vector2: below `deadzone` magnitude -> {0,0}; at/above it, direction is
|
|
43
|
+
* preserved and magnitude is rescaled the same way, then the result is
|
|
44
|
+
* clamped to the unit circle — magnitude never exceeds 1 even for a raw
|
|
45
|
+
* diagonal input like {1,1} (`rescaleVector2`).
|
|
46
|
+
*
|
|
47
|
+
* Simultaneous-binding combine rules (documented here, spec §12 F1
|
|
48
|
+
* "simultaneous bindings combine predictably"):
|
|
49
|
+
* - digital: OR — any one satisfied binding makes the action pressed
|
|
50
|
+
* (pre-existing behavior, unchanged).
|
|
51
|
+
* - scalar: max-magnitude across contributing bindings' (deadzone-applied)
|
|
52
|
+
* values, sign preserved; ties keep the first-listed binding
|
|
53
|
+
* (deterministic given binding array order).
|
|
54
|
+
* - vector2: sum contributing (deadzone-applied) {x,y} values component-
|
|
55
|
+
* wise, then clamp the sum to the unit circle (never renormalized UP —
|
|
56
|
+
* only ever scaled down if the sum exceeds magnitude 1).
|
|
57
|
+
* - pointerDelta: sum contributing deltas (matches the existing
|
|
58
|
+
* mouseDeltaX/Y + lookStick accumulation precedent below).
|
|
59
|
+
* - pointerPosition: last-write-wins — the contributing source most
|
|
60
|
+
* recently updated (by injection call order) wins; position isn't
|
|
61
|
+
* additive so summing would be meaningless.
|
|
62
|
+
*
|
|
63
|
+
* Synthetic input injection (test hook, also the shape of F2's "injected
|
|
64
|
+
* test input" backend): `injectAxis`/`injectVector2`/`injectPointerDelta`/
|
|
65
|
+
* `injectPointerPosition` push a raw value into a named source, read back by
|
|
66
|
+
* binding an action to `{ type: 'test_axis' | 'test_vector2' |
|
|
67
|
+
* 'test_pointer_delta' | 'test_pointer_position', sourceId }` — the exact
|
|
68
|
+
* same aggregation path (deadzone/normalize/combine) real device bindings
|
|
69
|
+
* use.
|
|
70
|
+
*
|
|
71
|
+
* F2 (spec §12 "Complete Device Backends") completes the real-device side of
|
|
72
|
+
* that same typed-value path:
|
|
73
|
+
*
|
|
74
|
+
* - `mouse_move` — un-rejected (schema.ts). Feeds `getPointerDelta` (raw
|
|
75
|
+
* accumulated `mouseDeltaX/Y`, no deadzone) and `getVector2` (the same
|
|
76
|
+
* delta, deadzone-rescaled + unit-circle-clamped).
|
|
77
|
+
* - `gamepad_axis_pair` — un-rejected (schema.ts). Feeds `getVector2` with
|
|
78
|
+
* the coupled `(xAxis, yAxis)` reading, deadzone-rescaled like a real
|
|
79
|
+
* stick (default deadzone 0.15, matching `gamepad_axis`).
|
|
80
|
+
* - `touch_button`/`touch_stick` — new binding kinds for touch/virtual
|
|
81
|
+
* controls. `setTouchButton(sourceId, pressed)` feeds a digital action
|
|
82
|
+
* (edge-tracked like `mouse_button`); `setTouchStick(sourceId, value)`
|
|
83
|
+
* feeds a vector2 action (deadzone-rescaled like a gamepad stick). These
|
|
84
|
+
* are the injectable entry points a real on-screen touch UI's own
|
|
85
|
+
* touchstart/touchmove/touchend handlers would call — that DOM wiring is
|
|
86
|
+
* a thin adapter at the edge (browser-verified separately, e.g. F4/e2e);
|
|
87
|
+
* the mapping logic here is unit-tested headlessly with no DOM.
|
|
88
|
+
* - Focus gating — `blur`/`focus` on `window` (guarded, real DOM only) now
|
|
89
|
+
* drop input the same way `setEnabled(false)` does (flushing held
|
|
90
|
+
* key/mouse/touch-button state) without touching the `enabled` flag the
|
|
91
|
+
* editor drives — see `focused`/`inputActive` below. This is what stops
|
|
92
|
+
* a stuck key/button when the user alt-tabs away mid-press.
|
|
93
|
+
* - Pointer lock — `pointerlockchange` on `document` (guarded) tracks
|
|
94
|
+
* `isPointerLocked()`; losing lock flushes mouse-button state (a click
|
|
95
|
+
* held at the moment lock exits must not stick).
|
|
96
|
+
* - Gamepad device identity — `getGamepadInfo(index)` exposes `{index, id,
|
|
97
|
+
* mapping, connected}`; `ActionValueSource.gamepadId` (in addition to the
|
|
98
|
+
* pre-existing `gamepadIndex`) is populated for every
|
|
99
|
+
* gamepad_button/gamepad_axis/gamepad_axis_pair source.
|
|
100
|
+
* - Disconnection/reconnection needs no new tracking: `poll()` already
|
|
101
|
+
* re-reads `navigator.getGamepads()` every frame and every read (digital
|
|
102
|
+
* edges, scalar/vector2 contributions) already skips a `null` gamepad
|
|
103
|
+
* entry, so a disconnected gamepad's bound actions go neutral (and a
|
|
104
|
+
* previously-held button correctly fires `isJustReleased`) with no
|
|
105
|
+
* special-cased code — see the state-transition tests.
|
|
106
|
+
*
|
|
107
|
+
* F3 (spec §12 "Add Rebinding and Prompts") completes the input system with
|
|
108
|
+
* rebinding, structural conflict detection, and device-prompt resolution:
|
|
109
|
+
*
|
|
110
|
+
* - Listing/mutating: `getBindings`/`setBindings`/`addBinding`/
|
|
111
|
+
* `removeBinding`/`replaceBinding` — the same `this.actions` map F1/F2
|
|
112
|
+
* already read, now with a public read + mutation surface (there was
|
|
113
|
+
* previously none — every existing call site either loaded a map once or
|
|
114
|
+
* read through the typed getters).
|
|
115
|
+
* - Reset-to-defaults: `registerAction`/`loadMap`/`loadMapObject` snapshot
|
|
116
|
+
* each action's bindings into `defaultBindings` (a deep clone) at
|
|
117
|
+
* registration/load time; `resetBindings`/`resetAllBindings` restore from
|
|
118
|
+
* that snapshot. Later rebinding calls do NOT touch the snapshot, so
|
|
119
|
+
* "reset" always means "back to what was authored/loaded", not "back to
|
|
120
|
+
* the last reset".
|
|
121
|
+
* - Persist: `toInputMapFile()` serializes the live action set back into
|
|
122
|
+
* the exact `.inputmap.json` shape (`InputMapFile`) `loadMap` reads;
|
|
123
|
+
* `loadMapObject(data)` is `loadMap`'s synchronous, no-`fetch` sibling —
|
|
124
|
+
* both funnel through the same `InputMapFileSchema`-validated
|
|
125
|
+
* `applyParsedMap`. This is the round-trip seam: serialize, write/hand to
|
|
126
|
+
* something else, reload, and rebound actions survive. It complements —
|
|
127
|
+
* doesn't replace — the SDK's `project.inputMap.read/validate/update`
|
|
128
|
+
* operations (B2, `packages/vgai-sdk/src/project/input-map-operations.ts`):
|
|
129
|
+
* those are FILE-level (a CLI/agent editing the `.inputmap.json` on disk,
|
|
130
|
+
* no running game involved); this is RUNTIME-level (a live game rebinding
|
|
131
|
+
* while playing). Both validate through the identical
|
|
132
|
+
* `InputMapFileSchema`, so a file B2 wrote loads here unchanged, and a
|
|
133
|
+
* map this class serializes is a valid document for B2 to read back.
|
|
134
|
+
* - Conflicts: `findConflicts(proposed, excludeActionName?)` scans every
|
|
135
|
+
* OTHER registered action's bindings for one that's structurally
|
|
136
|
+
* equivalent to `proposed` (see the private `bindingsCollide` — same
|
|
137
|
+
* physical input identity: same key code, same mouse button, the same
|
|
138
|
+
* gamepad button/axis/axis-pair, the same touch `sourceId`, etc.) and
|
|
139
|
+
* returns the (possibly empty) list as plain `BindingConflict` data —
|
|
140
|
+
* never throws. A rebinding UI calls this BEFORE calling
|
|
141
|
+
* `addBinding`/`replaceBinding`/`setBindings` and decides what to do with
|
|
142
|
+
* a non-empty result (block, warn, let the user steal the binding by
|
|
143
|
+
* removing it from the other action first).
|
|
144
|
+
* - Prompts: `getPrompt(actionName, device?, gamepadIndex?)` resolves a
|
|
145
|
+
* `BindingPrompt` (display label + icon name) for whichever of the
|
|
146
|
+
* action's bindings belongs to the requested `PromptDevice` family
|
|
147
|
+
* (keyboard/mouse/gamepad/touch — `bindingDeviceFamily` in
|
|
148
|
+
* `prompt-labels.ts`), using `getGamepadInfo` to prefer the standard
|
|
149
|
+
* mapping's canonical glyph names (`'A'`, `'LB'`, ...) for gamepad
|
|
150
|
+
* buttons and falling back to a raw index label (or a "disconnected"
|
|
151
|
+
* label) when the pad isn't in standard mapping or isn't connected.
|
|
152
|
+
* `device` is optional (F4 below) — omit it to resolve against
|
|
153
|
+
* `getLastActiveDevice()` instead.
|
|
154
|
+
*
|
|
155
|
+
* F4 (spec §12 "Schema and Examples") closes F3's one open gap — a
|
|
156
|
+
* current-ACTIVE-device tracker, so a prompt UI can switch its displayed
|
|
157
|
+
* label as the player switches controllers instead of the caller having to
|
|
158
|
+
* track that itself:
|
|
159
|
+
*
|
|
160
|
+
* - `getLastActiveDevice()` returns the `PromptDevice` family of whichever
|
|
161
|
+
* input arrived most recently — keyboard on `keydown`, mouse on
|
|
162
|
+
* `mousedown`/a real `mousemove`, gamepad on a button press or a stick
|
|
163
|
+
* pushed meaningfully off-center (checked in `poll()`), touch on
|
|
164
|
+
* `setTouchButton(_, true)` or `setTouchStick` pushed meaningfully
|
|
165
|
+
* off-center. `null` before any input has arrived.
|
|
166
|
+
* - `getPrompt(actionName)` (device omitted) resolves against it directly,
|
|
167
|
+
* falling back to `'keyboard'` before any input has arrived — a HUD can
|
|
168
|
+
* call it every frame with no extra bookkeeping and the label switches on
|
|
169
|
+
* its own.
|
|
170
|
+
*/
|
|
171
|
+
export declare class InputManager {
|
|
172
|
+
private actions;
|
|
173
|
+
private actionValueTypes;
|
|
174
|
+
private defaultBindings;
|
|
175
|
+
private loadedMapVersion;
|
|
176
|
+
private keysDown;
|
|
177
|
+
private keysJustDown;
|
|
178
|
+
private keysJustUp;
|
|
179
|
+
private mouseButtons;
|
|
180
|
+
private mouseButtonsJustDown;
|
|
181
|
+
private mouseButtonsJustUp;
|
|
182
|
+
private mouseDeltaX;
|
|
183
|
+
private mouseDeltaY;
|
|
184
|
+
private gamepads;
|
|
185
|
+
private gamepadButtonsDown;
|
|
186
|
+
private gamepadButtonsPrev;
|
|
187
|
+
private gamepadButtonsJustDown;
|
|
188
|
+
private gamepadButtonsJustUp;
|
|
189
|
+
private gamepadAxesCurrent;
|
|
190
|
+
private gamepadAxesPrev;
|
|
191
|
+
private lookStickX;
|
|
192
|
+
private lookStickY;
|
|
193
|
+
private testAxisValues;
|
|
194
|
+
private testVector2Values;
|
|
195
|
+
private testPointerDeltaAccum;
|
|
196
|
+
private testPointerPositionValues;
|
|
197
|
+
private pointerPositionSeq;
|
|
198
|
+
private touchButtonsDown;
|
|
199
|
+
private touchButtonsJustDown;
|
|
200
|
+
private touchButtonsJustUp;
|
|
201
|
+
private touchStickValues;
|
|
202
|
+
private lastActiveDevice;
|
|
203
|
+
/** Coarse "is this stick meaningfully off-center" check shared by the
|
|
204
|
+
* gamepad and touch-stick active-device heuristics above — deliberately a
|
|
205
|
+
* higher bar than a binding's own (often much smaller) configured
|
|
206
|
+
* deadzone, since this is "did the player just grab this control", not
|
|
207
|
+
* "does this binding's value count as non-zero". */
|
|
208
|
+
private static isStickActive;
|
|
209
|
+
private disposed;
|
|
210
|
+
/**
|
|
211
|
+
* When false, all raw input is ignored and held/transient state is cleared.
|
|
212
|
+
* The editor host drives this (T6.3, `packages/editor/src/play-mode.ts`) so
|
|
213
|
+
* the running game only receives input while its viewport is the active,
|
|
214
|
+
* focused surface — keystrokes typed into the editor (Scene tab, inspector
|
|
215
|
+
* fields) must not leak into the game. A standalone game leaves this true
|
|
216
|
+
* for its whole lifetime.
|
|
217
|
+
*/
|
|
218
|
+
private enabled;
|
|
219
|
+
/**
|
|
220
|
+
* F2 — real window focus, distinct from `enabled` (which is the editor's
|
|
221
|
+
* explicit play-mode gate). `false` while the tab/window is blurred (real
|
|
222
|
+
* `blur`/`focus` events — see the constructor). Held keyboard/mouse/touch
|
|
223
|
+
* state is flushed on blur so a key/button held at alt-tab time doesn't
|
|
224
|
+
* stick (the browser stops delivering keyup/mouseup while blurred).
|
|
225
|
+
*/
|
|
226
|
+
private focused;
|
|
227
|
+
/** Both gates a standalone game must pass for input to be live (spec §12
|
|
228
|
+
* F2 "focus gating"): the editor's explicit `enabled` flag AND real
|
|
229
|
+
* window focus. Used everywhere `enabled` alone used to be checked. */
|
|
230
|
+
private get inputActive();
|
|
231
|
+
/** F2 — real pointer-lock state (`document.pointerLockElement`), tracked via
|
|
232
|
+
* `pointerlockchange` (see the constructor). */
|
|
233
|
+
private pointerLocked;
|
|
234
|
+
/** Element currently wired for click-to-pointer-lock, and its listener. */
|
|
235
|
+
private pointerLockElement;
|
|
236
|
+
private onPointerLockClick;
|
|
237
|
+
private onPointerLockChange;
|
|
238
|
+
private onKeyDown;
|
|
239
|
+
private onKeyUp;
|
|
240
|
+
private onMouseDown;
|
|
241
|
+
private onMouseUp;
|
|
242
|
+
private onMouseMove;
|
|
243
|
+
/** F2 — real window blur: drop focus and flush held state, mirroring
|
|
244
|
+
* `setEnabled(false)`'s flush (see `flushHeldState`), without touching the
|
|
245
|
+
* editor-driven `enabled` flag. */
|
|
246
|
+
private onWindowBlur;
|
|
247
|
+
/** F2 — real window focus regain. No flush needed (there's nothing held to
|
|
248
|
+
* flush — a fresh keydown/mousedown is required to register pressed
|
|
249
|
+
* again, exactly like re-enabling via `setEnabled(true)`). */
|
|
250
|
+
private onWindowFocus;
|
|
251
|
+
/** Clear all held/transient keyboard/mouse/touch-button state — shared by
|
|
252
|
+
* `setEnabled(false)` and real blur (`onWindowBlur`), so a key/button
|
|
253
|
+
* physically held when input is suspended doesn't linger. Level values
|
|
254
|
+
* (gamepad axes, touch sticks, injected test axes) are deliberately NOT
|
|
255
|
+
* flushed here — they are gated at READ time instead (see `inputActive`
|
|
256
|
+
* checks in `poll()`/the `collect*Contributions` methods), matching the
|
|
257
|
+
* pre-existing gamepad-axis convention. */
|
|
258
|
+
private flushHeldState;
|
|
259
|
+
constructor();
|
|
260
|
+
/**
|
|
261
|
+
* Load action map from a .inputmap.json file. Validated via
|
|
262
|
+
* `InputMapFileSchema` (T4.6) — a malformed input map throws a
|
|
263
|
+
* `SceneParseError` naming the file, not a deep TypeError once the bad
|
|
264
|
+
* data reaches `isPressed`/`isJustPressed`/`isJustReleased`.
|
|
265
|
+
*/
|
|
266
|
+
loadMap(url: string): Promise<void>;
|
|
267
|
+
/**
|
|
268
|
+
* F3 — `loadMap`'s synchronous, no-`fetch` sibling: apply an already-in-
|
|
269
|
+
* memory (or freshly-deserialized) input-map DOCUMENT, validated through
|
|
270
|
+
* the identical `InputMapFileSchema` (throws `SceneParseError` naming no
|
|
271
|
+
* file, matching `loadMap`'s error shape minus the URL). This is the other
|
|
272
|
+
* half of the F3 persist round-trip: `toInputMapFile()` serializes,
|
|
273
|
+
* `loadMapObject` re-applies — no network/file I/O required, so it's also
|
|
274
|
+
* how a headless test proves a rebind survives a save/reload cycle.
|
|
275
|
+
*/
|
|
276
|
+
loadMapObject(data: unknown): InputMapFile;
|
|
277
|
+
/** Shared apply step for `loadMap`/`loadMapObject`: copy each action's
|
|
278
|
+
* bindings + declared valueType into the live maps, and snapshot the
|
|
279
|
+
* bindings as that action's F3 reset-to-defaults baseline. */
|
|
280
|
+
private applyParsedMap;
|
|
281
|
+
/** Register an action programmatically. `valueType` declares the action's
|
|
282
|
+
* value shape (F1) — defaults to `'digital'`, matching every call site
|
|
283
|
+
* written before F1. F3 — also snapshots `bindings` as this action's
|
|
284
|
+
* reset-to-defaults baseline (see `resetBindings`). */
|
|
285
|
+
registerAction(name: string, bindings: InputBinding[], valueType?: ActionValueType): void;
|
|
286
|
+
/** The declared value type for a registered/loaded action (F1) — `'digital'`
|
|
287
|
+
* for an action that never specified one (including an unregistered/typo'd
|
|
288
|
+
* name — harmless, since every typed getter already treats an unknown
|
|
289
|
+
* action as inert). */
|
|
290
|
+
getActionValueType(actionName: string): ActionValueType;
|
|
291
|
+
/** Enforces the F1 type-safety AC: reading an action through a typed getter
|
|
292
|
+
* whose value type doesn't match the action's DECLARED `valueType` throws,
|
|
293
|
+
* naming both. Unknown actions (never registered/loaded) are exempt — they
|
|
294
|
+
* already read as inert/zeroed by every getter, matching pre-F1 behavior
|
|
295
|
+
* for a typo'd action name. */
|
|
296
|
+
private assertValueType;
|
|
297
|
+
/** The names of all registered actions (for the InputAdapter to enumerate). */
|
|
298
|
+
actionNames(): string[];
|
|
299
|
+
/** Poll gamepads and virtual look stick (call at start of frame) */
|
|
300
|
+
poll(): void;
|
|
301
|
+
/** Has a `gamepad_axis` binding's raw value crossed its direction+deadzone
|
|
302
|
+
* threshold (positive: `value > deadzone`; negative: `value < -deadzone`)? */
|
|
303
|
+
private static axisThresholdMet;
|
|
304
|
+
/** Is an action currently held down? */
|
|
305
|
+
isPressed(actionName: string): boolean;
|
|
306
|
+
/** Was an action pressed this frame (not held from previous)? */
|
|
307
|
+
isJustPressed(actionName: string): boolean;
|
|
308
|
+
/** Was an action released this frame (held last frame, up now)? */
|
|
309
|
+
isJustReleased(actionName: string): boolean;
|
|
310
|
+
/** Device/source metadata (F1 AC) for a digital action: which binding is
|
|
311
|
+
* CURRENTLY satisfying `isPressed`, or `null` if none is (including an
|
|
312
|
+
* unknown action). First-satisfied-binding-wins, mirroring isPressed's own
|
|
313
|
+
* iteration order. */
|
|
314
|
+
getDigitalSource(actionName: string): ActionValueSource | null;
|
|
315
|
+
/** 1D deadzone rescale: magnitudes below `deadzone` become 0; magnitudes
|
|
316
|
+
* at/above it rescale from 0 (at the deadzone edge) to ±1 (at |raw| = 1),
|
|
317
|
+
* sign preserved. `raw` is clamped to [-1, 1] first so an out-of-range
|
|
318
|
+
* input can't overshoot past ±1 the other end. */
|
|
319
|
+
private static rescaleScalar;
|
|
320
|
+
/** Radial deadzone + unit-circle normalization for a Vector2: magnitude
|
|
321
|
+
* below `deadzone` snaps to {0,0}; at/above it, direction is preserved and
|
|
322
|
+
* magnitude is rescaled the same way `rescaleScalar` rescales a 1D
|
|
323
|
+
* magnitude (never renormalized UP past 1 — only ever scaled down). */
|
|
324
|
+
private static rescaleVector2;
|
|
325
|
+
/** Clamp a Vector2's magnitude to at most 1 (unit circle), preserving
|
|
326
|
+
* direction — the second half of the vector2 "sum-then-clamp" combine
|
|
327
|
+
* rule (a diagonal sum like {0.8, 0.8} has magnitude > 1). */
|
|
328
|
+
private static clampVector2;
|
|
329
|
+
/** Every `scalar`-relevant binding's (deadzone-applied) contribution for
|
|
330
|
+
* `actionName`, one entry per binding that can produce a scalar value —
|
|
331
|
+
* `gamepad_axis` (real device, already implemented pre-F1 for digital
|
|
332
|
+
* thresholding — F1 additionally reads its raw signed value for scalar
|
|
333
|
+
* actions, ignoring the binding's `direction` field, which is a digital-
|
|
334
|
+
* only hint) and `test_axis` (F1's injected-test-input source). `mouse_move`
|
|
335
|
+
* deliberately does NOT feed scalar (spec §12 F2 — no natural single-axis
|
|
336
|
+
* selector field is defined for it; it feeds pointerDelta/vector2 only —
|
|
337
|
+
* see `collectPointerDeltaContributions`/`collectVector2Contributions`). */
|
|
338
|
+
private collectScalarContributions;
|
|
339
|
+
private computeScalar;
|
|
340
|
+
/** Read a `'scalar'`-valueType action's current value: max-magnitude across
|
|
341
|
+
* contributing (deadzone-applied) bindings, sign preserved (combine rule —
|
|
342
|
+
* see the class doc comment). Throws if the action is declared a
|
|
343
|
+
* different valueType. */
|
|
344
|
+
getScalar(actionName: string): number;
|
|
345
|
+
/** Device/source metadata for {@link getScalar} — which binding is
|
|
346
|
+
* currently driving the combined value, or `null` if every contribution is
|
|
347
|
+
* zero (including an unknown action). */
|
|
348
|
+
getScalarSource(actionName: string): ActionValueSource | null;
|
|
349
|
+
/** `gamepad_axis_pair` contribution(s) for {@link collectVector2Contributions} — one entry
|
|
350
|
+
* per connected gamepad, deadzone-rescaled (default 0.15, matching `gamepad_axis`). Broken
|
|
351
|
+
* out to a helper so the per-gamepad loop doesn't add to the main dispatcher's complexity. */
|
|
352
|
+
private contributeGamepadAxisPair;
|
|
353
|
+
/** Every `vector2`-relevant binding's (deadzone-applied) contribution:
|
|
354
|
+
* `test_vector2` (F1's injected-test-input source), plus F2's real-device
|
|
355
|
+
* cases — `gamepad_axis_pair` (see {@link contributeGamepadAxisPair}), `mouse_move` (the
|
|
356
|
+
* accumulated mouse delta, deadzone default 0 — raw pixel deltas have no natural "at rest"
|
|
357
|
+
* jitter floor the way an analog stick does), and `touch_stick` (a virtual on-screen stick,
|
|
358
|
+
* deadzone default 0). */
|
|
359
|
+
private collectVector2Contributions;
|
|
360
|
+
private computeVector2;
|
|
361
|
+
/** Read a `'vector2'`-valueType action's current value: sum contributing
|
|
362
|
+
* (deadzone-applied) {x,y} values component-wise, then clamp to the unit
|
|
363
|
+
* circle (combine rule — see the class doc comment). Throws if the action
|
|
364
|
+
* is declared a different valueType. */
|
|
365
|
+
getVector2(actionName: string): Vector2;
|
|
366
|
+
/** Device/source metadata for {@link getVector2} — the contributing binding
|
|
367
|
+
* with the largest (pre-combine) magnitude, or `null` if the combined
|
|
368
|
+
* value is {0,0} (including an unknown action). */
|
|
369
|
+
getVector2Source(actionName: string): ActionValueSource | null;
|
|
370
|
+
/** Every `pointerDelta`-relevant binding's contribution: `test_pointer_delta`
|
|
371
|
+
* (F1's injected-test-input source) and — F2 — `mouse_move`, reading the
|
|
372
|
+
* real accumulated `mouseDeltaX/Y` (the same accumulator `onMouseMove`
|
|
373
|
+
* fills and `getMouseDelta()` reads). No deadzone for either (deltas are
|
|
374
|
+
* not deadzoned). */
|
|
375
|
+
private collectPointerDeltaContributions;
|
|
376
|
+
private computePointerDelta;
|
|
377
|
+
/** Read a `'pointerDelta'`-valueType action's this-frame movement: sum of
|
|
378
|
+
* contributing bindings' deltas (combine rule — see the class doc
|
|
379
|
+
* comment). Throws if the action is declared a different valueType. */
|
|
380
|
+
getPointerDelta(actionName: string): Vector2;
|
|
381
|
+
/** Device/source metadata for {@link getPointerDelta}. */
|
|
382
|
+
getPointerDeltaSource(actionName: string): ActionValueSource | null;
|
|
383
|
+
/** Every `pointerPosition`-relevant binding's contribution, each tagged
|
|
384
|
+
* with the injection-order sequence number used to break ties (last-
|
|
385
|
+
* write-wins) — today only `test_pointer_position` (F1's injected-test-
|
|
386
|
+
* input source). */
|
|
387
|
+
private collectPointerPositionContributions;
|
|
388
|
+
private computePointerPosition;
|
|
389
|
+
/** Read a `'pointerPosition'`-valueType action's current absolute position:
|
|
390
|
+
* last-write-wins across contributing bindings (combine rule — see the
|
|
391
|
+
* class doc comment; position isn't additive, so it is never summed).
|
|
392
|
+
* Throws if the action is declared a different valueType. */
|
|
393
|
+
getPointerPosition(actionName: string): Vector2;
|
|
394
|
+
/** Device/source metadata for {@link getPointerPosition} — the most
|
|
395
|
+
* recently-written contributing source. */
|
|
396
|
+
getPointerPositionSource(actionName: string): ActionValueSource | null;
|
|
397
|
+
/** Generic typed read (F1): dispatches to the matching typed getter based
|
|
398
|
+
* on `expectedType`, returning `ActionValueOf<T>` — a caller with a
|
|
399
|
+
* statically-known action-value-type map gets a fully-inferred, non-`any`
|
|
400
|
+
* return type. Throws the same mismatch error as the dedicated getters if
|
|
401
|
+
* the action's declared valueType disagrees with `expectedType`. */
|
|
402
|
+
readAction<T extends ActionValueType>(actionName: string, expectedType: T): ActionValueOf<T>;
|
|
403
|
+
/** Inject a synthetic scalar value for a named test source (F1's injected-
|
|
404
|
+
* test-input hook — also the shape of F2's "injected test input" backend).
|
|
405
|
+
* Bind an action to `{ type: 'test_axis', sourceId }` (`valueType:
|
|
406
|
+
* 'scalar'`) to read it back via {@link getScalar}. The value PERSISTS
|
|
407
|
+
* across frames (like a real analog stick held in position) until changed
|
|
408
|
+
* or cleared via {@link clearAxis}. */
|
|
409
|
+
injectAxis(sourceId: string, value: number): void;
|
|
410
|
+
/** Clear an injected scalar source (e.g. simulating an at-rest/disconnected
|
|
411
|
+
* device). */
|
|
412
|
+
clearAxis(sourceId: string): void;
|
|
413
|
+
/** Inject a synthetic {x,y} value for a named test source. Bind an action
|
|
414
|
+
* to `{ type: 'test_vector2', sourceId }` (`valueType: 'vector2'`) to read
|
|
415
|
+
* it back via {@link getVector2}. Persists across frames until changed or
|
|
416
|
+
* cleared via {@link clearVector2}. */
|
|
417
|
+
injectVector2(sourceId: string, value: Vector2): void;
|
|
418
|
+
/** Clear an injected Vector2 source. */
|
|
419
|
+
clearVector2(sourceId: string): void;
|
|
420
|
+
/** Accumulate a synthetic pointer delta for a named test source — mirrors
|
|
421
|
+
* real mouse-move delta accumulation (`onMouseMove` above): multiple calls
|
|
422
|
+
* within the same frame sum, and the accumulator is cleared in
|
|
423
|
+
* {@link endFrame}. Bind an action to `{ type: 'test_pointer_delta',
|
|
424
|
+
* sourceId }` (`valueType: 'pointerDelta'`) to read it back via
|
|
425
|
+
* {@link getPointerDelta}. */
|
|
426
|
+
injectPointerDelta(sourceId: string, delta: Vector2): void;
|
|
427
|
+
/** Set a synthetic absolute pointer position for a named test source.
|
|
428
|
+
* Persists (last-write-wins across contributing sources on read — see the
|
|
429
|
+
* pointerPosition combine rule) until changed. Bind an action to `{ type:
|
|
430
|
+
* 'test_pointer_position', sourceId }` (`valueType: 'pointerPosition'`) to
|
|
431
|
+
* read it back via {@link getPointerPosition}. */
|
|
432
|
+
injectPointerPosition(sourceId: string, value: Vector2): void;
|
|
433
|
+
/** Whether input capture is currently enabled (see {@link setEnabled}). */
|
|
434
|
+
isEnabled(): boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Enable/disable input capture. The editor host disables the running game's
|
|
437
|
+
* input while its viewport isn't focused so keystrokes don't leak in from
|
|
438
|
+
* the editor. Disabling clears all held/transient keyboard/mouse/touch-button
|
|
439
|
+
* state (via {@link flushHeldState}) so nothing sticks (e.g. a held movement
|
|
440
|
+
* key when you switch back to the Scene tab mid-flight) — gamepad state
|
|
441
|
+
* doesn't need clearing here since `poll()` itself stops reading it while
|
|
442
|
+
* disabled (see poll()'s doc comment).
|
|
443
|
+
*/
|
|
444
|
+
setEnabled(enabled: boolean): void;
|
|
445
|
+
/** Whether the window/tab is currently focused (F2, spec §12 "focus
|
|
446
|
+
* gating") — `false` while blurred (real `blur`/`focus` events; see the
|
|
447
|
+
* constructor). Distinct from {@link isEnabled}, which is the editor's
|
|
448
|
+
* explicit play-mode gate. */
|
|
449
|
+
isFocused(): boolean;
|
|
450
|
+
/** Whether the pointer is currently locked to {@link requestPointerLock}'s
|
|
451
|
+
* element (F2, spec §12 "pointer lock") — tracked via the real
|
|
452
|
+
* `pointerlockchange` event. */
|
|
453
|
+
isPointerLocked(): boolean;
|
|
454
|
+
/** Device identity for a connected gamepad slot (F2, spec §12 "expose
|
|
455
|
+
* device identity" + "prefer the standard mapping"), or `null` if nothing
|
|
456
|
+
* is connected at `index` (including while input is disabled/unfocused,
|
|
457
|
+
* since `poll()` empties `this.gamepads` then). `mapping` is the Gamepad
|
|
458
|
+
* API's own `'standard'`/`''` value — bindings author button/axis indices
|
|
459
|
+
* assuming the W3C Standard Gamepad layout, so a non-`'standard'` mapping
|
|
460
|
+
* means those indices may not correspond as documented. */
|
|
461
|
+
getGamepadInfo(index: number): {
|
|
462
|
+
index: number;
|
|
463
|
+
id: string;
|
|
464
|
+
mapping: string;
|
|
465
|
+
connected: boolean;
|
|
466
|
+
} | null;
|
|
467
|
+
/** Get mouse movement delta this frame */
|
|
468
|
+
getMouseDelta(): {
|
|
469
|
+
x: number;
|
|
470
|
+
y: number;
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* F4 (spec §12 "Schema and Examples" — the F3 prompt-switching gap): which
|
|
474
|
+
* device family most recently produced real input, or `null` before any
|
|
475
|
+
* input has arrived. A prompt UI polls this (or lets {@link getPrompt}
|
|
476
|
+
* consult it automatically by omitting `device`) to switch its displayed
|
|
477
|
+
* label as the player switches controllers — e.g. showing `'Space'` while
|
|
478
|
+
* they're on keyboard, then `'A'` the moment they touch a gamepad.
|
|
479
|
+
*/
|
|
480
|
+
getLastActiveDevice(): PromptDevice | null;
|
|
481
|
+
/** The current bindings for `actionName` (F3 AC "listed") — a defensive
|
|
482
|
+
* deep clone, so mutating the returned array/objects never affects the
|
|
483
|
+
* live binding list. `[]` for an unknown/never-registered action. */
|
|
484
|
+
getBindings(actionName: string): InputBinding[];
|
|
485
|
+
/** Wholesale-replace `actionName`'s bindings array (F3 AC "replaced"). Does
|
|
486
|
+
* NOT touch the reset-to-defaults snapshot — see `resetBindings`. A no-op
|
|
487
|
+
* target for an action that was never registered is allowed (it simply
|
|
488
|
+
* registers one with `valueType: 'digital'`, matching `registerAction`'s
|
|
489
|
+
* own default) since a rebinding UI operates on actions it already knows
|
|
490
|
+
* about, but shouldn't have to special-case "brand new action" separately. */
|
|
491
|
+
setBindings(actionName: string, bindings: InputBinding[]): void;
|
|
492
|
+
/** Append one binding to `actionName` (F3 AC "added"). */
|
|
493
|
+
addBinding(actionName: string, binding: InputBinding): void;
|
|
494
|
+
/** Remove the binding at `index` from `actionName` (F3 AC "removed"). A
|
|
495
|
+
* no-op if the action is unknown or `index` is out of range (rather than
|
|
496
|
+
* throwing) — mirrors every other getter's "unknown action is inert"
|
|
497
|
+
* convention, so a UI doesn't need a separate existence check first. */
|
|
498
|
+
removeBinding(actionName: string, index: number): void;
|
|
499
|
+
/** Replace a single binding slot at `index` on `actionName` — the shape a
|
|
500
|
+
* rebinding UI actually wants ("rebind THIS control"), built on
|
|
501
|
+
* `getBindings`/`setBindings`. A no-op if the action is unknown or `index`
|
|
502
|
+
* is out of range. */
|
|
503
|
+
replaceBinding(actionName: string, index: number, binding: InputBinding): void;
|
|
504
|
+
/** Restore `actionName`'s bindings to the snapshot taken at
|
|
505
|
+
* `registerAction`/`loadMap`/`loadMapObject` time (F3 AC "reset"). A no-op
|
|
506
|
+
* for an action with no snapshot (never registered/loaded — there is no
|
|
507
|
+
* "default" to reset to). */
|
|
508
|
+
resetBindings(actionName: string): void;
|
|
509
|
+
/** Reset every action that has a snapshot back to its registered/loaded
|
|
510
|
+
* defaults. Convenience batch form of `resetBindings`. */
|
|
511
|
+
resetAllBindings(): void;
|
|
512
|
+
/**
|
|
513
|
+
* Whether `a` and `b` are the SAME physical input (F3's structural-conflict
|
|
514
|
+
* identity check — see `findConflicts`). Deliberately narrower than deep
|
|
515
|
+
* equality: `deadzone` never participates (two bindings on the same key
|
|
516
|
+
* with different deadzones are still the same physical control), and a
|
|
517
|
+
* `gamepad_axis`'s `direction` DOES participate — opposite directions of one
|
|
518
|
+
* physical axis (e.g. "accelerate" on positive, "brake" on negative) are a
|
|
519
|
+
* legitimate, non-conflicting pair, not a collision.
|
|
520
|
+
*/
|
|
521
|
+
private static bindingsCollide;
|
|
522
|
+
/**
|
|
523
|
+
* Every EXISTING binding, on every OTHER registered action, that is
|
|
524
|
+
* structurally the same physical input as `proposed` (F3 AC "conflicts are
|
|
525
|
+
* detected and returned structurally") — never throws, always a plain
|
|
526
|
+
* (possibly empty) array a rebinding UI inspects before committing a
|
|
527
|
+
* rebind. `excludeActionName` is normally the action being rebound itself
|
|
528
|
+
* (so an action isn't reported as conflicting with its own current
|
|
529
|
+
* binding when re-proposing an unchanged value).
|
|
530
|
+
*/
|
|
531
|
+
findConflicts(proposed: InputBinding, excludeActionName?: string): BindingConflict[];
|
|
532
|
+
/**
|
|
533
|
+
* Serialize every registered/loaded action back into the `.inputmap.json`
|
|
534
|
+
* document shape (F3 AC "persisted") — the exact `InputMapFile` shape
|
|
535
|
+
* `loadMap`/`loadMapObject` read, so `manager.loadMapObject(manager.toInputMapFile())`
|
|
536
|
+
* on a fresh instance reproduces the same live bindings. `version` is
|
|
537
|
+
* carried forward from the last loaded map when known, else `1` (a
|
|
538
|
+
* manager built purely via `registerAction` calls, never `loadMap`, has no
|
|
539
|
+
* file-format version to preserve).
|
|
540
|
+
*/
|
|
541
|
+
toInputMapFile(): InputMapFile;
|
|
542
|
+
/**
|
|
543
|
+
* Resolve a display prompt (F3 AC: labels/icons like `'Space'`, `'A'`, or a
|
|
544
|
+
* touch control's name) for whichever of `actionName`'s bindings belongs to
|
|
545
|
+
* the requested `device` family. `null` when the action has no binding for
|
|
546
|
+
* that device (including an unknown action). `gamepadIndex` (default 0)
|
|
547
|
+
* selects which connected pad's `mapping`/connected state to consult for a
|
|
548
|
+
* `gamepad_*` binding — see `getGamepadInfo`.
|
|
549
|
+
*
|
|
550
|
+
* F4 — `device` is now OPTIONAL: omit it (or pass `undefined`) to resolve
|
|
551
|
+
* against {@link getLastActiveDevice} instead (falling back to `'keyboard'`
|
|
552
|
+
* before any input has arrived), so a prompt UI that wants "show whatever
|
|
553
|
+
* the player is actually holding right now" doesn't have to track the
|
|
554
|
+
* active device itself — it can just call `getPrompt(actionName)` every
|
|
555
|
+
* frame and the label switches on its own as the player changes controllers.
|
|
556
|
+
* Passing an explicit `device` (as every pre-F4 caller does) is unaffected.
|
|
557
|
+
*/
|
|
558
|
+
getPrompt(actionName: string, device?: PromptDevice, gamepadIndex?: number): BindingPrompt | null;
|
|
559
|
+
/** Call at end of frame to clear per-frame state */
|
|
560
|
+
endFrame(): void;
|
|
561
|
+
/** Inject synthetic key state from touch controls */
|
|
562
|
+
setVirtualKey(code: string, pressed: boolean): void;
|
|
563
|
+
/** Set virtual look stick position (-1..1). Injected as mouse delta during poll(). */
|
|
564
|
+
setLookStick(x: number, y: number): void;
|
|
565
|
+
/** Inject synthetic mouse delta (e.g. from touch controls) */
|
|
566
|
+
addMouseDelta(dx: number, dy: number): void;
|
|
567
|
+
/**
|
|
568
|
+
* F2 (spec §12 "Complete Device Backends") — the touch/virtual-control
|
|
569
|
+
* digital backend. Set a named virtual button's (`sourceId` — a zone/knob
|
|
570
|
+
* id the touch UI chooses) pressed state; edge-tracked exactly like a real
|
|
571
|
+
* mouse button (`onMouseDown`/`onMouseUp` above) so `isJustPressed`/
|
|
572
|
+
* `isJustReleased` work for `{ type: 'touch_button', sourceId }` bindings.
|
|
573
|
+
* This is the injectable entry point a real on-screen button's own
|
|
574
|
+
* touchstart/touchend handler would call — that DOM wiring is a thin
|
|
575
|
+
* adapter at the edge (browser-verified separately); this method is the
|
|
576
|
+
* MAPPING logic, unit-tested headlessly with no DOM.
|
|
577
|
+
*/
|
|
578
|
+
setTouchButton(sourceId: string, pressed: boolean): void;
|
|
579
|
+
/**
|
|
580
|
+
* F2 — the touch/virtual-control analog backend. Set a named virtual
|
|
581
|
+
* stick's (`sourceId`) raw `{x,y}` position (e.g. -1..1 per axis, like a
|
|
582
|
+
* gamepad stick); read back via `getVector2` on a `{ type: 'touch_stick',
|
|
583
|
+
* sourceId }` binding, deadzone-rescaled the same way a gamepad stick is.
|
|
584
|
+
* Persists across frames (a level value, like a real analog stick held in
|
|
585
|
+
* position) until changed or cleared via {@link clearTouchStick}.
|
|
586
|
+
*/
|
|
587
|
+
setTouchStick(sourceId: string, value: Vector2): void;
|
|
588
|
+
/** Clear a virtual stick's value (e.g. simulating the touch point lifting —
|
|
589
|
+
* the knob returns to center). */
|
|
590
|
+
clearTouchStick(sourceId: string): void;
|
|
591
|
+
/** Request pointer lock for FPS-style mouse control */
|
|
592
|
+
requestPointerLock(element: HTMLElement): void;
|
|
593
|
+
/** Clean up event listeners */
|
|
594
|
+
dispose(): void;
|
|
595
|
+
}
|
|
596
|
+
//# sourceMappingURL=input-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-manager.d.ts","sourceRoot":"","sources":["../../src/input/input-manager.ts"],"names":[],"mappings":"AAEA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAqC;IAKpD,OAAO,CAAC,gBAAgB,CAAsC;IAM9D,OAA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