@rive-app/webgl2-threads 2.47.1 → 2.48.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/package.json +1 -1
- package/rive.d.ts +29 -1
- package/rive.js +672 -207
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +10 -0
- package/rive_fallback.wasm +0 -0
- package/rive_threads.wasm +0 -0
- package/utils/gamepadBatchEncoder.d.ts +51 -0
- package/utils/gamepadInteractions.d.ts +25 -0
- package/utils/index.d.ts +1 -0
package/rive.wasm
CHANGED
|
Binary file
|
package/rive_advanced.mjs.d.ts
CHANGED
|
@@ -1200,6 +1200,16 @@ export declare class StateMachineInstance {
|
|
|
1200
1200
|
*/
|
|
1201
1201
|
textInput(text: string): boolean;
|
|
1202
1202
|
|
|
1203
|
+
/**
|
|
1204
|
+
* Submit one frame of gamepad input encoded in the v2 wire format
|
|
1205
|
+
* (see rive-runtime/include/rive/input/gamepad_batch.hpp). Events route to the primary focus
|
|
1206
|
+
* node and bubble up its ancestors; with nothing focused, only scripted drawables receive them.
|
|
1207
|
+
* @param batch - little-endian v2 batch of connected/update/disconnected records
|
|
1208
|
+
* @returns false if the batch was rejected (bad version, malformed record, unknown device,
|
|
1209
|
+
* or no focus manager)
|
|
1210
|
+
*/
|
|
1211
|
+
submitGamepadsFromBuffer(batch: Uint8Array): boolean;
|
|
1212
|
+
|
|
1203
1213
|
/**
|
|
1204
1214
|
* The selected text of the focused element, or an empty string when nothing with a
|
|
1205
1215
|
* selection is focused. Used to fill the clipboard on copy/cut. An obscured field
|
package/rive_fallback.wasm
CHANGED
|
Binary file
|
package/rive_threads.wasm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Must match `rive::kGamepadBatchWireVersion` (runtime/include/rive/input/gamepad_batch.hpp). */
|
|
2
|
+
export declare const GAMEPAD_BATCH_VERSION = 2;
|
|
3
|
+
export declare const GAMEPAD_MAX_BUTTONS = 32;
|
|
4
|
+
export declare const GAMEPAD_MAX_AXES = 16;
|
|
5
|
+
/** C++ `rive::GamepadRecordType`. */
|
|
6
|
+
export declare enum GamepadRecordType {
|
|
7
|
+
Connected = 0,
|
|
8
|
+
Update = 1,
|
|
9
|
+
Disconnected = 2
|
|
10
|
+
}
|
|
11
|
+
/** C++ `rive::GamepadInputChangeKind`. */
|
|
12
|
+
export declare enum GamepadChangeKind {
|
|
13
|
+
Button = 0,
|
|
14
|
+
Axis = 1
|
|
15
|
+
}
|
|
16
|
+
/** C++ `rive::GamepadMappingKind`. */
|
|
17
|
+
export declare enum GamepadMappingKind {
|
|
18
|
+
Standard = 0,
|
|
19
|
+
Unknown = 1
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Builds buffer to send to the state machine for gamepad input connection/updates/disconnect.
|
|
23
|
+
*
|
|
24
|
+
* Each `update` record carries a single change: the core
|
|
25
|
+
* applies and dispatches records in order, so N single-change records in one batch behave like
|
|
26
|
+
* N separate submits.
|
|
27
|
+
*
|
|
28
|
+
* `end()` returns a view into a reused scratch buffer, valid until the next `begin()`.
|
|
29
|
+
*/
|
|
30
|
+
export declare class GamepadBatchEncoder {
|
|
31
|
+
private buffer;
|
|
32
|
+
private view;
|
|
33
|
+
private bytes;
|
|
34
|
+
private offset;
|
|
35
|
+
constructor(initialCapacity?: number);
|
|
36
|
+
begin(): void;
|
|
37
|
+
/** True when no records were written since `begin()`. */
|
|
38
|
+
get isEmpty(): boolean;
|
|
39
|
+
/** Set up buffer size/initialized values for a connected device */
|
|
40
|
+
connected(deviceId: number, mapping: GamepadMappingKind, buttonValues: ArrayLike<number>, axes: ArrayLike<number>): void;
|
|
41
|
+
/** */
|
|
42
|
+
update(deviceId: number, kind: GamepadChangeKind, index: number, value: number): void;
|
|
43
|
+
disconnected(deviceId: number): void;
|
|
44
|
+
end(): Uint8Array;
|
|
45
|
+
/** ---------------- Helper/private methods ---------------- */
|
|
46
|
+
private writeU8;
|
|
47
|
+
private writeU32;
|
|
48
|
+
private writeI32;
|
|
49
|
+
private writeF32;
|
|
50
|
+
private ensure;
|
|
51
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as rc from "../rive_advanced.mjs";
|
|
2
|
+
export interface GamepadInteractionsParams {
|
|
3
|
+
/** Hold button/axis input at rest unless DOM focus is within the canvas/overlay. Pads still connect. */
|
|
4
|
+
requireFocus: boolean;
|
|
5
|
+
isFocusWithin: () => boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Per-Rive-instance gamepad bridge driving a single state machine. Tracks what that state
|
|
9
|
+
* machine has been sent and submits only the difference, so after a pause it catches up
|
|
10
|
+
* without duplicate connected events.
|
|
11
|
+
*/
|
|
12
|
+
export declare class GamepadInteractions {
|
|
13
|
+
private params;
|
|
14
|
+
private encoder;
|
|
15
|
+
private stateMachine;
|
|
16
|
+
private lastSentPads;
|
|
17
|
+
private submitFailures;
|
|
18
|
+
constructor(params: GamepadInteractionsParams);
|
|
19
|
+
/** Poll, diff and submit one batch. Call once per frame before advancing. */
|
|
20
|
+
handleGamepadInputs(time: number, stateMachine: rc.StateMachineInstance | undefined): void;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
/** Writes records that bring `lastSentPads` up to `pads`, updating it as it goes. */
|
|
23
|
+
private encodeDiff;
|
|
24
|
+
private encodeChanges;
|
|
25
|
+
}
|
package/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { registerTouchInteractions } from "./registerTouchInteractions";
|
|
2
2
|
export { KeyboardInteractions, FocusSessionState } from "./registerKeyboardInteractions";
|
|
3
3
|
export type { KeyboardInteractionsParams } from "./registerKeyboardInteractions";
|
|
4
|
+
export { GamepadInteractions } from "./gamepadInteractions";
|
|
4
5
|
export { BLANK_URL, sanitizeUrl } from "./sanitizeUrl";
|
|
5
6
|
export { Finalizable, ImageWrapper, AudioWrapper, FontWrapper, FileAssetWrapper, ImageAssetWrapper, AudioAssetWrapper, FontAssetWrapper, finalizationRegistry, CustomFileAssetLoaderWrapper, AssetLoadCallbackWrapper, FileFinalizer, createFinalization, } from "./finalizationRegistry";
|
|
6
7
|
export { RiveFont } from "./riveFont";
|