@bloopjs/bloop 0.0.20 → 0.0.21

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.
@@ -0,0 +1,53 @@
1
+ import { type EnginePointer } from "@bloopjs/engine";
2
+ import type { Context } from "./context";
3
+ import type { Bag } from "./data/bag";
4
+ import type { BloopSchema } from "./data/schema";
5
+ import type { DeserializeFn, SerializeFn } from "./runtime";
6
+ import type { System } from "./system";
7
+ export type BloopOpts<B extends Bag> = {
8
+ /** defaults to "Game" */
9
+ name?: string;
10
+ /**
11
+ * component definitions, defaults to empty object
12
+ *
13
+ * use `defineComponents` to generate component definitions from a simple schema
14
+ */
15
+ /**
16
+ * input map, defaults to empty object
17
+ */
18
+ /**
19
+ * bag definition, defaults to empty object
20
+ *
21
+ */
22
+ bag?: B;
23
+ };
24
+ export declare class Bloop<GS extends BloopSchema> {
25
+ #private;
26
+ /**
27
+ * Bloop.create() is the way to create a new bloop instance.
28
+ */
29
+ static create<B extends Bag>(opts?: BloopOpts<B>): Bloop<MakeGS<B>>;
30
+ constructor(opts: BloopOpts<GS["B"]> | undefined, dontCallMeDirectly: string);
31
+ get bag(): GS["B"];
32
+ get context(): Readonly<Context<GS>>;
33
+ /**
34
+ * Take a snapshot of the game state outside the engine
35
+ * @returns linear memory representation of the game state that the engine is unaware of
36
+ */
37
+ serialize: () => ReturnType<SerializeFn>;
38
+ /**
39
+ * Restore a snapshot of the game state outside the engine
40
+ * @returns linear memory representation of the game state that the engine is unaware of
41
+ */
42
+ deserialize: DeserializeFn;
43
+ /**
44
+ * Register a system with the game loop.
45
+ *
46
+ */
47
+ system(label: string, system: System<GS>): number;
48
+ systemsCallback(system_handle: number, ptr: EnginePointer): void;
49
+ setBuffer(buffer: ArrayBuffer): void;
50
+ }
51
+ type MakeGS<B extends Bag> = BloopSchema<B>;
52
+ export {};
53
+ //# sourceMappingURL=bloop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bloop.d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AAa,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa;IA6FzD,SAAS,CAAC,MAAM,EAAE,WAAW;CAG9B;AAUD,KAAK,MAAM,CAAC,CAAC,SAAS,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { EnginePointer, InputContext, TimeContext } from "@bloopjs/engine";
2
+ import type { BloopSchema } from "./data/schema";
3
+ export type Context<GS extends BloopSchema = BloopSchema> = {
4
+ /** The wrapper to the engine instance */
5
+ /** Result of any resources requested */
6
+ /** Result of the main query if there was one */
7
+ /** Results of multiple queries if there were any */
8
+ /** The bag of values for the system */
9
+ bag: GS["B"];
10
+ /** The timing information for the current frame */
11
+ time: TimeContext;
12
+ /** The input snapshot */
13
+ inputs: InputContext;
14
+ /** The engine pointer to the injected system arguments (for advanced use cases) */
15
+ rawPointer: EnginePointer;
16
+ };
17
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,OAAO,CACjB,EAAE,SAAS,WAAW,GAAG,WAAW,IAGlC;IACF,yCAAyC;IAEzC,wCAAwC;IAExC,gDAAgD;IAEhD,oDAAoD;IAEpD,uCAAuC;IACvC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,WAAW,CAAC;IAClB,yBAAyB;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,mFAAmF;IACnF,UAAU,EAAE,aAAa,CAAC;CAC3B,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A bag of serializable values that can be recorded to a snapshot
3
+ */
4
+ export interface Bag {
5
+ [key: string]: BagValue;
6
+ }
7
+ export type BagValue = string | number | boolean | BagValue[] | Bag | Uint8Array | null;
8
+ //# sourceMappingURL=bag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bag.d.ts","sourceRoot":"","sources":["../../src/data/bag.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC;CACzB;AAED,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,EAAE,GACV,GAAG,GACH,UAAU,GACV,IAAI,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Bag } from "./bag";
2
+ export type BloopSchema<B extends Bag = Bag> = {
3
+ B: B;
4
+ };
5
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/data/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,MAAM,WAAW,CAErB,CAAC,SAAS,GAAG,GAAG,GAAG,IAEjB;IAEF,CAAC,EAAE,CAAC,CAAC;CAEN,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Key, MouseButton } from "@bloopjs/engine";
2
+ export type InputEvent = KeyEvent | MouseButtonEvent | MouseMoveEvent | MouseWheelEvent;
3
+ export type KeyEvent = {
4
+ key: Key;
5
+ };
6
+ export type MouseButtonEvent = {
7
+ button: MouseButton;
8
+ };
9
+ export type MouseMoveEvent = {
10
+ x: number;
11
+ y: number;
12
+ };
13
+ export type MouseWheelEvent = {
14
+ x: number;
15
+ y: number;
16
+ };
17
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,gBAAgB,GAChB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC"}
package/dist/mod.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./runtime";
2
+ export * from "./bloop";
3
+ export * as Util from "./util";
4
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AAEvB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}