@simpludify/web 0.1.5 → 0.1.6
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 -3
- package/dist/game.d.ts +3 -1
- package/dist/gamepad-bindings.d.ts +2 -100
- package/dist/gamepads.d.ts +11 -2
- package/dist/index.js +361 -140
- package/dist/index.js.map +1 -1
- package/dist/input-capture.d.ts +33 -0
- package/dist/pointer.d.ts +12 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @simpludify/web
|
|
2
2
|
|
|
3
|
-
Experimental v0.1.
|
|
3
|
+
Experimental v0.1.6 browser SDK for Simpludify, a code-first TypeScript 2D engine. APIs may change between 0.x releases. Includes Game, PixiJS rendering, browser input and Canvas/DOM UI adapters; re-exports the host-independent Core API. Core and PixiJS are installed as runtime dependencies, not bundled into this package.
|
|
4
4
|
|
|
5
|
-
Registry installation (check availability with `npm view @simpludify/web@0.1.
|
|
5
|
+
Registry installation (check availability with `npm view @simpludify/web@0.1.6 version`):
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npm install @simpludify/web@0.1.
|
|
8
|
+
npm install @simpludify/web@0.1.6
|
|
9
9
|
npm install --save-dev vite typescript
|
|
10
10
|
```
|
|
11
11
|
|
package/dist/game.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CanvasNode } from "@simpludify/core";
|
|
2
|
-
import { type ActionBindings, ActionController, type ActionSet, type Actor, Aspect, Camera, CanvasUI, type CanvasUIOptions, Engine, type FixedStepOptions, type FrameDriver, type JsonValue, type LogicalResolution, type RendererPort, type ReplayControllers, ReplayPlayer, Scene, ScenePointer, type ScreenPoint, type TweenScheduler, type Viewport, type ViewTransform, VirtualInput, type WorldPoint } from "@simpludify/core";
|
|
2
|
+
import { type ActionBindings, ActionController, type ActionSet, type Actor, Aspect, Camera, CanvasUI, type CanvasUIOptions, Engine, type FixedStepOptions, type FrameDriver, type InputCapture, type InputCaptureOptions, type JsonValue, type LogicalResolution, type RendererPort, type ReplayControllers, ReplayPlayer, Scene, ScenePointer, type ScreenPoint, type TweenScheduler, type Viewport, type ViewTransform, VirtualInput, type WorldPoint } from "@simpludify/core";
|
|
3
3
|
import { GamepadInput } from "./gamepads.js";
|
|
4
4
|
import { Theme, type ThemeTokens, type UINode } from "./ui.js";
|
|
5
5
|
export interface SceneContext {
|
|
@@ -42,6 +42,8 @@ export declare class Game<SceneId extends string = string> {
|
|
|
42
42
|
readonly gamepads: GamepadInput;
|
|
43
43
|
private readonly renderer;
|
|
44
44
|
private readonly keyboard;
|
|
45
|
+
private readonly captures;
|
|
46
|
+
captureInput(options?: InputCaptureOptions): InputCapture;
|
|
45
47
|
private readonly pointers;
|
|
46
48
|
private readonly pointerChannels;
|
|
47
49
|
private readonly virtualInputs;
|
|
@@ -1,100 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const GamepadButton: Readonly<{
|
|
4
|
-
South: 0;
|
|
5
|
-
East: 1;
|
|
6
|
-
West: 2;
|
|
7
|
-
North: 3;
|
|
8
|
-
LeftShoulder: 4;
|
|
9
|
-
RightShoulder: 5;
|
|
10
|
-
LeftTrigger: 6;
|
|
11
|
-
RightTrigger: 7;
|
|
12
|
-
Select: 8;
|
|
13
|
-
Start: 9;
|
|
14
|
-
LeftStick: 10;
|
|
15
|
-
RightStick: 11;
|
|
16
|
-
DPadUp: 12;
|
|
17
|
-
DPadDown: 13;
|
|
18
|
-
DPadLeft: 14;
|
|
19
|
-
DPadRight: 15;
|
|
20
|
-
Home: 16;
|
|
21
|
-
}>;
|
|
22
|
-
export type GamepadButton = (typeof GamepadButton)[keyof typeof GamepadButton];
|
|
23
|
-
export declare const GamepadAxis: Readonly<{
|
|
24
|
-
LeftX: 0;
|
|
25
|
-
LeftY: 1;
|
|
26
|
-
RightX: 2;
|
|
27
|
-
RightY: 3;
|
|
28
|
-
}>;
|
|
29
|
-
export type GamepadAxis = (typeof GamepadAxis)[keyof typeof GamepadAxis];
|
|
30
|
-
export interface GamepadButtonBinding {
|
|
31
|
-
readonly buttons?: readonly (number | {
|
|
32
|
-
readonly button: number;
|
|
33
|
-
readonly threshold?: number;
|
|
34
|
-
})[];
|
|
35
|
-
}
|
|
36
|
-
export interface GamepadAxisBinding {
|
|
37
|
-
readonly axis?: number;
|
|
38
|
-
readonly invert?: boolean;
|
|
39
|
-
readonly negative?: readonly number[];
|
|
40
|
-
readonly positive?: readonly number[];
|
|
41
|
-
readonly deadZone?: number;
|
|
42
|
-
}
|
|
43
|
-
export interface GamepadVectorBinding {
|
|
44
|
-
readonly x?: GamepadAxisBinding;
|
|
45
|
-
readonly y?: GamepadAxisBinding;
|
|
46
|
-
}
|
|
47
|
-
export interface GamepadVector3Binding extends GamepadVectorBinding {
|
|
48
|
-
readonly z?: GamepadAxisBinding;
|
|
49
|
-
}
|
|
50
|
-
export type GamepadBinding<K extends ActionKind> = K extends "button" ? GamepadButtonBinding : K extends "axis1d" ? GamepadAxisBinding : K extends "axis2d" ? GamepadVectorBinding : GamepadVector3Binding;
|
|
51
|
-
export type GamepadBindings<A extends ActionSet> = {
|
|
52
|
-
readonly [N in keyof A]?: GamepadBinding<A[N]["kind"]>;
|
|
53
|
-
};
|
|
54
|
-
/** Ready-to-use data; game Actions retain application-defined names. */
|
|
55
|
-
export declare const GamepadBindings: Readonly<{
|
|
56
|
-
LeftStick: Readonly<{
|
|
57
|
-
x: Readonly<{
|
|
58
|
-
axis: number;
|
|
59
|
-
}>;
|
|
60
|
-
y: Readonly<{
|
|
61
|
-
axis: number;
|
|
62
|
-
}>;
|
|
63
|
-
}>;
|
|
64
|
-
RightStick: Readonly<{
|
|
65
|
-
x: Readonly<{
|
|
66
|
-
axis: number;
|
|
67
|
-
}>;
|
|
68
|
-
y: Readonly<{
|
|
69
|
-
axis: number;
|
|
70
|
-
}>;
|
|
71
|
-
}>;
|
|
72
|
-
DPad: Readonly<{
|
|
73
|
-
x: Readonly<{
|
|
74
|
-
negative: readonly number[];
|
|
75
|
-
positive: readonly number[];
|
|
76
|
-
}>;
|
|
77
|
-
y: Readonly<{
|
|
78
|
-
negative: readonly number[];
|
|
79
|
-
positive: readonly number[];
|
|
80
|
-
}>;
|
|
81
|
-
}>;
|
|
82
|
-
Move: Readonly<{
|
|
83
|
-
x: Readonly<{
|
|
84
|
-
axis: 0;
|
|
85
|
-
negative: readonly number[];
|
|
86
|
-
positive: readonly number[];
|
|
87
|
-
}>;
|
|
88
|
-
y: Readonly<{
|
|
89
|
-
axis: 1;
|
|
90
|
-
negative: readonly number[];
|
|
91
|
-
positive: readonly number[];
|
|
92
|
-
}>;
|
|
93
|
-
}>;
|
|
94
|
-
}>;
|
|
95
|
-
type Binding = GamepadButtonBinding | GamepadAxisBinding | GamepadVector3Binding;
|
|
96
|
-
export type CheckedGamepadBinding = readonly [ActionToken, Binding];
|
|
97
|
-
export declare function gamepadIndex(value: unknown): number;
|
|
98
|
-
export declare function gamepadDeadZone(value: unknown): number;
|
|
99
|
-
export declare function checkedGamepadBindings(actions: ActionSet, value: unknown): readonly CheckedGamepadBinding[];
|
|
100
|
-
export {};
|
|
1
|
+
export type { CheckedGamepadBinding, GamepadAxisBinding, GamepadBinding, GamepadButtonBinding, GamepadVector3Binding, GamepadVectorBinding, } from "@simpludify/core";
|
|
2
|
+
export { checkedGamepadBindings, GamepadAxis, GamepadBindings, GamepadButton, gamepadDeadZone, gamepadIndex, } from "@simpludify/core";
|
package/dist/gamepads.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ export interface GamepadState {
|
|
|
16
16
|
export type GamepadPoll = () => readonly (GamepadState | null)[];
|
|
17
17
|
export interface GamepadOptions<A extends ActionSet> {
|
|
18
18
|
readonly index: number;
|
|
19
|
-
|
|
19
|
+
/** Omit to follow ActionController's common gamepad settings. */
|
|
20
|
+
readonly bindings?: GamepadBindings<A>;
|
|
20
21
|
readonly deadZone?: number;
|
|
21
22
|
/** Positional constants require standard mapping; raw is an explicit opt-in. */
|
|
22
23
|
readonly mapping?: "standard" | "raw";
|
|
@@ -33,6 +34,9 @@ export declare class GamepadSource<A extends ActionSet> {
|
|
|
33
34
|
private signature;
|
|
34
35
|
private readonly zone;
|
|
35
36
|
private readonly mapping;
|
|
37
|
+
private following;
|
|
38
|
+
private bindingRevision;
|
|
39
|
+
private readonly waiting;
|
|
36
40
|
constructor(input: GamepadInput, controller: ActionController<A>, options: GamepadOptions<A>);
|
|
37
41
|
get disposed(): boolean;
|
|
38
42
|
get enabled(): boolean;
|
|
@@ -42,7 +46,9 @@ export declare class GamepadSource<A extends ActionSet> {
|
|
|
42
46
|
get connected(): boolean;
|
|
43
47
|
get usable(): boolean;
|
|
44
48
|
assign(index: number): void;
|
|
45
|
-
rebind(bindings
|
|
49
|
+
rebind(bindings?: GamepadBindings<A>): void;
|
|
50
|
+
private commonBindings;
|
|
51
|
+
private syncBindings;
|
|
46
52
|
clear(): void;
|
|
47
53
|
private alive;
|
|
48
54
|
/** @internal */ sample(pad: GamepadState | undefined, allowed: boolean): void;
|
|
@@ -60,10 +66,13 @@ export declare class GamepadInput implements InputAdapter {
|
|
|
60
66
|
private readable;
|
|
61
67
|
private readonly poll;
|
|
62
68
|
private readonly active;
|
|
69
|
+
private readonly observe;
|
|
63
70
|
constructor(input: InputSystem, options?: {
|
|
64
71
|
readonly poll?: GamepadPoll;
|
|
65
72
|
readonly active?: () => boolean;
|
|
66
73
|
readonly events?: EventTarget;
|
|
74
|
+
/** @internal Host capture observes the same poll before any device contribution. */
|
|
75
|
+
readonly observe?: (pads: ReadonlyMap<number, GamepadState>) => void;
|
|
67
76
|
});
|
|
68
77
|
get disposed(): boolean;
|
|
69
78
|
/** Whether the most recent polling attempt completed; an empty list may still need a user gesture. */
|