@zylem/game-lib 0.6.3 → 0.6.4
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/actions.d.ts +5 -5
- package/dist/actions.js +196 -32
- package/dist/actions.js.map +1 -1
- package/dist/behavior/jumper-2d.d.ts +114 -0
- package/dist/behavior/jumper-2d.js +711 -0
- package/dist/behavior/jumper-2d.js.map +1 -0
- package/dist/behavior/platformer-3d.d.ts +14 -14
- package/dist/behavior/platformer-3d.js +347 -104
- package/dist/behavior/platformer-3d.js.map +1 -1
- package/dist/behavior/ricochet-2d.d.ts +4 -3
- package/dist/behavior/ricochet-2d.js +53 -22
- package/dist/behavior/ricochet-2d.js.map +1 -1
- package/dist/behavior/ricochet-3d.d.ts +117 -0
- package/dist/behavior/ricochet-3d.js +443 -0
- package/dist/behavior/ricochet-3d.js.map +1 -0
- package/dist/behavior/screen-visibility.d.ts +79 -0
- package/dist/behavior/screen-visibility.js +358 -0
- package/dist/behavior/screen-visibility.js.map +1 -0
- package/dist/behavior/screen-wrap.d.ts +4 -3
- package/dist/behavior/screen-wrap.js +100 -49
- package/dist/behavior/screen-wrap.js.map +1 -1
- package/dist/behavior/shooter-2d.d.ts +79 -0
- package/dist/behavior/shooter-2d.js +180 -0
- package/dist/behavior/shooter-2d.js.map +1 -0
- package/dist/behavior/thruster.d.ts +5 -4
- package/dist/behavior/thruster.js +133 -75
- package/dist/behavior/thruster.js.map +1 -1
- package/dist/behavior/top-down-movement.d.ts +56 -0
- package/dist/behavior/top-down-movement.js +125 -0
- package/dist/behavior/top-down-movement.js.map +1 -0
- package/dist/behavior/world-boundary-2d.d.ts +4 -3
- package/dist/behavior/world-boundary-2d.js +90 -36
- package/dist/behavior/world-boundary-2d.js.map +1 -1
- package/dist/behavior/world-boundary-3d.d.ts +76 -0
- package/dist/behavior/world-boundary-3d.js +274 -0
- package/dist/behavior/world-boundary-3d.js.map +1 -0
- package/dist/{behavior-descriptor-BWNWmIjv.d.ts → behavior-descriptor-BXnVR8Ki.d.ts} +22 -5
- package/dist/{blueprints-BWGz8fII.d.ts → blueprints-DmbK2dki.d.ts} +2 -2
- package/dist/camera-4XO5gbQH.d.ts +905 -0
- package/dist/camera.d.ts +1 -1
- package/dist/camera.js +876 -289
- package/dist/camera.js.map +1 -1
- package/dist/{composition-DrzFrbqI.d.ts → composition-BASvMKrW.d.ts} +1 -1
- package/dist/{core-DAkskq6Y.d.ts → core-CARRaS55.d.ts} +57 -14
- package/dist/core.d.ts +9 -8
- package/dist/core.js +4519 -1255
- package/dist/core.js.map +1 -1
- package/dist/{entities-DC9ce_vx.d.ts → entities-ChFirVL9.d.ts} +22 -28
- package/dist/entities.d.ts +4 -4
- package/dist/entities.js +1231 -314
- package/dist/entities.js.map +1 -1
- package/dist/{entity-BpbZqg19.d.ts → entity-vj-HTjzU.d.ts} +80 -11
- package/dist/{global-change-Dc8uCKi2.d.ts → global-change-2JvMaz44.d.ts} +1 -1
- package/dist/main.d.ts +718 -19
- package/dist/main.js +12129 -5959
- package/dist/main.js.map +1 -1
- package/dist/physics-pose-DCc4oE44.d.ts +25 -0
- package/dist/physics-protocol-BDD3P5W2.d.ts +200 -0
- package/dist/physics-worker.d.ts +21 -0
- package/dist/physics-worker.js +306 -0
- package/dist/physics-worker.js.map +1 -0
- package/dist/physics.d.ts +205 -0
- package/dist/physics.js +577 -0
- package/dist/physics.js.map +1 -0
- package/dist/{stage-types-BFsm3qsZ.d.ts → stage-types-C19IhuzA.d.ts} +253 -89
- package/dist/stage.d.ts +9 -8
- package/dist/stage.js +3782 -1041
- package/dist/stage.js.map +1 -1
- package/dist/sync-state-machine-CZyspBpj.d.ts +16 -0
- package/dist/{thruster-DhRaJnoL.d.ts → thruster-23lzoPZd.d.ts} +16 -8
- package/dist/world-DfgxoNMt.d.ts +105 -0
- package/package.json +25 -1
- package/dist/camera-B5e4c78l.d.ts +0 -468
- package/dist/world-Be5m1XC1.d.ts +0 -31
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ak as InputPlayerNumber, al as InputProvider, am as Inputs, L as SetupContext, U as UpdateContext, M as DestroyContext, an as GameEntityLifeCycle,
|
|
2
|
-
import { G as GameInputConfig, e as StageInterface, B as BaseGlobals, b as Stage, Z as ZylemGameConfig } from './stage-types-
|
|
3
|
-
import { Z as ZylemCamera, R as RendererManager } from './camera-
|
|
1
|
+
import { ak as InputPlayerNumber, al as InputProvider, am as Inputs, L as SetupContext, U as UpdateContext, M as DestroyContext, an as GameEntityLifeCycle, O as BaseNode, ao as IGame, S as SetupFunction, J as UpdateFunction, K as DestroyFunction, aa as GameEvents, ap as LoadedContext, aq as CleanupContext, ar as NodeInterface } from './entity-vj-HTjzU.js';
|
|
2
|
+
import { G as GameInputConfig, e as StageInterface, B as BaseGlobals, b as Stage, Z as ZylemGameConfig } from './stage-types-C19IhuzA.js';
|
|
3
|
+
import { Z as ZylemCamera, R as RendererManager } from './camera-4XO5gbQH.js';
|
|
4
4
|
import { Vector3 } from 'three';
|
|
5
5
|
import { Vector3 as Vector3$1 } from '@dimforge/rapier3d-compat';
|
|
6
|
-
import './global-change-
|
|
6
|
+
import './global-change-2JvMaz44.js';
|
|
7
7
|
|
|
8
8
|
declare class InputManager {
|
|
9
9
|
private inputMap;
|
|
@@ -11,8 +11,8 @@ declare class InputManager {
|
|
|
11
11
|
private previousInputs;
|
|
12
12
|
constructor(config?: GameInputConfig);
|
|
13
13
|
/**
|
|
14
|
-
* Reconfigure keyboard providers at runtime without affecting gamepad providers.
|
|
15
|
-
* Disposes existing keyboard providers and creates new ones from the given config.
|
|
14
|
+
* Reconfigure keyboard and mouse providers at runtime without affecting gamepad providers.
|
|
15
|
+
* Disposes existing keyboard/mouse providers and creates new ones from the given config.
|
|
16
16
|
*/
|
|
17
17
|
configure(config: GameInputConfig): void;
|
|
18
18
|
addInputProvider(playerNumber: InputPlayerNumber, provider: InputProvider): void;
|
|
@@ -115,6 +115,7 @@ declare class Timer {
|
|
|
115
115
|
declare const AspectRatio: {
|
|
116
116
|
readonly FourByThree: number;
|
|
117
117
|
readonly SixteenByNine: number;
|
|
118
|
+
readonly NineBySixteen: number;
|
|
118
119
|
readonly TwentyOneByNine: number;
|
|
119
120
|
readonly OneByOne: number;
|
|
120
121
|
};
|
|
@@ -131,6 +132,7 @@ declare class AspectRatioDelegate {
|
|
|
131
132
|
aspectRatio: number;
|
|
132
133
|
onResize?: (width: number, height: number) => void;
|
|
133
134
|
private handleResizeBound;
|
|
135
|
+
private resizeObserver;
|
|
134
136
|
constructor(params: {
|
|
135
137
|
container: HTMLElement;
|
|
136
138
|
canvas: HTMLCanvasElement;
|
|
@@ -150,6 +152,11 @@ declare class AspectRatioDelegate {
|
|
|
150
152
|
apply(): void;
|
|
151
153
|
}
|
|
152
154
|
|
|
155
|
+
interface ViewportSize {
|
|
156
|
+
width: number;
|
|
157
|
+
height: number;
|
|
158
|
+
}
|
|
159
|
+
|
|
153
160
|
type RetroResolution = {
|
|
154
161
|
key: string;
|
|
155
162
|
width: number;
|
|
@@ -161,13 +168,36 @@ type RetroPreset = {
|
|
|
161
168
|
resolutions: RetroResolution[];
|
|
162
169
|
};
|
|
163
170
|
/**
|
|
164
|
-
* Retro and
|
|
171
|
+
* Retro, console, and device display presets.
|
|
165
172
|
* displayAspect represents the intended display aspect (letterboxing target),
|
|
166
173
|
* not necessarily the raw pixel aspect of internal buffers.
|
|
167
174
|
*/
|
|
168
175
|
declare const RetroPresets: Record<string, RetroPreset>;
|
|
169
176
|
type RetroPresetKey = keyof typeof RetroPresets;
|
|
177
|
+
declare function getDisplayAspect(preset: RetroPresetKey): number;
|
|
178
|
+
declare function getPresetResolution(preset: RetroPresetKey, key?: string): RetroResolution | undefined;
|
|
179
|
+
declare function parseResolution(text: string): {
|
|
180
|
+
width: number;
|
|
181
|
+
height: number;
|
|
182
|
+
} | null;
|
|
170
183
|
|
|
184
|
+
type ResolutionInput = string | {
|
|
185
|
+
width: number;
|
|
186
|
+
height: number;
|
|
187
|
+
};
|
|
188
|
+
type DeviceProfile = 'auto' | 'desktop' | 'mobile';
|
|
189
|
+
interface ResolveGameConfigRuntime {
|
|
190
|
+
deviceProfile?: DeviceProfile;
|
|
191
|
+
viewportSize?: ViewportSize;
|
|
192
|
+
}
|
|
193
|
+
type GameDeviceConfig = Partial<{
|
|
194
|
+
/** numeric value or key in AspectRatio */
|
|
195
|
+
aspectRatio: AspectRatioValue | keyof typeof AspectRatio;
|
|
196
|
+
/** console/display preset to derive aspect ratio */
|
|
197
|
+
preset: RetroPresetKey;
|
|
198
|
+
/** lock internal render buffer for this device profile */
|
|
199
|
+
resolution: ResolutionInput;
|
|
200
|
+
}>;
|
|
171
201
|
type GameConfigLike = Partial<{
|
|
172
202
|
id: string;
|
|
173
203
|
globals: Record<string, any>;
|
|
@@ -179,11 +209,10 @@ type GameConfigLike = Partial<{
|
|
|
179
209
|
aspectRatio: AspectRatioValue | keyof typeof AspectRatio;
|
|
180
210
|
/** console/display preset to derive aspect ratio */
|
|
181
211
|
preset: RetroPresetKey;
|
|
182
|
-
/** lock internal render buffer to this resolution
|
|
183
|
-
resolution:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
};
|
|
212
|
+
/** lock internal render buffer to this desktop/default resolution */
|
|
213
|
+
resolution: ResolutionInput;
|
|
214
|
+
/** mobile-specific aspect/preset/resolution overrides */
|
|
215
|
+
mobile: GameDeviceConfig;
|
|
187
216
|
fullscreen: boolean;
|
|
188
217
|
/** CSS background value for document body */
|
|
189
218
|
bodyBackground: string;
|
|
@@ -252,6 +281,8 @@ declare class GameCanvas {
|
|
|
252
281
|
mountRenderer(rendererDom: HTMLCanvasElement, onResize: (width: number, height: number) => void): void;
|
|
253
282
|
centerIfFullscreen(): void;
|
|
254
283
|
attachAspectRatio(onResize: (width: number, height: number) => void): void;
|
|
284
|
+
setAspectRatio(aspectRatio: number): void;
|
|
285
|
+
reapplyLayout(): void;
|
|
255
286
|
destroy(): void;
|
|
256
287
|
private ensureContainer;
|
|
257
288
|
}
|
|
@@ -299,10 +330,17 @@ declare class ZylemGame<TGlobals extends BaseGlobals> {
|
|
|
299
330
|
private loadingDelegate;
|
|
300
331
|
private rendererObserver;
|
|
301
332
|
private eventBusUnsubscribes;
|
|
333
|
+
private readonly gameUpdateParams;
|
|
334
|
+
private readonly stageSetupParams;
|
|
335
|
+
private readonly stageUpdateParams;
|
|
336
|
+
private readonly frameCallback;
|
|
337
|
+
private readonly sourceOptions;
|
|
338
|
+
private displayRuntime;
|
|
302
339
|
static FRAME_LIMIT: number;
|
|
303
340
|
static FRAME_DURATION: number;
|
|
304
341
|
static MAX_DELTA_SECONDS: number;
|
|
305
|
-
constructor(options: ZylemGameOptions<TGlobals>, wrapperRef: Game<TGlobals
|
|
342
|
+
constructor(options: ZylemGameOptions<TGlobals>, wrapperRef: Game<TGlobals>, displayRuntime?: ResolveGameConfigRuntime);
|
|
343
|
+
setDisplayRuntime(runtime: ResolveGameConfigRuntime): void;
|
|
306
344
|
loadGameCanvas(config: GameConfig): void;
|
|
307
345
|
loadDebugOptions(options: ZylemGameOptions<TGlobals>): void;
|
|
308
346
|
loadStage(stage: Stage, stageIndex?: number): Promise<void>;
|
|
@@ -378,6 +416,7 @@ declare class Game<TGlobals extends BaseGlobals> implements IGame<TGlobals> {
|
|
|
378
416
|
private eventDelegate;
|
|
379
417
|
/** Pending global input config set before the game starts. */
|
|
380
418
|
private pendingInputConfig;
|
|
419
|
+
private displayRuntime;
|
|
381
420
|
refErrorMessage: string;
|
|
382
421
|
constructor(options: GameOptions<TGlobals>);
|
|
383
422
|
onSetup(...callbacks: Array<SetupFunction<ZylemGame<TGlobals>, TGlobals>>): this;
|
|
@@ -392,6 +431,9 @@ declare class Game<TGlobals extends BaseGlobals> implements IGame<TGlobals> {
|
|
|
392
431
|
*/
|
|
393
432
|
setInputConfiguration(...configs: GameInputConfig[]): this;
|
|
394
433
|
start(): Promise<this>;
|
|
434
|
+
setDisplayRuntime(runtime: Partial<ResolveGameConfigRuntime>): this;
|
|
435
|
+
setDeviceProfile(profile: DeviceProfile): this;
|
|
436
|
+
setViewportSize(width: number, height: number): this;
|
|
395
437
|
private load;
|
|
396
438
|
private setOverrides;
|
|
397
439
|
/**
|
|
@@ -476,6 +518,7 @@ declare class Vessel extends BaseNode<{}, Vessel> {
|
|
|
476
518
|
protected _destroy(_params: DestroyContext<this>): void;
|
|
477
519
|
protected _cleanup(_params: CleanupContext<this>): void;
|
|
478
520
|
create(): this;
|
|
521
|
+
clone(): this;
|
|
479
522
|
/**
|
|
480
523
|
* Add one or more child entities to this vessel.
|
|
481
524
|
* Overrides parent to support multiple arguments.
|
|
@@ -495,4 +538,4 @@ declare function vessel(...args: Array<BaseNode>): Vessel;
|
|
|
495
538
|
*/
|
|
496
539
|
type Vect3 = Vector3 | Vector3$1;
|
|
497
540
|
|
|
498
|
-
export { Game as G, type Vect3 as V, createGame as c, gameConfig as g, vessel as v };
|
|
541
|
+
export { AspectRatio as A, type DeviceProfile as D, Game as G, type ResolutionInput as R, type Vect3 as V, type GameConfigLike as a, type GameDeviceConfig as b, createGame as c, type ResolveGameConfigRuntime as d, type AspectRatioValue as e, getDisplayAspect as f, gameConfig as g, getPresetResolution as h, type RetroPreset as i, type RetroPresetKey as j, type RetroResolution as k, parseResolution as p, vessel as v };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export { V as Vect3, c as createGame, v as vessel } from './core-
|
|
2
|
-
export { Z as ZylemGameConfig } from './stage-types-
|
|
3
|
-
export { g as globalChange, a as globalChanges, v as variableChange, b as variableChanges } from './global-change-
|
|
4
|
-
import './entity-
|
|
1
|
+
export { V as Vect3, c as createGame, v as vessel } from './core-CARRaS55.js';
|
|
2
|
+
export { Z as ZylemGameConfig } from './stage-types-C19IhuzA.js';
|
|
3
|
+
export { g as globalChange, a as globalChanges, v as variableChange, b as variableChanges } from './global-change-2JvMaz44.js';
|
|
4
|
+
import './entity-vj-HTjzU.js';
|
|
5
5
|
import 'three';
|
|
6
6
|
import '@dimforge/rapier3d-compat';
|
|
7
7
|
import 'bitecs';
|
|
8
8
|
import 'mitt';
|
|
9
|
-
import './behavior-descriptor-
|
|
10
|
-
import './camera-
|
|
9
|
+
import './behavior-descriptor-BXnVR8Ki.js';
|
|
10
|
+
import './camera-4XO5gbQH.js';
|
|
11
11
|
import './entity-Bq_eNEDI.js';
|
|
12
12
|
import 'three/webgpu';
|
|
13
13
|
import 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
14
|
-
import './world-
|
|
14
|
+
import './world-DfgxoNMt.js';
|
|
15
15
|
import './entity-types-DAu8sGJH.js';
|
|
16
|
-
import './
|
|
16
|
+
import './physics-pose-DCc4oE44.js';
|
|
17
|
+
import './entities-ChFirVL9.js';
|