@bloopjs/engine 0.0.0 → 0.0.18
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/dist/codegen/enums.d.ts +219 -0
- package/dist/codegen/enums.d.ts.map +1 -0
- package/dist/contexts/inputContext.d.ts +227 -0
- package/dist/contexts/inputContext.d.ts.map +1 -0
- package/dist/{timing.d.ts → contexts/timeContext.d.ts} +3 -3
- package/dist/contexts/timeContext.d.ts.map +1 -0
- package/dist/engine.d.ts +28 -43
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +552 -724
- package/dist/engine.js.map +8 -8
- package/dist/inputs.d.ts +23 -453
- package/dist/inputs.d.ts.map +1 -1
- package/dist/wasmEngine.d.ts +37 -8
- package/dist/wasmEngine.d.ts.map +1 -1
- package/js/contexts/inputContext.ts +208 -208
- package/js/engine.ts +4 -1
- package/package.json +4 -4
- package/wasm/bloop.wasm +0 -0
- package/dist/events.d.ts +0 -75
- package/dist/events.d.ts.map +0 -1
- package/dist/mod.d.ts +0 -37
- package/dist/mod.d.ts.map +0 -1
- package/dist/mod.js +0 -1115
- package/dist/mod.js.map +0 -12
- package/dist/runtime.d.ts +0 -31
- package/dist/runtime.d.ts.map +0 -1
- package/dist/timing.d.ts.map +0 -1
package/js/engine.ts
CHANGED
|
@@ -20,7 +20,10 @@ export type EngineLen = number;
|
|
|
20
20
|
*/
|
|
21
21
|
export type EngineOk = number;
|
|
22
22
|
|
|
23
|
-
export const DEFAULT_WASM_URL = new URL(
|
|
23
|
+
export const DEFAULT_WASM_URL: URL = new URL(
|
|
24
|
+
"../wasm/bloop.wasm",
|
|
25
|
+
import.meta.url,
|
|
26
|
+
);
|
|
24
27
|
|
|
25
28
|
export const TIME_CTX_OFFSET = 0;
|
|
26
29
|
export const INPUT_CTX_OFFSET = TIME_CTX_OFFSET + 4;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloopjs/engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
],
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
|
-
"import": "./
|
|
20
|
-
"types": "./
|
|
19
|
+
"import": "./dist/engine.js",
|
|
20
|
+
"types": "./dist/engine.d.ts"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
@@ -34,4 +34,4 @@
|
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"typescript": "^5"
|
|
36
36
|
}
|
|
37
|
-
}
|
|
37
|
+
}
|
package/wasm/bloop.wasm
CHANGED
|
Binary file
|
package/dist/events.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { type Key, type MouseButton } from "./inputs";
|
|
2
|
-
export declare function encodeEvent<T extends PlatformEvent>(event: T, target?: Uint8Array): Uint8Array;
|
|
3
|
-
export declare function decodeEvent<T extends PlatformEvent>(buffer: Uint8Array): T;
|
|
4
|
-
export type PlatformEvent = {
|
|
5
|
-
type: "keydown";
|
|
6
|
-
key: Key;
|
|
7
|
-
} | {
|
|
8
|
-
type: "keyup";
|
|
9
|
-
key: Key;
|
|
10
|
-
} | {
|
|
11
|
-
type: "keyheld";
|
|
12
|
-
key: Key;
|
|
13
|
-
} | {
|
|
14
|
-
type: "mousemove";
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
} | {
|
|
18
|
-
type: "mousedown";
|
|
19
|
-
button: MouseButton;
|
|
20
|
-
pressure: number;
|
|
21
|
-
} | {
|
|
22
|
-
type: "mouseheld";
|
|
23
|
-
button: MouseButton;
|
|
24
|
-
pressure: number;
|
|
25
|
-
} | {
|
|
26
|
-
type: "mouseup";
|
|
27
|
-
button: MouseButton;
|
|
28
|
-
pressure: number;
|
|
29
|
-
} | {
|
|
30
|
-
type: "mousewheel";
|
|
31
|
-
x: number;
|
|
32
|
-
y: number;
|
|
33
|
-
};
|
|
34
|
-
export type InputEvent = AxisEvent | KeyEvent | MouseButtonEvent | MousePositionEvent | MouseWheelEvent;
|
|
35
|
-
export type ButtonState = {
|
|
36
|
-
/** is the button currently down */
|
|
37
|
-
down: boolean;
|
|
38
|
-
/** is the button currently up */
|
|
39
|
-
up: boolean;
|
|
40
|
-
/** is the button currently held down */
|
|
41
|
-
held: boolean;
|
|
42
|
-
/** the pressure of the button, if the button is pressure sensitive (on a gamepad for eg), this will be a float between 0 and 1, if the button is not pressure sensitive this will be 0 or 1 */
|
|
43
|
-
pressure: number;
|
|
44
|
-
};
|
|
45
|
-
export type ButtonEvent = {
|
|
46
|
-
/** the pressure of the button, if the button is pressure sensitive (on a gamepad for eg), this will be a float between 0 and 1, if the button is not pressure sensitive this will be 0 or 1 */
|
|
47
|
-
pressure: number;
|
|
48
|
-
};
|
|
49
|
-
export type AxisEvent = {
|
|
50
|
-
/** x axis value normalized -1 to 1 */
|
|
51
|
-
x: number;
|
|
52
|
-
/** y axis value normalized -1 to 1 */
|
|
53
|
-
y: number;
|
|
54
|
-
};
|
|
55
|
-
export type KeyEvent = ButtonEvent & {
|
|
56
|
-
/** The string literal for the key */
|
|
57
|
-
key: Key;
|
|
58
|
-
};
|
|
59
|
-
export type MouseButtonEvent = ButtonEvent & {
|
|
60
|
-
/** The mouse button that this button event refers to */
|
|
61
|
-
button: MouseButton;
|
|
62
|
-
};
|
|
63
|
-
export type MousePositionEvent = {
|
|
64
|
-
/** The x coordinate of the mouse in screen space physical pixels */
|
|
65
|
-
x: number;
|
|
66
|
-
/** The y coordinate of the mouse in screen space physical pixels */
|
|
67
|
-
y: number;
|
|
68
|
-
};
|
|
69
|
-
export type MouseWheelEvent = {
|
|
70
|
-
/** The horizontal scroll amount. Positive is right, negative is left */
|
|
71
|
-
x: number;
|
|
72
|
-
/** The vertical scroll amount. Positive is down, negative is up */
|
|
73
|
-
y: number;
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=events.d.ts.map
|
package/dist/events.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../js/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,GAAG,EACR,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAElB,wBAAgB,WAAW,CAAC,CAAC,SAAS,aAAa,EACjD,KAAK,EAAE,CAAC,EACR,MAAM,CAAC,EAAE,UAAU,GAClB,UAAU,CAiCZ;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,aAAa,EAAE,MAAM,EAAE,UAAU,GAAG,CAAC,CAmC1E;AAuBD,MAAM,MAAM,aAAa,GACrB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,GAAG,CAAC;CACV,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,GAAG,CAAC;CACV,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,GAAG,CAAC;CACV,GACD;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,GACD;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEN,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,QAAQ,GACR,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,CAAC;AAEpB,MAAM,MAAM,WAAW,GAAG;IACxB,mCAAmC;IACnC,IAAI,EAAE,OAAO,CAAC;IACd,iCAAiC;IACjC,EAAE,EAAE,OAAO,CAAC;IACZ,wCAAwC;IACxC,IAAI,EAAE,OAAO,CAAC;IACd,+LAA+L;IAC/L,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,+LAA+L;IAC/L,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,sCAAsC;IACtC,CAAC,EAAE,MAAM,CAAC;IACV,sCAAsC;IACtC,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG;IACnC,qCAAqC;IACrC,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,wDAAwD;IACxD,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,oEAAoE;IACpE,CAAC,EAAE,MAAM,CAAC;IACV,oEAAoE;IACpE,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,wEAAwE;IACxE,CAAC,EAAE,MAAM,CAAC;IACV,mEAAmE;IACnE,CAAC,EAAE,MAAM,CAAC;CACX,CAAC"}
|
package/dist/mod.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { PlatformEvent } from "./events";
|
|
2
|
-
import type { Key, MouseButton } from "./inputs";
|
|
3
|
-
export type * from "./inputs";
|
|
4
|
-
export type * from "./events";
|
|
5
|
-
export * as EngineEvents from "./events";
|
|
6
|
-
export * as EngineInputs from "./inputs";
|
|
7
|
-
export declare const DEFAULT_WASM_URL: URL;
|
|
8
|
-
export type WasmEngine = {
|
|
9
|
-
register_systems: (cb_handle: number) => void;
|
|
10
|
-
step: (ms: number) => void;
|
|
11
|
-
};
|
|
12
|
-
export type SystemsCallback = (events: PlatformEvent[]) => void;
|
|
13
|
-
export type MountOpts = {
|
|
14
|
-
wasmUrl?: URL;
|
|
15
|
-
systemsCallback: SystemsCallback;
|
|
16
|
-
};
|
|
17
|
-
export type Runtime = {
|
|
18
|
-
step: (ms?: number) => void;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Emits platform events to the engine
|
|
22
|
-
*/
|
|
23
|
-
export type Emitter = {
|
|
24
|
-
keydown: (key: Key) => void;
|
|
25
|
-
keyup: (key: Key) => void;
|
|
26
|
-
mousemove(x: number, y: number): void;
|
|
27
|
-
mousedown(button: MouseButton): void;
|
|
28
|
-
mouseup(button: MouseButton): void;
|
|
29
|
-
mousewheel(x: number, y: number): void;
|
|
30
|
-
};
|
|
31
|
-
export type MountResult = {
|
|
32
|
-
runtime: Runtime;
|
|
33
|
-
wasm: WasmEngine;
|
|
34
|
-
emitter: Emitter;
|
|
35
|
-
};
|
|
36
|
-
export declare function mount(opts: MountOpts): Promise<MountResult>;
|
|
37
|
-
//# sourceMappingURL=mod.d.ts.map
|
package/dist/mod.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../js/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACjD,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,UAAU,CAAC;AAE9B,OAAO,KAAK,YAAY,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,YAAY,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,gBAAgB,KAAiD,CAAC;AAE/E,MAAM,MAAM,UAAU,GAAG;IAC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