@codexo/exojs 0.7.12 → 0.8.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/CHANGELOG.md +737 -0
- package/dist/esm/core/Application.d.ts +3 -1
- package/dist/esm/core/Application.js +7 -6
- package/dist/esm/core/Application.js.map +1 -1
- package/dist/esm/core/Scene.d.ts +30 -0
- package/dist/esm/core/Scene.js +56 -0
- package/dist/esm/core/Scene.js.map +1 -1
- package/dist/esm/core/SceneManager.js +2 -2
- package/dist/esm/core/SceneManager.js.map +1 -1
- package/dist/esm/debug/DebugOverlay.js +2 -2
- package/dist/esm/debug/DebugOverlay.js.map +1 -1
- package/dist/esm/debug/PointerStackLayer.js +1 -1
- package/dist/esm/debug/PointerStackLayer.js.map +1 -1
- package/dist/esm/index.js +32 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/input/ArcadeStickGamepadMapping.js +18 -19
- package/dist/esm/input/ArcadeStickGamepadMapping.js.map +1 -1
- package/dist/esm/input/Gamepad.d.ts +164 -62
- package/dist/esm/input/Gamepad.js +290 -134
- package/dist/esm/input/Gamepad.js.map +1 -1
- package/dist/esm/input/GamepadAxis.d.ts +120 -0
- package/dist/esm/input/GamepadAxis.js +106 -0
- package/dist/esm/input/GamepadAxis.js.map +1 -0
- package/dist/esm/input/GamepadButton.d.ts +110 -0
- package/dist/esm/input/GamepadButton.js +99 -0
- package/dist/esm/input/GamepadButton.js.map +1 -0
- package/dist/esm/input/GamepadDefinitions.js +4 -0
- package/dist/esm/input/GamepadDefinitions.js.map +1 -1
- package/dist/esm/input/GamepadMapping.d.ts +28 -24
- package/dist/esm/input/GamepadMapping.js +33 -16
- package/dist/esm/input/GamepadMapping.js.map +1 -1
- package/dist/esm/input/GamepadPromptLayouts.d.ts +10 -8
- package/dist/esm/input/GamepadPromptLayouts.js +21 -20
- package/dist/esm/input/GamepadPromptLayouts.js.map +1 -1
- package/dist/esm/input/GenericDualAnalogGamepadMapping.d.ts +6 -3
- package/dist/esm/input/GenericDualAnalogGamepadMapping.js +55 -46
- package/dist/esm/input/GenericDualAnalogGamepadMapping.js.map +1 -1
- package/dist/esm/input/InputBinding.d.ts +74 -0
- package/dist/esm/input/InputBinding.js +100 -0
- package/dist/esm/input/InputBinding.js.map +1 -0
- package/dist/esm/input/InputManager.d.ts +79 -33
- package/dist/esm/input/InputManager.js +229 -104
- package/dist/esm/input/InputManager.js.map +1 -1
- package/dist/esm/input/InteractionManager.d.ts +1 -1
- package/dist/esm/input/InteractionManager.js +13 -13
- package/dist/esm/input/InteractionManager.js.map +1 -1
- package/dist/esm/input/JoyConLeftGamepadMapping.d.ts +14 -9
- package/dist/esm/input/JoyConLeftGamepadMapping.js +39 -9
- package/dist/esm/input/JoyConLeftGamepadMapping.js.map +1 -1
- package/dist/esm/input/JoyConRightGamepadMapping.d.ts +14 -9
- package/dist/esm/input/JoyConRightGamepadMapping.js +35 -9
- package/dist/esm/input/JoyConRightGamepadMapping.js.map +1 -1
- package/dist/esm/input/Pointer.d.ts +84 -71
- package/dist/esm/input/Pointer.js +71 -71
- package/dist/esm/input/Pointer.js.map +1 -1
- package/dist/esm/input/SteamDeckGamepadMapping.d.ts +18 -0
- package/dist/esm/input/SteamDeckGamepadMapping.js +76 -0
- package/dist/esm/input/SteamDeckGamepadMapping.js.map +1 -0
- package/dist/esm/input/index.d.ts +7 -4
- package/dist/esm/input/types.d.ts +0 -76
- package/dist/esm/input/types.js +1 -80
- package/dist/esm/input/types.js.map +1 -1
- package/dist/esm/particles/ParticleSystem.d.ts +180 -83
- package/dist/esm/particles/ParticleSystem.js +446 -133
- package/dist/esm/particles/ParticleSystem.js.map +1 -1
- package/dist/esm/particles/distributions/BoxArea.d.ts +17 -0
- package/dist/esm/particles/distributions/BoxArea.js +48 -0
- package/dist/esm/particles/distributions/BoxArea.js.map +1 -0
- package/dist/esm/particles/distributions/CircleArea.d.ts +19 -0
- package/dist/esm/particles/distributions/CircleArea.js +33 -0
- package/dist/esm/particles/distributions/CircleArea.js.map +1 -0
- package/dist/esm/particles/distributions/ConeDirection.d.ts +28 -0
- package/dist/esm/particles/distributions/ConeDirection.js +44 -0
- package/dist/esm/particles/distributions/ConeDirection.js.map +1 -0
- package/dist/esm/particles/distributions/Constant.d.ts +17 -0
- package/dist/esm/particles/distributions/Constant.js +35 -0
- package/dist/esm/particles/distributions/Constant.js.map +1 -0
- package/dist/esm/particles/distributions/Curve.d.ts +30 -0
- package/dist/esm/particles/distributions/Curve.js +53 -0
- package/dist/esm/particles/distributions/Curve.js.map +1 -0
- package/dist/esm/particles/distributions/Distribution.d.ts +45 -0
- package/dist/esm/particles/distributions/Gradient.d.ts +40 -0
- package/dist/esm/particles/distributions/Gradient.js +72 -0
- package/dist/esm/particles/distributions/Gradient.js.map +1 -0
- package/dist/esm/particles/distributions/LineSegment.d.ts +15 -0
- package/dist/esm/particles/distributions/LineSegment.js +27 -0
- package/dist/esm/particles/distributions/LineSegment.js.map +1 -0
- package/dist/esm/particles/distributions/Range.d.ts +12 -0
- package/dist/esm/particles/distributions/Range.js +19 -0
- package/dist/esm/particles/distributions/Range.js.map +1 -0
- package/dist/esm/particles/distributions/VectorRange.d.ts +20 -0
- package/dist/esm/particles/distributions/VectorRange.js +31 -0
- package/dist/esm/particles/distributions/VectorRange.js.map +1 -0
- package/dist/esm/particles/distributions/index.d.ts +12 -0
- package/dist/esm/particles/gpu/ParticleGpuState.d.ts +57 -0
- package/dist/esm/particles/gpu/ParticleGpuState.js +508 -0
- package/dist/esm/particles/gpu/ParticleGpuState.js.map +1 -0
- package/dist/esm/particles/index.d.ts +2 -10
- package/dist/esm/particles/modules/AlphaFadeOverLifetime.d.ts +24 -0
- package/dist/esm/particles/modules/AlphaFadeOverLifetime.js +60 -0
- package/dist/esm/particles/modules/AlphaFadeOverLifetime.js.map +1 -0
- package/dist/esm/particles/modules/ApplyForce.d.ts +20 -0
- package/dist/esm/particles/modules/ApplyForce.js +48 -0
- package/dist/esm/particles/modules/ApplyForce.js.map +1 -0
- package/dist/esm/particles/modules/AttractToPoint.d.ts +27 -0
- package/dist/esm/particles/modules/AttractToPoint.js +73 -0
- package/dist/esm/particles/modules/AttractToPoint.js.map +1 -0
- package/dist/esm/particles/modules/BurstSpawn.d.ts +53 -0
- package/dist/esm/particles/modules/BurstSpawn.js +94 -0
- package/dist/esm/particles/modules/BurstSpawn.js.map +1 -0
- package/dist/esm/particles/modules/ColorOverLifetime.d.ts +22 -0
- package/dist/esm/particles/modules/ColorOverLifetime.js +65 -0
- package/dist/esm/particles/modules/ColorOverLifetime.js.map +1 -0
- package/dist/esm/particles/modules/ColorOverSpeed.d.ts +27 -0
- package/dist/esm/particles/modules/ColorOverSpeed.js +86 -0
- package/dist/esm/particles/modules/ColorOverSpeed.js.map +1 -0
- package/dist/esm/particles/modules/DeathModule.d.ts +24 -0
- package/dist/esm/particles/modules/DeathModule.js +25 -0
- package/dist/esm/particles/modules/DeathModule.js.map +1 -0
- package/dist/esm/particles/modules/Drag.d.ts +20 -0
- package/dist/esm/particles/modules/Drag.js +45 -0
- package/dist/esm/particles/modules/Drag.js.map +1 -0
- package/dist/esm/particles/modules/OrbitalForce.d.ts +28 -0
- package/dist/esm/particles/modules/OrbitalForce.js +65 -0
- package/dist/esm/particles/modules/OrbitalForce.js.map +1 -0
- package/dist/esm/particles/modules/RateSpawn.d.ts +41 -0
- package/dist/esm/particles/modules/RateSpawn.js +76 -0
- package/dist/esm/particles/modules/RateSpawn.js.map +1 -0
- package/dist/esm/particles/modules/RepelFromPoint.d.ts +24 -0
- package/dist/esm/particles/modules/RepelFromPoint.js +76 -0
- package/dist/esm/particles/modules/RepelFromPoint.js.map +1 -0
- package/dist/esm/particles/modules/RotateOverLifetime.d.ts +20 -0
- package/dist/esm/particles/modules/RotateOverLifetime.js +43 -0
- package/dist/esm/particles/modules/RotateOverLifetime.js.map +1 -0
- package/dist/esm/particles/modules/ScaleOverLifetime.d.ts +26 -0
- package/dist/esm/particles/modules/ScaleOverLifetime.js +59 -0
- package/dist/esm/particles/modules/ScaleOverLifetime.js.map +1 -0
- package/dist/esm/particles/modules/SpawnModule.d.ts +30 -0
- package/dist/esm/particles/modules/SpawnModule.js +31 -0
- package/dist/esm/particles/modules/SpawnModule.js.map +1 -0
- package/dist/esm/particles/modules/SpawnOnDeath.d.ts +24 -0
- package/dist/esm/particles/modules/SpawnOnDeath.js +47 -0
- package/dist/esm/particles/modules/SpawnOnDeath.js.map +1 -0
- package/dist/esm/particles/modules/Turbulence.d.ts +30 -0
- package/dist/esm/particles/modules/Turbulence.js +122 -0
- package/dist/esm/particles/modules/Turbulence.js.map +1 -0
- package/dist/esm/particles/modules/UpdateModule.d.ts +95 -0
- package/dist/esm/particles/modules/UpdateModule.js +66 -0
- package/dist/esm/particles/modules/UpdateModule.js.map +1 -0
- package/dist/esm/particles/modules/VelocityOverLifetime.d.ts +30 -0
- package/dist/esm/particles/modules/VelocityOverLifetime.js +84 -0
- package/dist/esm/particles/modules/VelocityOverLifetime.js.map +1 -0
- package/dist/esm/particles/modules/WgslContribution.d.ts +81 -0
- package/dist/esm/particles/modules/WgslContribution.js +34 -0
- package/dist/esm/particles/modules/WgslContribution.js.map +1 -0
- package/dist/esm/particles/modules/index.d.ts +22 -0
- package/dist/esm/rendering/webgl2/WebGl2ParticleRenderer.d.ts +9 -14
- package/dist/esm/rendering/webgl2/WebGl2ParticleRenderer.js +90 -61
- package/dist/esm/rendering/webgl2/WebGl2ParticleRenderer.js.map +1 -1
- package/dist/esm/rendering/webgl2/glsl/particle.vert.js +1 -1
- package/dist/esm/rendering/webgpu/WebGpuParticleRenderer.d.ts +9 -0
- package/dist/esm/rendering/webgpu/WebGpuParticleRenderer.js +107 -23
- package/dist/esm/rendering/webgpu/WebGpuParticleRenderer.js.map +1 -1
- package/dist/esm/rendering/webgpu/compute/WebGpuComputePipeline.d.ts +52 -0
- package/dist/esm/rendering/webgpu/compute/WebGpuStorageBuffer.d.ts +29 -0
- package/dist/esm/rendering/webgpu/compute/index.d.ts +3 -0
- package/dist/esm/resources/CacheFirstStrategy.d.ts +7 -4
- package/dist/esm/resources/CacheFirstStrategy.js +11 -8
- package/dist/esm/resources/CacheFirstStrategy.js.map +1 -1
- package/dist/esm/resources/CacheStrategy.d.ts +14 -6
- package/dist/esm/resources/Loader.d.ts +8 -3
- package/dist/esm/resources/Loader.js +19 -37
- package/dist/esm/resources/Loader.js.map +1 -1
- package/dist/esm/resources/NetworkOnlyStrategy.d.ts +3 -0
- package/dist/esm/resources/NetworkOnlyStrategy.js +8 -3
- package/dist/esm/resources/NetworkOnlyStrategy.js.map +1 -1
- package/dist/esm/resources/factories/ImageFactory.d.ts +2 -2
- package/dist/esm/resources/factories/ImageFactory.js.map +1 -1
- package/dist/esm/resources/factories/TextureFactory.d.ts +2 -2
- package/dist/esm/resources/factories/TextureFactory.js.map +1 -1
- package/dist/esm/resources/factories/VttFactory.d.ts +3 -3
- package/dist/esm/resources/factories/VttFactory.js +83 -6
- package/dist/esm/resources/factories/VttFactory.js.map +1 -1
- package/dist/exo.esm.js +4028 -1518
- package/dist/exo.esm.js.map +1 -1
- package/package.json +2 -1
- package/dist/esm/input/GamepadChannels.d.ts +0 -47
- package/dist/esm/input/GamepadChannels.js +0 -53
- package/dist/esm/input/GamepadChannels.js.map +0 -1
- package/dist/esm/input/GamepadControl.d.ts +0 -33
- package/dist/esm/input/GamepadControl.js +0 -42
- package/dist/esm/input/GamepadControl.js.map +0 -1
- package/dist/esm/input/Input.d.ts +0 -52
- package/dist/esm/input/Input.js +0 -90
- package/dist/esm/input/Input.js.map +0 -1
- package/dist/esm/particles/Particle.d.ts +0 -77
- package/dist/esm/particles/Particle.js +0 -143
- package/dist/esm/particles/Particle.js.map +0 -1
- package/dist/esm/particles/ParticleProperties.d.ts +0 -29
- package/dist/esm/particles/affectors/ColorAffector.d.ts +0 -30
- package/dist/esm/particles/affectors/ColorAffector.js +0 -55
- package/dist/esm/particles/affectors/ColorAffector.js.map +0 -1
- package/dist/esm/particles/affectors/ForceAffector.d.ts +0 -24
- package/dist/esm/particles/affectors/ForceAffector.js +0 -39
- package/dist/esm/particles/affectors/ForceAffector.js.map +0 -1
- package/dist/esm/particles/affectors/ParticleAffector.d.ts +0 -19
- package/dist/esm/particles/affectors/ScaleAffector.d.ts +0 -23
- package/dist/esm/particles/affectors/ScaleAffector.js +0 -38
- package/dist/esm/particles/affectors/ScaleAffector.js.map +0 -1
- package/dist/esm/particles/affectors/TorqueAffector.d.ts +0 -23
- package/dist/esm/particles/affectors/TorqueAffector.js +0 -37
- package/dist/esm/particles/affectors/TorqueAffector.js.map +0 -1
- package/dist/esm/particles/emitters/ParticleEmitter.d.ts +0 -19
- package/dist/esm/particles/emitters/ParticleOptions.d.ts +0 -62
- package/dist/esm/particles/emitters/ParticleOptions.js +0 -120
- package/dist/esm/particles/emitters/ParticleOptions.js.map +0 -1
- package/dist/esm/particles/emitters/UniversalEmitter.d.ts +0 -40
- package/dist/esm/particles/emitters/UniversalEmitter.js +0 -68
- package/dist/esm/particles/emitters/UniversalEmitter.js.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Signal } from '@/core/Signal';
|
|
2
|
-
import
|
|
2
|
+
import { InputBinding } from './InputBinding';
|
|
3
|
+
import type { GamepadAxis } from './GamepadAxis';
|
|
4
|
+
import type { GamepadButton } from './GamepadButton';
|
|
5
|
+
import type { GamepadButtonChannel } from './GamepadButton';
|
|
6
|
+
import type { GamepadAxisChannel } from './GamepadAxis';
|
|
3
7
|
import type { BrowserGamepad, ResolvedGamepadDefinition } from './GamepadDefinitions';
|
|
4
8
|
import type { GamepadMappingFamily, GamepadMapping } from './GamepadMapping';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Populated from a {@link ResolvedGamepadDefinition} on connect and available
|
|
8
|
-
* through the matching getters on {@link Gamepad}.
|
|
9
|
-
*/
|
|
9
|
+
import type { InputBindingOptions, InputChannel } from './InputBinding';
|
|
10
|
+
/** Identity metadata for a connected gamepad. Populated from a {@link ResolvedGamepadDefinition}. */
|
|
10
11
|
export interface GamepadInfo {
|
|
11
12
|
name: string;
|
|
12
13
|
label: string;
|
|
@@ -14,80 +15,181 @@ export interface GamepadInfo {
|
|
|
14
15
|
productId: string | null;
|
|
15
16
|
productKey: string | null;
|
|
16
17
|
}
|
|
18
|
+
/** Effect parameters for {@link Gamepad.vibrate}. */
|
|
19
|
+
export interface GamepadVibrationOptions {
|
|
20
|
+
/** Duration in milliseconds. */
|
|
21
|
+
duration: number;
|
|
22
|
+
/** Low-frequency rumble intensity 0..1. Default 1. */
|
|
23
|
+
weakMagnitude?: number;
|
|
24
|
+
/** High-frequency rumble intensity 0..1. Default 1. */
|
|
25
|
+
strongMagnitude?: number;
|
|
26
|
+
/** Delay before rumble starts in ms. Default 0. */
|
|
27
|
+
startDelay?: number;
|
|
28
|
+
}
|
|
17
29
|
/**
|
|
18
|
-
*
|
|
30
|
+
* One of four stable gamepad slots. Lives for the entire `Application`
|
|
31
|
+
* lifetime even when no physical pad is attached — a "mailbox" that
|
|
32
|
+
* physical hardware moves into and out of.
|
|
19
33
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* {@link
|
|
24
|
-
*
|
|
34
|
+
* Subscribe to {@link onConnect} / {@link onDisconnect} for hardware
|
|
35
|
+
* lifecycle, {@link onButtonDown} / {@link onButtonUp} / {@link onAxisChange}
|
|
36
|
+
* for granular per-event notifications, or call {@link onTrigger} /
|
|
37
|
+
* {@link onActive} / {@link onStart} / {@link onStop} to register
|
|
38
|
+
* stateful {@link InputBinding}s pinned to this slot.
|
|
39
|
+
*
|
|
40
|
+
* Listeners survive disconnect/reconnect cycles — a binding registered when
|
|
41
|
+
* the slot was empty will automatically activate when a pad connects.
|
|
25
42
|
*/
|
|
26
43
|
export declare class Gamepad {
|
|
27
|
-
|
|
28
|
-
readonly
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
/** Fires when a physical pad connects to this slot. */
|
|
45
|
+
readonly onConnect: Signal<[]>;
|
|
46
|
+
/** Fires when the physical pad in this slot disconnects. */
|
|
47
|
+
readonly onDisconnect: Signal<[]>;
|
|
48
|
+
/** Fires for every button transition from inactive to active. */
|
|
49
|
+
readonly onButtonDown: Signal<[GamepadButton, number]>;
|
|
50
|
+
/** Fires for every button transition from active to inactive. */
|
|
51
|
+
readonly onButtonUp: Signal<[GamepadButton, number]>;
|
|
52
|
+
/** Fires whenever an axis crosses its activation threshold. */
|
|
53
|
+
readonly onAxisChange: Signal<[GamepadAxis, number]>;
|
|
54
|
+
/**
|
|
55
|
+
* Fires when this slot's physical pad has been replaced by a previously
|
|
56
|
+
* higher-numbered slot's pad, after a `'compact'`-strategy disconnect.
|
|
57
|
+
* Dispatched with the source slot index the pad came from. Listeners
|
|
58
|
+
* remain attached and the channel buffer is preserved across the move.
|
|
59
|
+
*/
|
|
60
|
+
readonly onPadReassigned: Signal<[fromSlot: 0 | 1 | 2 | 3]>;
|
|
61
|
+
private readonly _slot;
|
|
62
|
+
private readonly _channels;
|
|
63
|
+
private readonly _bindings;
|
|
64
|
+
private readonly _detacher;
|
|
65
|
+
private readonly _channelOffset;
|
|
66
|
+
private _mapping;
|
|
67
|
+
private _info;
|
|
68
|
+
private _browserGamepad;
|
|
69
|
+
constructor(slot: 0 | 1 | 2 | 3, channels: Float32Array);
|
|
70
|
+
/** This pad's stable slot (0..3). */
|
|
71
|
+
get slot(): 0 | 1 | 2 | 3;
|
|
72
|
+
/** `true` while a physical pad is attached to this slot. */
|
|
46
73
|
get connected(): boolean;
|
|
47
|
-
|
|
48
|
-
get
|
|
49
|
-
|
|
50
|
-
get
|
|
51
|
-
|
|
74
|
+
/** The active mapping, or `null` when disconnected. */
|
|
75
|
+
get mapping(): GamepadMapping | null;
|
|
76
|
+
/** The {@link GamepadMappingFamily}, or `null` when disconnected. */
|
|
77
|
+
get mappingFamily(): GamepadMappingFamily | null;
|
|
78
|
+
/** Identity metadata, or `null` when disconnected. */
|
|
79
|
+
get info(): GamepadInfo | null;
|
|
80
|
+
/** The underlying browser gamepad object, or `null` when disconnected. */
|
|
81
|
+
get browserGamepad(): BrowserGamepad | null;
|
|
82
|
+
/**
|
|
83
|
+
* Browser-assigned hardware index from `navigator.getGamepads()` (i.e.
|
|
84
|
+
* `Gamepad.index`), or `null` when no pad is attached. Stable for the
|
|
85
|
+
* lifetime of a single physical connection but may change across
|
|
86
|
+
* disconnect/reconnect. Low-level escape hatch for advanced consumers
|
|
87
|
+
* that need to correlate slots with the raw browser API; prefer
|
|
88
|
+
* {@link slot} for stable per-application pad identity.
|
|
89
|
+
*/
|
|
90
|
+
get internalIndex(): number | null;
|
|
91
|
+
/** `true` when the connected pad supports rumble via the Web Gamepad API. */
|
|
92
|
+
get canVibrate(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Returns `true` when this pad's mapping declares the requested channel.
|
|
95
|
+
* Use to gate listener registration on optional hardware (e.g. Joy-Con
|
|
96
|
+
* solo lacks a right stick — `pad.hasChannel(GamepadAxis.RightStickX)`
|
|
97
|
+
* returns `false`).
|
|
98
|
+
*/
|
|
99
|
+
hasChannel(channel: GamepadButtonChannel | GamepadAxisChannel): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Trigger a rumble effect on this pad. Resolves when the effect finishes.
|
|
102
|
+
* Silent no-op when the pad is disconnected or the platform does not
|
|
103
|
+
* support haptic feedback. Use {@link canVibrate} to detect support.
|
|
104
|
+
*/
|
|
105
|
+
vibrate(options: GamepadVibrationOptions): Promise<void>;
|
|
106
|
+
/** Stop any active rumble on this pad. Silent no-op when unsupported. */
|
|
107
|
+
stopVibration(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Register a callback fired once when any of `channels` becomes active.
|
|
110
|
+
* Listener survives disconnect/reconnect; call `.unbind()` on the
|
|
111
|
+
* returned {@link InputBinding} to detach.
|
|
112
|
+
*/
|
|
113
|
+
onStart(channel: InputChannel | ReadonlyArray<InputChannel>, callback: (value: number) => void, options?: InputBindingOptions): InputBinding;
|
|
114
|
+
/**
|
|
115
|
+
* Register a callback fired every frame while any of `channels` is active.
|
|
116
|
+
* Receives the channel value (0..1 for buttons, -1..1 for bipolar axes).
|
|
117
|
+
*/
|
|
118
|
+
onActive(channel: InputChannel | ReadonlyArray<InputChannel>, callback: (value: number) => void, options?: InputBindingOptions): InputBinding;
|
|
119
|
+
/** Register a callback fired once when all of `channels` become inactive. */
|
|
120
|
+
onStop(channel: InputChannel | ReadonlyArray<InputChannel>, callback: (value: number) => void, options?: InputBindingOptions): InputBinding;
|
|
121
|
+
/**
|
|
122
|
+
* Register a callback fired when the input is released within
|
|
123
|
+
* {@link InputBindingOptions.threshold} ms of activation (a "tap").
|
|
124
|
+
*/
|
|
125
|
+
onTrigger(channel: InputChannel | ReadonlyArray<InputChannel>, callback: (value: number) => void, options?: InputBindingOptions): InputBinding;
|
|
126
|
+
/**
|
|
127
|
+
* Attach a physical browser gamepad to this slot. Called by
|
|
128
|
+
* {@link InputManager} on connect.
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
_bind(gamepad: BrowserGamepad, definition: ResolvedGamepadDefinition): void;
|
|
133
|
+
/**
|
|
134
|
+
* Detach the physical gamepad and clear its channels.
|
|
135
|
+
*
|
|
136
|
+
* @internal
|
|
137
|
+
*/
|
|
138
|
+
_unbind(): void;
|
|
52
139
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
140
|
+
* Detach the physical gamepad and clear channels without firing
|
|
141
|
+
* {@link onDisconnect}. Used by {@link InputManager} during the compact
|
|
142
|
+
* slot-shift to silently vacate a slot before another pad shifts into
|
|
143
|
+
* its place; the disconnect signal is fired separately on the slot that
|
|
144
|
+
* ends up empty after compaction.
|
|
145
|
+
*
|
|
146
|
+
* @internal
|
|
56
147
|
*/
|
|
57
|
-
|
|
148
|
+
_silentUnbind(): void;
|
|
58
149
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
150
|
+
* Dispatch this slot's {@link onDisconnect} signal without altering its
|
|
151
|
+
* state. Used by {@link InputManager} after a compact-mode shift, when a
|
|
152
|
+
* slot has already been emptied by {@link _rebindFrom} and now needs to
|
|
153
|
+
* notify subscribers that its mailbox is no longer occupied.
|
|
154
|
+
*
|
|
155
|
+
* @internal
|
|
61
156
|
*/
|
|
62
|
-
|
|
157
|
+
_dispatchDisconnect(): void;
|
|
63
158
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
159
|
+
* Reassign this slot to take over another slot's physical gamepad without
|
|
160
|
+
* firing the full disconnect / connect cycle. Used by {@link InputManager}
|
|
161
|
+
* when the `'compact'` slot strategy shuffles pads after a disconnect.
|
|
162
|
+
*
|
|
163
|
+
* @internal
|
|
66
164
|
*/
|
|
67
|
-
|
|
165
|
+
_rebindFrom(other: Gamepad): void;
|
|
68
166
|
/**
|
|
69
|
-
*
|
|
70
|
-
* into the shared channel buffer, dispatching
|
|
71
|
-
*
|
|
72
|
-
* No-op when disconnected.
|
|
167
|
+
* Sample the browser gamepad's current state and write transformed values
|
|
168
|
+
* into the shared channel buffer, dispatching transition events when
|
|
169
|
+
* channel activity crosses thresholds. Called once per frame by the
|
|
170
|
+
* engine's input loop. No-op when disconnected.
|
|
171
|
+
*
|
|
172
|
+
* @internal
|
|
73
173
|
*/
|
|
74
|
-
update():
|
|
75
|
-
/** Zeroes all channel buffer entries that belong to this gamepad's mapping. */
|
|
76
|
-
clearChannels(): this;
|
|
174
|
+
update(): void;
|
|
77
175
|
/**
|
|
78
|
-
*
|
|
79
|
-
* The instance must not be used after this call.
|
|
176
|
+
* Tear down this gamepad slot. Called on application shutdown.
|
|
80
177
|
*/
|
|
81
178
|
destroy(): void;
|
|
82
179
|
/**
|
|
83
|
-
*
|
|
84
|
-
* buffer for this
|
|
180
|
+
* Convert a slot-relative channel value to its absolute index in the
|
|
181
|
+
* shared channel buffer for this slot.
|
|
85
182
|
*/
|
|
86
|
-
resolveChannelOffset(channel:
|
|
183
|
+
resolveChannelOffset(channel: GamepadButtonChannel | GamepadAxisChannel): number;
|
|
87
184
|
/**
|
|
88
|
-
*
|
|
89
|
-
* channel
|
|
185
|
+
* Static counterpart to {@link Gamepad.resolveChannelOffset} — resolves
|
|
186
|
+
* an absolute channel-buffer offset for a given slot index without
|
|
187
|
+
* requiring a Gamepad instance.
|
|
90
188
|
*/
|
|
91
|
-
static resolveChannelOffset(
|
|
92
|
-
private
|
|
189
|
+
static resolveChannelOffset(slot: number, channel: GamepadButtonChannel | GamepadAxisChannel): number;
|
|
190
|
+
private _resolveOffset;
|
|
191
|
+
private _clearMappedChannels;
|
|
192
|
+
private _createBinding;
|
|
193
|
+
private _resolveExternalChannel;
|
|
194
|
+
private _updateBindings;
|
|
93
195
|
}
|