@egret/engine 7.0.1-rc.3 → 7.0.2
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/Engine.js +7 -2
- package/dist/animation/sequenceResetTypes.d.ts +6 -0
- package/dist/animation/types.d.ts +6 -0
- package/dist/assetBundle.d.ts +2 -0
- package/dist/assetGroupTypes.d.ts +2 -0
- package/dist/audioCues.d.ts +4 -0
- package/dist/audioTypes.d.ts +13 -0
- package/dist/bitmapButtonTypes.d.ts +2 -0
- package/dist/bitmapFontTypes.d.ts +3 -0
- package/dist/bitmapResourceSlot.d.ts +1 -0
- package/dist/camera2d.js +10 -2
- package/dist/cameraTypes.d.ts +12 -0
- package/dist/contentTypes.d.ts +2 -0
- package/dist/createEngineForProfile.js +8 -5
- package/dist/fontContentTypes.d.ts +5 -0
- package/dist/gameClockTypes.d.ts +6 -0
- package/dist/gameRun.d.ts +3 -0
- package/dist/gamepadTypes.d.ts +8 -0
- package/dist/hoverInputTypes.d.ts +10 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +2 -1
- package/dist/inputActions.d.ts +5 -0
- package/dist/internal/uiFactoryState.d.ts +4 -0
- package/dist/internal/uiFactoryState.js +18 -2
- package/dist/keyboardInput.d.ts +1 -0
- package/dist/keyboardInput.js +1 -0
- package/dist/keyboardInputTypes.d.ts +12 -0
- package/dist/kit.d.ts +3 -1
- package/dist/kit.js +2 -1
- package/dist/manifestResourceState.d.ts +1 -0
- package/dist/manifestResourceState.js +1 -0
- package/dist/manifestResourceTypes.d.ts +1 -0
- package/dist/motion.d.ts +2 -0
- package/dist/mouseInputTypes.d.ts +4 -0
- package/dist/particleEmitter.js +8 -0
- package/dist/particleTypes.d.ts +8 -0
- package/dist/physics2d.d.ts +2 -2
- package/dist/physics2d.js +1 -1
- package/dist/physics2dTypes.d.ts +55 -1
- package/dist/physics2dWorld.js +209 -9
- package/dist/pointerInput.d.ts +1 -0
- package/dist/pointerInput.js +1 -0
- package/dist/pointerInputTypes.d.ts +3 -0
- package/dist/random.d.ts +1 -0
- package/dist/rendering/packSharedDraws2D.js +53 -5
- package/dist/rendering/prepareSharedDraws2D.d.ts +2 -0
- package/dist/rendering/prepareSharedDraws2D.js +17 -6
- package/dist/rendering/sharedColor2D.d.ts +35 -1
- package/dist/rendering/sharedColor2D.js +131 -8
- package/dist/rendering/sharedEffects2D.js +16 -8
- package/dist/rendering/world3d/Animation3D.d.ts +9 -0
- package/dist/rendering/world3d/Animation3D.js +4 -0
- package/dist/rendering/world3d/AnimationTexture3D.d.ts +6 -0
- package/dist/rendering/world3d/AnimationTexture3D.js +2 -0
- package/dist/rendering/world3d/Batch3D.d.ts +4 -0
- package/dist/rendering/world3d/Batch3D.js +3 -0
- package/dist/rendering/world3d/Camera3D.d.ts +5 -0
- package/dist/rendering/world3d/Camera3D.js +3 -0
- package/dist/rendering/world3d/Character3D.d.ts +4 -0
- package/dist/rendering/world3d/Character3D.js +2 -0
- package/dist/rendering/world3d/Cloth3D.d.ts +18 -3
- package/dist/rendering/world3d/Cloth3D.js +6 -1
- package/dist/rendering/world3d/Compression3D.d.ts +1 -0
- package/dist/rendering/world3d/Compression3D.js +1 -0
- package/dist/rendering/world3d/Curves3D.d.ts +8 -0
- package/dist/rendering/world3d/Curves3D.js +5 -0
- package/dist/rendering/world3d/Decal3D.d.ts +2 -0
- package/dist/rendering/world3d/Decal3D.js +1 -0
- package/dist/rendering/world3d/Export3D.d.ts +13 -0
- package/dist/rendering/world3d/Export3D.js +263 -0
- package/dist/rendering/world3d/Geometry3D.d.ts +11 -1
- package/dist/rendering/world3d/Geometry3D.js +10 -1
- package/dist/rendering/world3d/GeometryBuilder3D.d.ts +2 -0
- package/dist/rendering/world3d/Gizmo3D.d.ts +5 -0
- package/dist/rendering/world3d/Gizmo3D.js +2 -0
- package/dist/rendering/world3d/Gltf3D.d.ts +6 -0
- package/dist/rendering/world3d/Gltf3D.js +25 -5
- package/dist/rendering/world3d/GpuParticles3D.d.ts +2 -0
- package/dist/rendering/world3d/GpuParticles3D.js +1 -0
- package/dist/rendering/world3d/Hdr3D.d.ts +2 -0
- package/dist/rendering/world3d/Hdr3D.js +1 -0
- package/dist/rendering/world3d/Jelly3D.d.ts +2 -0
- package/dist/rendering/world3d/Jelly3D.js +1 -0
- package/dist/rendering/world3d/Ktx23D.d.ts +3 -0
- package/dist/rendering/world3d/Light3D.d.ts +9 -0
- package/dist/rendering/world3d/Light3D.js +4 -0
- package/dist/rendering/world3d/Material3D.d.ts +10 -0
- package/dist/rendering/world3d/Material3D.js +2 -0
- package/dist/rendering/world3d/Mesh3D.d.ts +4 -0
- package/dist/rendering/world3d/Mesh3D.js +16 -2
- package/dist/rendering/world3d/Meshopt3D.d.ts +3 -0
- package/dist/rendering/world3d/Meshopt3D.js +1 -0
- package/dist/rendering/world3d/Navigation3D.d.ts +41 -1
- package/dist/rendering/world3d/Navigation3D.js +74 -2
- package/dist/rendering/world3d/Object3D.d.ts +11 -0
- package/dist/rendering/world3d/Object3D.js +10 -0
- package/dist/rendering/world3d/Particles3D.d.ts +5 -0
- package/dist/rendering/world3d/Particles3D.js +3 -0
- package/dist/rendering/world3d/Physics3D.d.ts +14 -0
- package/dist/rendering/world3d/Physics3D.js +5 -0
- package/dist/rendering/world3d/PhysicsHull3D.d.ts +2 -0
- package/dist/rendering/world3d/PhysicsHull3D.js +2 -0
- package/dist/rendering/world3d/PhysicsMesh3D.d.ts +2 -0
- package/dist/rendering/world3d/PhysicsMesh3D.js +2 -0
- package/dist/rendering/world3d/PhysicsRemote3D.d.ts +5 -0
- package/dist/rendering/world3d/PhysicsRemote3D.js +2 -0
- package/dist/rendering/world3d/Ragdoll3D.d.ts +5 -0
- package/dist/rendering/world3d/Ragdoll3D.js +2 -0
- package/dist/rendering/world3d/Raycast3D.d.ts +3 -0
- package/dist/rendering/world3d/Raycast3D.js +1 -0
- package/dist/rendering/world3d/RenderList3D.d.ts +3 -0
- package/dist/rendering/world3d/RenderList3D.js +12 -0
- package/dist/rendering/world3d/Retarget3D.d.ts +1 -0
- package/dist/rendering/world3d/Rig3D.d.ts +57 -0
- package/dist/rendering/world3d/Rig3D.js +219 -0
- package/dist/rendering/world3d/Sdf3D.d.ts +181 -0
- package/dist/rendering/world3d/Sdf3D.js +1136 -0
- package/dist/rendering/world3d/SdfLod3D.d.ts +17 -0
- package/dist/rendering/world3d/SdfLod3D.js +56 -0
- package/dist/rendering/world3d/Serialize3D.d.ts +17 -0
- package/dist/rendering/world3d/Serialize3D.js +22 -0
- package/dist/rendering/world3d/Simplify3D.d.ts +29 -0
- package/dist/rendering/world3d/Simplify3D.js +426 -0
- package/dist/rendering/world3d/StateMachine3D.d.ts +9 -0
- package/dist/rendering/world3d/StateMachine3D.js +3 -0
- package/dist/rendering/world3d/SurfaceMaterial3D.d.ts +26 -0
- package/dist/rendering/world3d/SurfaceMaterial3D.js +138 -0
- package/dist/rendering/world3d/Terrain3D.d.ts +21 -0
- package/dist/rendering/world3d/Terrain3D.js +25 -1
- package/dist/rendering/world3d/Text3D.d.ts +5 -0
- package/dist/rendering/world3d/Text3D.js +2 -0
- package/dist/rendering/world3d/Texture3D.d.ts +16 -1
- package/dist/rendering/world3d/Texture3D.js +19 -1
- package/dist/rendering/world3d/Trail3D.d.ts +3 -0
- package/dist/rendering/world3d/Trail3D.js +2 -0
- package/dist/rendering/world3d/Vehicle3D.d.ts +5 -0
- package/dist/rendering/world3d/Vehicle3D.js +2 -0
- package/dist/rendering/world3d/VolumetricFog3D.d.ts +2 -0
- package/dist/rendering/world3d/VolumetricFog3D.js +1 -0
- package/dist/rendering/world3d/Water3D.d.ts +2 -0
- package/dist/rendering/world3d/Water3D.js +1 -0
- package/dist/rendering/world3d/core3D.d.ts +2 -0
- package/dist/rendering/world3d/debug3D.d.ts +5 -0
- package/dist/rendering/world3d/debug3D.js +5 -0
- package/dist/rendering/world3d/geometries3D.d.ts +12 -0
- package/dist/rendering/world3d/geometries3D.js +5 -0
- package/dist/rendering/world3d/helpers3D.d.ts +2 -0
- package/dist/rendering/world3d/helpers3D.js +1 -0
- package/dist/rendering/world3d/index.d.ts +12 -0
- package/dist/rendering/world3d/index.js +6 -0
- package/dist/rendering/world3d/math3D.d.ts +36 -0
- package/dist/rendering/world3d/math3D.js +35 -0
- package/dist/rendering/world3d/primitives3D.d.ts +7 -0
- package/dist/rendering/world3d/primitives3D.js +1 -0
- package/dist/saveStore.d.ts +18 -3
- package/dist/saveStore.js +23 -4
- package/dist/semanticList.d.ts +4 -0
- package/dist/semanticList.js +1 -0
- package/dist/semanticTree.js +11 -4
- package/dist/semanticTypes.d.ts +8 -0
- package/dist/sequencePlaybackTypes.d.ts +3 -0
- package/dist/text.d.ts +1 -0
- package/dist/textTable.d.ts +41 -0
- package/dist/textTable.js +114 -0
- package/dist/tilemapTypes.d.ts +13 -0
- package/dist/timer.d.ts +34 -0
- package/dist/timer.js +119 -0
- package/dist/tweenTypes.d.ts +4 -0
- package/dist/ui/controlKeys.d.ts +4 -0
- package/dist/ui/controlKeys.js +1 -0
- package/dist/ui/controls.d.ts +6 -0
- package/dist/ui/controls.js +2 -0
- package/dist/ui/layerTypes.d.ts +7 -0
- package/dist/ui/rangeControl.d.ts +3 -0
- package/dist/ui/rangeControl.js +1 -0
- package/dist/ui/scrollControl.d.ts +12 -0
- package/dist/ui/scrollControl.js +5 -1
- package/dist/ui/stateControls.d.ts +8 -0
- package/dist/ui/stateControls.js +3 -0
- package/dist/ui/textEditor.d.ts +1 -0
- package/dist/ui/textEditor.js +1 -0
- package/dist/ui/textEditorTypes.d.ts +7 -0
- package/dist/ui/textFieldControl.d.ts +4 -0
- package/dist/ui/textFieldControl.js +1 -0
- package/dist/ui/theme.d.ts +5 -0
- package/dist/ui/theme.js +1 -0
- package/dist/ui/types.d.ts +20 -0
- package/dist/ui/uiRoot.js +38 -9
- package/dist/ui/uiRootModel.d.ts +3 -1
- package/dist/ui/uiRootModel.js +8 -2
- package/dist/videoTypes.d.ts +3 -0
- package/dist/web/BrowserAssetBundle.d.ts +2 -0
- package/dist/web/BrowserAudio.d.ts +34 -1
- package/dist/web/BrowserAudio.js +69 -39
- package/dist/web/BrowserFrameLoop.d.ts +4 -0
- package/dist/web/BrowserGame.d.ts +64 -2
- package/dist/web/BrowserGame.js +129 -8
- package/dist/web/BrowserGamepadInput.d.ts +3 -0
- package/dist/web/BrowserHoverInput.d.ts +1 -0
- package/dist/web/BrowserImageTextures.d.ts +6 -0
- package/dist/web/BrowserInputActions.d.ts +10 -0
- package/dist/web/BrowserInputActions.js +4 -1
- package/dist/web/BrowserPlay.d.ts +130 -2
- package/dist/web/BrowserPlay.js +366 -19
- package/dist/web/BrowserPreferences.d.ts +10 -0
- package/dist/web/BrowserPreferences.js +39 -0
- package/dist/web/BrowserSemantics.d.ts +2 -0
- package/dist/web/BrowserStatsPanel.d.ts +10 -0
- package/dist/web/BrowserStatsPanel.js +9 -3
- package/dist/web/BrowserStorage.d.ts +2 -0
- package/dist/web/BrowserTextEditor.d.ts +3 -0
- package/dist/web/BrowserTextInput.d.ts +6 -0
- package/dist/web/BrowserTextureProvider.d.ts +6 -0
- package/dist/web/BrowserVideo.d.ts +13 -1
- package/dist/web/BrowserVideo.js +28 -2
- package/dist/web/CanvasKitFontSetProvider.d.ts +3 -0
- package/dist/web/CanvasKitParagraphProvider.d.ts +4 -0
- package/dist/web/CanvasKitParagraphProvider.js +1 -0
- package/dist/web/ManifestByteSource.d.ts +4 -0
- package/dist/web/ManifestByteSource.js +1 -0
- package/dist/web/ManifestFontContentLoader.d.ts +1 -0
- package/dist/web/WebGL2Host.js +64 -25
- package/dist/web/WebGPUHost.d.ts +13 -0
- package/dist/web/WebGPUHost.js +117 -36
- package/dist/web/audio.d.ts +2 -2
- package/dist/web/audio.js +1 -1
- package/dist/web/editorFonts.d.ts +4 -0
- package/dist/web/game.d.ts +1 -1
- package/dist/web/imageProjections2D.d.ts +2 -0
- package/dist/web/kit.d.ts +1 -0
- package/dist/web/kit.js +1 -0
- package/dist/web/play.d.ts +6 -1
- package/dist/web/play.js +4 -1
- package/dist/web/playMusic.d.ts +33 -0
- package/dist/web/playMusic.js +194 -0
- package/dist/web/playTouch.d.ts +45 -0
- package/dist/web/playTouch.js +141 -0
- package/dist/web/playWidgets.d.ts +71 -0
- package/dist/web/playWidgets.js +431 -0
- package/dist/web/prepareSharedSubmission2D.js +9 -3
- package/dist/web/resources.d.ts +2 -0
- package/dist/web/sharedEffectShaders.d.ts +6 -2
- package/dist/web/sharedEffectShaders.js +23 -7
- package/dist/web/sharedSubmissionStorage2D.js +1 -1
- package/dist/web/sharedWebGL2Options.d.ts +3 -0
- package/dist/web/sharedWebGL2Options.js +8 -2
- package/dist/web/sharedWebGL2Shaders.d.ts +15 -2
- package/dist/web/sharedWebGL2Shaders.js +108 -14
- package/dist/web/sharedWebGPUOptions.d.ts +5 -1
- package/dist/web/sharedWebGPUOptions.js +6 -2
- package/dist/web/video.d.ts +1 -1
- package/dist/web/webgl2Native.d.ts +3 -1
- package/dist/web/webgl2Native.js +9 -5
- package/dist/web/webgl2Types.d.ts +18 -0
- package/dist/web/webgpuImageResidency.d.ts +5 -2
- package/dist/web/webgpuImageResidency.js +7 -3
- package/dist/web/webgpuRetentionPool.d.ts +2 -2
- package/dist/web/webgpuRetentionPool.js +2 -1
- package/dist/web/webgpuSharedPass.d.ts +1 -1
- package/dist/web/webgpuSharedPass.js +87 -5
- package/dist/web/webgpuSharedResolvePass.d.ts +1 -1
- package/dist/web/webgpuSharedResolvePass.js +9 -4
- package/dist/web/world3d/Audio3D.d.ts +18 -1
- package/dist/web/world3d/Audio3D.js +62 -3
- package/dist/web/world3d/BrowserPlay3D.d.ts +115 -2
- package/dist/web/world3d/BrowserPlay3D.js +448 -43
- package/dist/web/world3d/FlyControls3D.d.ts +4 -0
- package/dist/web/world3d/FlyControls3D.js +2 -0
- package/dist/web/world3d/FollowControls3D.d.ts +3 -0
- package/dist/web/world3d/FollowControls3D.js +2 -0
- package/dist/web/world3d/OrbitControls3D.d.ts +3 -0
- package/dist/web/world3d/OrbitControls3D.js +2 -0
- package/dist/web/world3d/TransformControls3D.d.ts +5 -2
- package/dist/web/world3d/TransformControls3D.js +7 -4
- package/dist/web/world3d/WebGL2Renderer3D.d.ts +3 -0
- package/dist/web/world3d/WebGL2Renderer3D.js +2 -0
- package/dist/web/world3d/WebGPURenderer3D.d.ts +2 -0
- package/dist/web/world3d/WebGPURenderer3D.js +1 -0
- package/dist/web/world3d/World3DView.d.ts +3 -0
- package/dist/web/world3d/World3DView.js +2 -0
- package/dist/web/world3d/app3D.d.ts +7 -0
- package/dist/web/world3d/app3D.js +1 -0
- package/dist/web/world3d/assets3D.d.ts +1 -0
- package/dist/web/world3d/atmosphere3D.d.ts +9 -0
- package/dist/web/world3d/atmosphere3D.js +19 -4
- package/dist/web/world3d/canvasFont3D.d.ts +21 -0
- package/dist/web/world3d/canvasFont3D.js +165 -0
- package/dist/web/world3d/frame3D.d.ts +2 -0
- package/dist/web/world3d/host3D.d.ts +1 -0
- package/dist/web/world3d/index.d.ts +4 -2
- package/dist/web/world3d/index.js +2 -1
- package/dist/web/world3d/loaders3D.d.ts +1 -0
- package/dist/web/world3d/markers3D.d.ts +4 -0
- package/dist/web/world3d/overlay3D.d.ts +19 -0
- package/dist/web/world3d/overlay3D.js +21 -4
- package/dist/web/world3d/post3D.d.ts +4 -0
- package/dist/web/world3d/post3D.js +3 -0
- package/dist/web/world3d/probe3D.d.ts +1 -0
- package/dist/web/world3d/stats3D.d.ts +3 -0
- package/dist/web/world3d/stats3D.js +1 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.d.ts +5 -0
- package/dist/web/world3d/webgpu.d.ts +2 -0
- package/dist/web/world3d/webgpu.js +1 -0
- package/package.json +3 -3
package/dist/Engine.js
CHANGED
|
@@ -60,6 +60,8 @@ export class Engine {
|
|
|
60
60
|
frameIdle;
|
|
61
61
|
releaseFrame;
|
|
62
62
|
sharedRenderer;
|
|
63
|
+
/** The space the renderer mixes in, which every frame records; ports may carry it beside their declared members. */
|
|
64
|
+
#sharedBlendSpace;
|
|
63
65
|
#currentState = 'open';
|
|
64
66
|
scopes = new Set();
|
|
65
67
|
cleanupErrors = [];
|
|
@@ -78,6 +80,8 @@ export class Engine {
|
|
|
78
80
|
throw new EgretError('ENGINE_FACTORY_REQUIRED');
|
|
79
81
|
this.host = options.host;
|
|
80
82
|
this.sharedRenderer = ports.shared;
|
|
83
|
+
this.#sharedBlendSpace =
|
|
84
|
+
ports.sharedBlendSpace === 'srgb' ? 'srgb' : 'linear';
|
|
81
85
|
this.sharedFrameProfile = ports.sharedProfile;
|
|
82
86
|
this.timeoutMs = timeoutMs;
|
|
83
87
|
this.onDiagnostic = options.onDiagnostic;
|
|
@@ -312,8 +316,9 @@ export class Engine {
|
|
|
312
316
|
throw new EgretError('FRAME_ID_EXHAUSTED');
|
|
313
317
|
const frame = freezeSharedFrame({
|
|
314
318
|
profile: SHARED_FRAME_PROFILE_2D,
|
|
315
|
-
|
|
316
|
-
|
|
319
|
+
...(this.#sharedBlendSpace === 'srgb'
|
|
320
|
+
? { colorRecipe: 'egret.srgb-pma/1', targetRepresentation: 'egret.encoded-srgb-pma8-target/1' }
|
|
321
|
+
: { colorRecipe: 'egret.linear-srgb-pma/1', targetRepresentation: 'egret.srgb-pma8-target/1' }),
|
|
317
322
|
outputRepresentation: outputAlpha === 'opaque' ? 'egret.srgb-opaque-unorm8/1' : 'egret.srgb-premultiplied-unorm8/1',
|
|
318
323
|
frameId: this.nextFrameId,
|
|
319
324
|
width,
|
|
@@ -2,15 +2,18 @@ import type { Bitmap } from '@egret/runtime';
|
|
|
2
2
|
import type { SharedFrameOptions2D, SharedRenderFrame2D } from '@egret/contracts';
|
|
3
3
|
import type { ContentLoader } from '../contentTypes.js';
|
|
4
4
|
import type { SequenceController, SequenceControllerOptions } from './types.js';
|
|
5
|
+
/** The sequence a reset slot starts with: its version label, its bitmap and its controller. */
|
|
5
6
|
export interface SequenceResetInitial {
|
|
6
7
|
/** Application label only, never resource or Host generation authority. */
|
|
7
8
|
readonly version: string;
|
|
8
9
|
readonly bitmap: Bitmap;
|
|
9
10
|
readonly controller: SequenceController;
|
|
10
11
|
}
|
|
12
|
+
/** The sequence a reset slot shows now, and whether the slot owns it or borrows it. */
|
|
11
13
|
export interface SequenceResetActive extends SequenceResetInitial {
|
|
12
14
|
readonly ownership: 'borrowed' | 'owned';
|
|
13
15
|
}
|
|
16
|
+
/** A request to replace a slot's sequence with another version, loaded from a content loader. */
|
|
14
17
|
export interface SequenceResetRequest {
|
|
15
18
|
readonly policy: 'reset';
|
|
16
19
|
readonly version: string;
|
|
@@ -19,7 +22,9 @@ export interface SequenceResetRequest {
|
|
|
19
22
|
readonly sequenceId: string;
|
|
20
23
|
readonly playback: SequenceControllerOptions;
|
|
21
24
|
}
|
|
25
|
+
/** Where a reset request is: loading, ready, prepared, committed, cancelled or failed. */
|
|
22
26
|
export type SequenceResetState = 'loading' | 'ready' | 'prepared' | 'committed' | 'cancelled' | 'failed';
|
|
27
|
+
/** One pending replacement: wait for it to be ready, then commit it or dispose of it. */
|
|
23
28
|
export interface SequenceResetTicket {
|
|
24
29
|
/** CPU content readiness only, not Host upload or submission. */
|
|
25
30
|
readonly ready: Promise<void>;
|
|
@@ -30,6 +35,7 @@ export interface SequenceResetTicket {
|
|
|
30
35
|
commit(): SequenceResetActive;
|
|
31
36
|
dispose(): void;
|
|
32
37
|
}
|
|
38
|
+
/** Holds a bitmap's sequence and replaces it with a new version without a gap. */
|
|
33
39
|
export interface SequenceResetSlot {
|
|
34
40
|
readonly isDisposed: boolean;
|
|
35
41
|
getActive(): SequenceResetActive;
|
|
@@ -4,6 +4,7 @@ export interface SequenceMarker {
|
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly timeSeconds: number;
|
|
6
6
|
}
|
|
7
|
+
/** How a sequence controller plays: how many times, how fast, which markers it reports and where. */
|
|
7
8
|
export interface SequenceControllerOptions {
|
|
8
9
|
readonly profile: 'egret.sequence-control/1';
|
|
9
10
|
readonly totalPlays?: number | 'infinite';
|
|
@@ -11,8 +12,11 @@ export interface SequenceControllerOptions {
|
|
|
11
12
|
readonly markers?: readonly SequenceMarker[];
|
|
12
13
|
readonly onEvent?: (event: SequenceControllerEvent) => undefined;
|
|
13
14
|
}
|
|
15
|
+
/** Whether a sequence controller is idle, running, paused, completed, stopped or faulted. */
|
|
14
16
|
export type SequenceControllerState = 'idle' | 'running' | 'paused' | 'completed' | 'stopped' | 'faulted';
|
|
17
|
+
/** What caused a controller event: starting, the clock, a seek or a control call. */
|
|
15
18
|
export type SequenceEventSource = 'start' | 'clock' | 'seek' | 'control';
|
|
19
|
+
/** An event a sequence controller reports: a marker it passed, or the end of its plays. */
|
|
16
20
|
export type SequenceControllerEvent = Readonly<{
|
|
17
21
|
kind: 'marker';
|
|
18
22
|
id: string;
|
|
@@ -31,10 +35,12 @@ export type SequenceControllerEvent = Readonly<{
|
|
|
31
35
|
sequence: number;
|
|
32
36
|
source: SequenceEventSource;
|
|
33
37
|
}>;
|
|
38
|
+
/** Where to seek to, and whether the events passed over are reported. */
|
|
34
39
|
export interface SequenceSeekRequest {
|
|
35
40
|
readonly timeSeconds: number;
|
|
36
41
|
readonly replayEvents?: boolean;
|
|
37
42
|
}
|
|
43
|
+
/** Where a sequence controller is: its state, its time and position, and its last sample and issue. */
|
|
38
44
|
export interface SequenceControllerStatus {
|
|
39
45
|
readonly state: SequenceControllerState;
|
|
40
46
|
readonly isDisposed: boolean;
|
package/dist/assetBundle.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface AssetBundleInput {
|
|
|
8
8
|
/** Free labels a game can filter by, such as a quality tier or a level. */
|
|
9
9
|
readonly tags?: readonly string[];
|
|
10
10
|
}
|
|
11
|
+
/** One file in an asset bundle: its name, where its bytes are, its type and tags, and its check. */
|
|
11
12
|
export interface AssetBundleEntry {
|
|
12
13
|
readonly name: string;
|
|
13
14
|
/** Bytes from the start of the bundle file. */
|
|
@@ -18,6 +19,7 @@ export interface AssetBundleEntry {
|
|
|
18
19
|
/** FNV-1a 32-bit of the bytes, as eight hex digits: a quick check that a range came back whole. */
|
|
19
20
|
readonly check: string;
|
|
20
21
|
}
|
|
22
|
+
/** The table of an asset bundle: its size, where its data begins, and its entries. */
|
|
21
23
|
export interface AssetBundleIndex {
|
|
22
24
|
readonly version: 1;
|
|
23
25
|
/** Bytes of the whole file. */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AssetLease } from '@egret/runtime';
|
|
2
2
|
declare const assetGroupBrand: unique symbol;
|
|
3
|
+
/** Whether an asset group is loading, ready, failed or disposed. */
|
|
3
4
|
export type AssetGroupState = 'pending' | 'ready' | 'failed' | 'disposed';
|
|
5
|
+
/** How many of a group's assets load at once. */
|
|
4
6
|
export interface AssetGroupOptions {
|
|
5
7
|
readonly concurrency?: number;
|
|
6
8
|
}
|
package/dist/audioCues.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AudioMixer, AudioSound, AudioVoice } from './audioTypes.js';
|
|
2
|
+
/** A named sound effect: its takes, its bus and volume, and how often and how many at once it plays. */
|
|
2
3
|
export interface AudioCueDefinition {
|
|
3
4
|
/** The takes; one is chosen each time. */
|
|
4
5
|
readonly sounds: readonly AudioSound[];
|
|
@@ -13,6 +14,7 @@ export interface AudioCueDefinition {
|
|
|
13
14
|
/** At most this many voices of the cue at once; the oldest gives its place. Defaults to 4. */
|
|
14
15
|
readonly maxVoices?: number;
|
|
15
16
|
}
|
|
17
|
+
/** How one play of a cue differs: its volume, pan and rate. */
|
|
16
18
|
export interface AudioCuePlayOptions {
|
|
17
19
|
/** Multiplies the cue's volume, as for distance. */
|
|
18
20
|
readonly volume?: number;
|
|
@@ -20,6 +22,7 @@ export interface AudioCuePlayOptions {
|
|
|
20
22
|
/** Multiplies the chosen rate. */
|
|
21
23
|
readonly rate?: number;
|
|
22
24
|
}
|
|
25
|
+
/** Sound effects by name, each with its takes, cool-down and voice limit. */
|
|
23
26
|
export interface AudioCues {
|
|
24
27
|
/** Plays a take of the cue, or nothing when it is cooling down. */
|
|
25
28
|
play(name: string, options?: AudioCuePlayOptions): AudioVoice | undefined;
|
|
@@ -27,6 +30,7 @@ export interface AudioCues {
|
|
|
27
30
|
stop(name: string, fade?: number): void;
|
|
28
31
|
readonly names: readonly string[];
|
|
29
32
|
}
|
|
33
|
+
/** The clock and the random numbers cues choose by; give your own for tests and replays. */
|
|
30
34
|
export interface AudioCuesOptions {
|
|
31
35
|
/** Seconds now; `performance.now()` by default. Tests and replays give their own clock. */
|
|
32
36
|
readonly now?: () => number;
|
package/dist/audioTypes.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export type AudioMixerState = 'running' | 'suspended' | 'locked' | 'closed';
|
|
|
10
10
|
* released; or the mixer was disposed.
|
|
11
11
|
*/
|
|
12
12
|
export type AudioEndReason = 'finished' | 'stopped' | 'stolen' | 'limit' | 'silent' | 'released' | 'closed';
|
|
13
|
+
/** Whether a voice is playing, paused, fading out to stop, or has ended. */
|
|
13
14
|
export type AudioVoiceState = 'playing' | 'paused' | 'stopping' | 'ended';
|
|
14
15
|
/** Decoded samples held by the host, or a file it plays as it reads it. */
|
|
15
16
|
export interface AudioBackendSound {
|
|
@@ -27,6 +28,7 @@ export interface AudioBackendBus {
|
|
|
27
28
|
setGain(value: number, seconds: number): void;
|
|
28
29
|
release(): void;
|
|
29
30
|
}
|
|
31
|
+
/** What the mixer asks a backend to start: the sound, its bus, where and how it plays. */
|
|
30
32
|
export interface AudioBackendStart {
|
|
31
33
|
readonly sound: AudioBackendSound;
|
|
32
34
|
readonly bus: AudioBackendBus;
|
|
@@ -69,12 +71,14 @@ export interface AudioBackend {
|
|
|
69
71
|
resume(): void;
|
|
70
72
|
close(): void;
|
|
71
73
|
}
|
|
74
|
+
/** A bus to make: its name, its volume and whether it is muted. */
|
|
72
75
|
export interface AudioBusOptions {
|
|
73
76
|
readonly name: string;
|
|
74
77
|
/** 0 to 1. Defaults to 1. */
|
|
75
78
|
readonly volume?: number;
|
|
76
79
|
readonly muted?: boolean;
|
|
77
80
|
}
|
|
81
|
+
/** A mixer to make: its backend and buses, and how many voices, sounds and decoded bytes it holds. */
|
|
78
82
|
export interface AudioMixerOptions {
|
|
79
83
|
readonly backend: AudioBackend;
|
|
80
84
|
/** Named volumes under the master one. Defaults to 'music' and 'effects'. */
|
|
@@ -91,10 +95,12 @@ export interface AudioMixerOptions {
|
|
|
91
95
|
/** Decoded samples held at once, as bytes of 32-bit samples. Defaults to 128 MiB. */
|
|
92
96
|
readonly maxDecodedBytes?: number;
|
|
93
97
|
}
|
|
98
|
+
/** How long a change of volume takes. */
|
|
94
99
|
export interface AudioFade {
|
|
95
100
|
/** Seconds, 0 to 60. Defaults to 0. */
|
|
96
101
|
readonly fade?: number;
|
|
97
102
|
}
|
|
103
|
+
/** A group of voices with one volume and one mute, such as music or effects. */
|
|
98
104
|
export interface AudioBus {
|
|
99
105
|
readonly name: string;
|
|
100
106
|
readonly volume: number;
|
|
@@ -104,6 +110,7 @@ export interface AudioBus {
|
|
|
104
110
|
setVolume(value: number, options?: AudioFade): void;
|
|
105
111
|
setMuted(muted: boolean): void;
|
|
106
112
|
}
|
|
113
|
+
/** A sound the mixer can play: its length, channels and rate, and whether it is decoded or streamed. */
|
|
107
114
|
export interface AudioSound {
|
|
108
115
|
readonly duration: number;
|
|
109
116
|
readonly channels: number;
|
|
@@ -116,6 +123,7 @@ export interface AudioSound {
|
|
|
116
123
|
/** Ends its voices and gives the samples back. A scope can own a sound through this. */
|
|
117
124
|
release(): void;
|
|
118
125
|
}
|
|
126
|
+
/** How a sound is played: its bus, volume, rate, pan, loop, start and fade. */
|
|
119
127
|
export interface AudioPlayOptions {
|
|
120
128
|
/** Defaults to 'effects' when the mixer has that bus, otherwise to the first bus. */
|
|
121
129
|
readonly bus?: string;
|
|
@@ -138,6 +146,7 @@ export interface AudioPlayOptions {
|
|
|
138
146
|
*/
|
|
139
147
|
readonly whileSilent?: 'drop' | 'start';
|
|
140
148
|
}
|
|
149
|
+
/** How music is played: its bus, volume, fade, loop and start, and whether the same piece restarts. */
|
|
141
150
|
export interface AudioMusicOptions {
|
|
142
151
|
/** Defaults to 'music' when the mixer has that bus, otherwise to the first bus. */
|
|
143
152
|
readonly bus?: string;
|
|
@@ -150,6 +159,7 @@ export interface AudioMusicOptions {
|
|
|
150
159
|
/** Start again even when this sound is already the music. */
|
|
151
160
|
readonly restart?: boolean;
|
|
152
161
|
}
|
|
162
|
+
/** One sound playing: its state and position, and the calls that change or stop it. */
|
|
153
163
|
export interface AudioVoice {
|
|
154
164
|
readonly id: number;
|
|
155
165
|
readonly sound: AudioSound;
|
|
@@ -171,12 +181,14 @@ export interface AudioVoice {
|
|
|
171
181
|
resume(): void;
|
|
172
182
|
stop(options?: AudioFade): void;
|
|
173
183
|
}
|
|
184
|
+
/** A bus as it is now: its name, volume, mute and voices. */
|
|
174
185
|
export interface AudioBusSnapshot {
|
|
175
186
|
readonly name: string;
|
|
176
187
|
readonly volume: number;
|
|
177
188
|
readonly muted: boolean;
|
|
178
189
|
readonly voices: number;
|
|
179
190
|
}
|
|
191
|
+
/** The mixer as it is now: its state, buses, voices, sounds, decoded bytes and music. */
|
|
180
192
|
export interface AudioMixerSnapshot {
|
|
181
193
|
readonly state: AudioMixerState;
|
|
182
194
|
readonly locked: boolean;
|
|
@@ -197,6 +209,7 @@ export interface AudioMixerSnapshot {
|
|
|
197
209
|
readonly stolen: number;
|
|
198
210
|
};
|
|
199
211
|
}
|
|
212
|
+
/** Plays sounds and music on buses through a backend, within its limits of voices and memory. */
|
|
200
213
|
export interface AudioMixer {
|
|
201
214
|
readonly state: AudioMixerState;
|
|
202
215
|
readonly master: AudioBus;
|
|
@@ -3,7 +3,9 @@ import type { AssetLease, Bitmap, Scope, Texture } from '@egret/runtime';
|
|
|
3
3
|
import type { Engine } from './Engine.js';
|
|
4
4
|
import type { MouseInput, MouseInputPayload } from './mouseInputTypes.js';
|
|
5
5
|
declare const BITMAP_BUTTON_BRAND: unique symbol;
|
|
6
|
+
/** Whether a bitmap button is up, pressed, disabled or disposed. */
|
|
6
7
|
export type BitmapButtonState = 'up' | 'pressed' | 'disabled' | 'disposed';
|
|
8
|
+
/** A bitmap button to make: its engine, scope and input, its skins, and what it does when activated. */
|
|
7
9
|
export interface BitmapButtonOptions {
|
|
8
10
|
readonly engine: Engine;
|
|
9
11
|
readonly scope: Scope;
|
|
@@ -36,6 +36,7 @@ export interface BitmapFont {
|
|
|
36
36
|
/** What is added to the advance of `first` when `second` follows it; 0 for a pair it does not name. */
|
|
37
37
|
kerning(first: number, second: number): number;
|
|
38
38
|
}
|
|
39
|
+
/** How bitmap text is laid out: its width, alignment, spacing and kerning, and the character to fall back on. */
|
|
39
40
|
export interface BitmapTextLayoutOptions {
|
|
40
41
|
/** Lines are broken to fit this width: after spaces, and between ideographs. A word wider than it is broken between its characters. */
|
|
41
42
|
readonly maxWidth?: number;
|
|
@@ -62,6 +63,7 @@ export interface BitmapTextGlyph {
|
|
|
62
63
|
readonly sourceX: number;
|
|
63
64
|
readonly sourceY: number;
|
|
64
65
|
}
|
|
66
|
+
/** One laid out line of bitmap text: its characters, width and place. */
|
|
65
67
|
export interface BitmapTextLine {
|
|
66
68
|
readonly text: string;
|
|
67
69
|
/** From the left of its first character's advance to the end of its last, spaces at its end left out. */
|
|
@@ -80,6 +82,7 @@ export interface BitmapTextLayout {
|
|
|
80
82
|
/** Characters the font does not have, the fallback drawn for them or not. */
|
|
81
83
|
readonly missing: number;
|
|
82
84
|
}
|
|
85
|
+
/** Bitmap text to make: its font, pages, text and color, and how it is laid out. */
|
|
83
86
|
export interface BitmapTextOptions extends BitmapTextLayoutOptions {
|
|
84
87
|
readonly font: BitmapFont;
|
|
85
88
|
/** A leased texture for each page of the font, in the order of its pages. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Scope } from '@egret/runtime';
|
|
2
2
|
import type { AssetGroupOperations, AssetRef, Bitmap, EngineContext, Texture } from '@egret/runtime';
|
|
3
3
|
import type { Diagnostic } from '@egret/contracts';
|
|
4
|
+
/** Whether a bitmap resource slot is idle, loading a replacement, ready, failed, conflicted or disposed. */
|
|
4
5
|
export type BitmapResourceSlotState = 'idle' | 'pending' | 'ready' | 'failed' | 'conflicted' | 'disposed';
|
|
5
6
|
/** Owns only replacement leases; the exact initial Bitmap binding remains borrowed. */
|
|
6
7
|
export interface BitmapResourceSlot {
|
package/dist/camera2d.js
CHANGED
|
@@ -76,7 +76,7 @@ export function createCamera2D(options) {
|
|
|
76
76
|
const before = read(world);
|
|
77
77
|
const layers = [];
|
|
78
78
|
let width = w0, height = h0, zoom = z0, rotation = r0, bounds = b0 === undefined ? undefined : { ...b0 };
|
|
79
|
-
let cx = c0?.x ?? width / 2, cy = c0?.y ?? height / 2, trauma = 0, time = 0, closed = false;
|
|
79
|
+
let cx = c0?.x ?? width / 2, cy = c0?.y ?? height / 2, trauma = 0, shakeScale = 1, time = 0, closed = false;
|
|
80
80
|
let follow, move, zoomMove;
|
|
81
81
|
let shakeX = 0, shakeY = 0, shakeAngle = 0;
|
|
82
82
|
function open() {
|
|
@@ -268,6 +268,14 @@ export function createCamera2D(options) {
|
|
|
268
268
|
height = newHeight;
|
|
269
269
|
settle();
|
|
270
270
|
},
|
|
271
|
+
get shakeScale() {
|
|
272
|
+
return shakeScale;
|
|
273
|
+
},
|
|
274
|
+
set shakeScale(value) {
|
|
275
|
+
if (!finite(value) || value < 0 || value > 1)
|
|
276
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
277
|
+
shakeScale = value;
|
|
278
|
+
},
|
|
271
279
|
shake(shakeOptions = {}) {
|
|
272
280
|
if (!record(shakeOptions))
|
|
273
281
|
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
@@ -338,7 +346,7 @@ export function createCamera2D(options) {
|
|
|
338
346
|
cy += (wantY - cy) * pull;
|
|
339
347
|
}
|
|
340
348
|
trauma = Math.max(0, trauma - shakeDecay * seconds);
|
|
341
|
-
const strength = trauma * trauma, t = time * shakeFrequency;
|
|
349
|
+
const strength = trauma * trauma * shakeScale, t = time * shakeFrequency;
|
|
342
350
|
shakeX = shakeOffset * strength * noise(seed, 0, t);
|
|
343
351
|
shakeY = shakeOffset * strength * noise(seed, 1, t);
|
|
344
352
|
shakeAngle = shakeRotation * strength * noise(seed, 2, t);
|
package/dist/cameraTypes.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { DisplayObject } from '@egret/runtime';
|
|
2
|
+
/** A point in world coordinates. */
|
|
2
3
|
export interface CameraPoint {
|
|
3
4
|
readonly x: number;
|
|
4
5
|
readonly y: number;
|
|
5
6
|
}
|
|
7
|
+
/** A rectangle in world coordinates. */
|
|
6
8
|
export interface CameraRect {
|
|
7
9
|
readonly x: number;
|
|
8
10
|
readonly y: number;
|
|
@@ -11,6 +13,7 @@ export interface CameraRect {
|
|
|
11
13
|
}
|
|
12
14
|
/** What the camera follows: a display object inside the world, or a function that says where to look. */
|
|
13
15
|
export type CameraTarget = DisplayObject | (() => CameraPoint);
|
|
16
|
+
/** How the camera follows a target: how smoothly, the box it may move in unfollowed, and the offset. */
|
|
14
17
|
export interface CameraFollowOptions {
|
|
15
18
|
/** Seconds for the camera to close most of the distance (about 63 %). 0 follows at once. Defaults to 0.15. */
|
|
16
19
|
readonly smoothing?: number;
|
|
@@ -22,6 +25,7 @@ export interface CameraFollowOptions {
|
|
|
22
25
|
/** Added to the target's place, in world units. */
|
|
23
26
|
readonly offset?: CameraPoint;
|
|
24
27
|
}
|
|
28
|
+
/** How a layer moves and zooms with the camera, for parallax. */
|
|
25
29
|
export interface CameraLayerOptions {
|
|
26
30
|
/**
|
|
27
31
|
* How far the layer moves with the camera: 0 stands still, 1 moves with the world, 0.5 at half the speed. When the
|
|
@@ -31,10 +35,12 @@ export interface CameraLayerOptions {
|
|
|
31
35
|
/** How much of the zoom the layer takes: 0 none, 1 all of it. Defaults to 1. */
|
|
32
36
|
readonly zoomFactor?: number;
|
|
33
37
|
}
|
|
38
|
+
/** How much a shake adds to the camera's trauma. */
|
|
34
39
|
export interface CameraShakeOptions {
|
|
35
40
|
/** Added trauma, 0 to 1. The shake is as strong as the square of the trauma. Defaults to 0.5. */
|
|
36
41
|
readonly trauma?: number;
|
|
37
42
|
}
|
|
43
|
+
/** A 2D camera to make: the world it moves, the view's size, where it looks and how far it zooms, its bounds and its shake. */
|
|
38
44
|
export interface Camera2DOptions {
|
|
39
45
|
/** The container that holds the world. The camera owns its place, scale, rotation and anchor. */
|
|
40
46
|
readonly world: DisplayObject;
|
|
@@ -65,6 +71,7 @@ export interface Camera2DOptions {
|
|
|
65
71
|
/** Whole stage units for the place of the world, so that pixel art does not shimmer. Defaults to false. */
|
|
66
72
|
readonly roundToPixel?: boolean;
|
|
67
73
|
}
|
|
74
|
+
/** The camera as it is now: where it looks, its zoom and rotation, its trauma and its view. */
|
|
68
75
|
export interface CameraSnapshot {
|
|
69
76
|
readonly center: CameraPoint;
|
|
70
77
|
readonly zoom: number;
|
|
@@ -98,6 +105,11 @@ export interface Camera2D {
|
|
|
98
105
|
/** Changes what is shown, as when the canvas is resized. */
|
|
99
106
|
resize(width: number, height: number): void;
|
|
100
107
|
shake(options?: CameraShakeOptions): void;
|
|
108
|
+
/**
|
|
109
|
+
* How strongly shakes move the view, from 0 (still) to 1 (as asked, the default). Set it to 0 for a player who asks
|
|
110
|
+
* for less motion, as the browser kit's `prefersReducedMotion()` reports.
|
|
111
|
+
*/
|
|
112
|
+
shakeScale: number;
|
|
101
113
|
/** A layer drawn behind or in front of the world that moves at its own speed. The camera owns its place, scale and anchor. */
|
|
102
114
|
addLayer(layer: DisplayObject, options?: CameraLayerOptions): () => void;
|
|
103
115
|
/** Advances the follow, the pan, the zoom and the shake by the seconds given, and places the world and the layers. */
|
package/dist/contentTypes.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AssetLease, AssetProvider, Scope, SequenceClip, SpriteSheet, Texture } from '@egret/runtime';
|
|
2
2
|
import type { ManifestBinding, ManifestGroupOptions } from './manifestResourceTypes.js';
|
|
3
|
+
/** One resource a content loader binds: its id, its kind and its manifest binding. */
|
|
3
4
|
export interface ContentBinding {
|
|
4
5
|
readonly id: string;
|
|
5
6
|
readonly kind: 'image' | 'atlas' | 'sequence';
|
|
@@ -10,6 +11,7 @@ export interface ContentProviders {
|
|
|
10
11
|
readonly textures: AssetProvider<Texture>;
|
|
11
12
|
readonly metadata: AssetProvider<string>;
|
|
12
13
|
}
|
|
14
|
+
/** Makes the providers that load a content loader's resources, given what they bind. */
|
|
13
15
|
export type ContentProviderFactory = (bindings: readonly ContentBinding[]) => ContentProviders;
|
|
14
16
|
/** All returned values are borrowed until this group or its owning Scope retires. */
|
|
15
17
|
export interface ContentGroup {
|
|
@@ -8,11 +8,12 @@ export async function createEngineForProfile(options, profile) {
|
|
|
8
8
|
if (profile !== SHARED_FRAME_PROFILE_2D)
|
|
9
9
|
throw new EgretError('ENGINE_RENDER_PROFILE_UNSUPPORTED');
|
|
10
10
|
const host = options.host;
|
|
11
|
-
let advertisement, shared;
|
|
11
|
+
let advertisement, shared, space;
|
|
12
12
|
try {
|
|
13
13
|
const source = host;
|
|
14
14
|
advertisement = source.sharedFrameProfile;
|
|
15
15
|
shared = source.renderSharedFrame;
|
|
16
|
+
space = source.sharedBlendSpace;
|
|
16
17
|
}
|
|
17
18
|
catch (cause) {
|
|
18
19
|
throw new EgretError('INVALID_RENDERER', { cause });
|
|
@@ -21,6 +22,9 @@ export async function createEngineForProfile(options, profile) {
|
|
|
21
22
|
throw new EgretError('ENGINE_RENDER_PROFILE_UNSUPPORTED');
|
|
22
23
|
if (typeof shared !== 'function')
|
|
23
24
|
throw new EgretError('INVALID_RENDERER');
|
|
25
|
+
// The space the renderer mixes in; its frames record it. Linear light unless the renderer says otherwise.
|
|
26
|
+
if (space !== undefined && space !== 'linear' && space !== 'srgb')
|
|
27
|
+
throw new EgretError('INVALID_RENDERER');
|
|
24
28
|
const diagnostic = options.onDiagnostic;
|
|
25
29
|
const stableOptions = { host, ...(diagnostic === undefined ? {} : { onDiagnostic: diagnostic }) };
|
|
26
30
|
const timeoutMs = options.shutdownTimeoutMs ?? 1000;
|
|
@@ -34,9 +38,8 @@ export async function createEngineForProfile(options, profile) {
|
|
|
34
38
|
throw new EgretError('CLOCK_OPTIONS_INVALID', { cause });
|
|
35
39
|
}
|
|
36
40
|
const clockOptions = admitGameClockOptions(clockValue);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}, clockOptions);
|
|
41
|
+
// The Engine reads the renderer's blend space beside the declared ports.
|
|
42
|
+
const ports = Object.assign({ shared: shared, sharedProfile: profile }, { sharedBlendSpace: space === 'srgb' ? 'srgb' : 'linear' });
|
|
43
|
+
return startEngine(stableOptions, timeoutMs, ports, clockOptions);
|
|
41
44
|
}
|
|
42
45
|
//# sourceMappingURL=createEngineForProfile.js.map
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { AssetProvider, Scope } from '@egret/runtime';
|
|
2
2
|
import type { ManifestAssetBinding, ManifestGroupOptions } from './manifestResourceTypes.js';
|
|
3
|
+
/** One font a font content loader binds: its id, family and manifest binding. */
|
|
3
4
|
export interface FontContentBinding {
|
|
4
5
|
readonly id: string;
|
|
5
6
|
readonly family: string;
|
|
6
7
|
readonly binding: ManifestAssetBinding<Uint8Array>;
|
|
7
8
|
}
|
|
9
|
+
/** Makes the provider that loads the bytes of a font content loader's fonts. */
|
|
8
10
|
export type FontContentProviderFactory = (bindings: readonly FontContentBinding[]) => AssetProvider<Uint8Array>;
|
|
11
|
+
/** A loaded font: its id, family and identity, its size and format, and a copy of its bytes. */
|
|
9
12
|
export interface FontContentAsset {
|
|
10
13
|
readonly id: string;
|
|
11
14
|
readonly family: string;
|
|
@@ -15,6 +18,7 @@ export interface FontContentAsset {
|
|
|
15
18
|
/** Returns a fresh owned copy only while the genuine source group is ready. */
|
|
16
19
|
copyBytes(): Uint8Array;
|
|
17
20
|
}
|
|
21
|
+
/** Fonts loaded together: wait for them, read them, and dispose of them together. */
|
|
18
22
|
export interface FontContentGroup {
|
|
19
23
|
readonly ready: Promise<void>;
|
|
20
24
|
readonly closed: Promise<void>;
|
|
@@ -22,6 +26,7 @@ export interface FontContentGroup {
|
|
|
22
26
|
getFonts(): readonly FontContentAsset[];
|
|
23
27
|
dispose(): void;
|
|
24
28
|
}
|
|
29
|
+
/** Loads groups of fonts from a manifest. */
|
|
25
30
|
export interface FontContentLoader {
|
|
26
31
|
readonly isDisposed: boolean;
|
|
27
32
|
load(scope: Scope, roots: readonly string[], options?: ManifestGroupOptions): FontContentGroup;
|
package/dist/gameClockTypes.d.ts
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import type { Disposable } from '@egret/contracts';
|
|
2
2
|
import type { Scope } from '@egret/runtime';
|
|
3
|
+
/** The longest step the game clock takes in one tick, in seconds. */
|
|
3
4
|
export interface GameClockOptions {
|
|
4
5
|
readonly maxDeltaSeconds?: number;
|
|
5
6
|
}
|
|
7
|
+
/** Whether the game clock is running, paused or closed. */
|
|
6
8
|
export type GameClockState = 'running' | 'paused' | 'closed';
|
|
9
|
+
/** One tick of the game clock: its number, the seconds so far and the seconds since the last tick. */
|
|
7
10
|
export interface GameClockTick {
|
|
8
11
|
readonly tickId: number;
|
|
9
12
|
readonly elapsedSeconds: number;
|
|
10
13
|
readonly deltaSeconds: number;
|
|
11
14
|
}
|
|
15
|
+
/** Called on each tick of the game clock. */
|
|
12
16
|
export type GameClockHandler = (tick: GameClockTick) => undefined;
|
|
13
17
|
declare const clockBrand: unique symbol;
|
|
14
18
|
declare const subscriptionBrand: unique symbol;
|
|
19
|
+
/** A handler's place on the game clock; disposing it stops the calls. */
|
|
15
20
|
export interface GameClockSubscription extends Disposable {
|
|
16
21
|
readonly [subscriptionBrand]: true;
|
|
17
22
|
readonly isDisposed: boolean;
|
|
18
23
|
dispose(): void;
|
|
19
24
|
}
|
|
25
|
+
/** The Engine's game clock: it ticks while running, and handlers are called on each tick. */
|
|
20
26
|
export interface GameClock {
|
|
21
27
|
readonly [clockBrand]: true;
|
|
22
28
|
readonly state: GameClockState;
|
package/dist/gameRun.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Quality tiers from lowest to highest, as World3D names them. */
|
|
2
2
|
export declare const QUALITY_TIERS: readonly ["low", "medium", "high"];
|
|
3
|
+
/** One of the quality tiers, from the lowest to the highest. */
|
|
3
4
|
export type QualityTier = (typeof QUALITY_TIERS)[number];
|
|
4
5
|
/**
|
|
5
6
|
* Of several variants of one asset, the one for `quality`: an exact tier, or else the nearest below, or else the
|
|
@@ -16,6 +17,7 @@ export interface HeadlessGame<Input> {
|
|
|
16
17
|
/** One step of `seconds` with the stand-in player's input. */
|
|
17
18
|
update(seconds: number, input: Input): void;
|
|
18
19
|
}
|
|
20
|
+
/** A game run without a screen: the game and player to make for each seed, when it is done, and the step. */
|
|
19
21
|
export interface HeadlessRunOptions<G extends HeadlessGame<Input>, Input> {
|
|
20
22
|
/** A new game for a seed. */
|
|
21
23
|
readonly createGame: (seed: number) => G;
|
|
@@ -34,6 +36,7 @@ export interface HeadlessRunOptions<G extends HeadlessGame<Input>, Input> {
|
|
|
34
36
|
/** Milliseconds now; `performance.now()` by default. */
|
|
35
37
|
readonly now?: () => number;
|
|
36
38
|
}
|
|
39
|
+
/** What one seed's headless run did: whether it finished, its seconds and steps, its timings and its summary. */
|
|
37
40
|
export interface HeadlessRunResult {
|
|
38
41
|
readonly seed: number;
|
|
39
42
|
/** False when the run reached `maxSeconds` without `done`. */
|
package/dist/gamepadTypes.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** The buttons of a pad in the standard layout, by where they are: `a` is the lower face button. */
|
|
2
2
|
export type GamepadButtonName = 'a' | 'b' | 'x' | 'y' | 'l1' | 'r1' | 'l2' | 'r2' | 'select' | 'start' | 'l3' | 'r3' | 'up' | 'down' | 'left' | 'right' | 'home';
|
|
3
|
+
/** Which stick of a gamepad: the left or the right. */
|
|
3
4
|
export type GamepadStickName = 'left' | 'right';
|
|
5
|
+
/** A gamepad button now: whether it is pressed, and how far, 0 to 1. */
|
|
4
6
|
export interface GamepadButtonSample {
|
|
5
7
|
readonly pressed: boolean;
|
|
6
8
|
/** 0 to 1: how far a trigger is pulled. A plain button says 0 or 1. */
|
|
@@ -16,6 +18,7 @@ export interface GamepadSample {
|
|
|
16
18
|
/** -1 to 1 each. In the standard layout: left stick x and y, right stick x and y; down and right are positive. */
|
|
17
19
|
readonly axes: readonly number[];
|
|
18
20
|
}
|
|
21
|
+
/** Where a stick points, each axis -1 to 1, with the dead zone taken out. */
|
|
19
22
|
export interface GamepadStick {
|
|
20
23
|
readonly x: number;
|
|
21
24
|
readonly y: number;
|
|
@@ -36,6 +39,7 @@ export interface GamepadPad {
|
|
|
36
39
|
/** A stick with the dead zone taken out: nothing inside it, and the rest stretched to reach 1. */
|
|
37
40
|
stick(name: GamepadStickName): GamepadStick;
|
|
38
41
|
}
|
|
42
|
+
/** A button that was pressed or released: on which pad, which button, how far and when. */
|
|
39
43
|
export interface GamepadButtonChange {
|
|
40
44
|
readonly pad: number;
|
|
41
45
|
/** The number of the button on its pad. */
|
|
@@ -46,6 +50,7 @@ export interface GamepadButtonChange {
|
|
|
46
50
|
readonly value: number;
|
|
47
51
|
readonly timestamp: number;
|
|
48
52
|
}
|
|
53
|
+
/** A gamepad that was connected or disconnected: its pad, id, mapping and time. */
|
|
49
54
|
export interface GamepadConnectionChange {
|
|
50
55
|
readonly pad: number;
|
|
51
56
|
readonly id: string;
|
|
@@ -53,6 +58,7 @@ export interface GamepadConnectionChange {
|
|
|
53
58
|
readonly standard: boolean;
|
|
54
59
|
readonly timestamp: number;
|
|
55
60
|
}
|
|
61
|
+
/** How gamepads are read: the dead zone, how many pads, and what is called on buttons and connections. */
|
|
56
62
|
export interface GamepadInputOptions {
|
|
57
63
|
/** The part of a stick around its middle that counts as the middle, 0 to 0.9. Defaults to 0.15. */
|
|
58
64
|
readonly deadZone?: number;
|
|
@@ -108,6 +114,7 @@ export type GamepadKeyAction = {
|
|
|
108
114
|
} | {
|
|
109
115
|
readonly focus: 'next' | 'previous';
|
|
110
116
|
};
|
|
117
|
+
/** How a gamepad presses keyboard keys: which pad, the map of buttons and stick to keys, and the repeat. */
|
|
111
118
|
export interface GamepadKeysOptions {
|
|
112
119
|
readonly gamepad: GamepadInput;
|
|
113
120
|
readonly keyboard: GamepadKeyTarget;
|
|
@@ -125,6 +132,7 @@ export interface GamepadKeysOptions {
|
|
|
125
132
|
readonly repeatDelay?: number;
|
|
126
133
|
readonly repeatInterval?: number;
|
|
127
134
|
}
|
|
135
|
+
/** Keyboard keys held by a gamepad; dispose of it to release them. */
|
|
128
136
|
export interface GamepadKeys {
|
|
129
137
|
/** The keys held down now. */
|
|
130
138
|
readonly held: readonly string[];
|
|
@@ -2,6 +2,7 @@ import type { DisplayObject, EventType, Scope } from '@egret/runtime';
|
|
|
2
2
|
import type { Engine } from './Engine.js';
|
|
3
3
|
/** Pointers that can be over the scene without pressing it. A finger cannot. */
|
|
4
4
|
export type HoverPointerType = 'mouse' | 'pen';
|
|
5
|
+
/** Whether hover input passes input on, holds it, or has closed. */
|
|
5
6
|
export type HoverInputState = 'active' | 'suspended' | 'closed';
|
|
6
7
|
/**
|
|
7
8
|
* Why a target stopped being hovered: the pointer went to another target or to none, left the
|
|
@@ -10,7 +11,9 @@ export type HoverInputState = 'active' | 'suspended' | 'closed';
|
|
|
10
11
|
* suspended, disposed or failed.
|
|
11
12
|
*/
|
|
12
13
|
export type HoverLeaveReason = 'target' | 'outside' | 'contact' | 'pointercancel' | 'owner' | 'viewport' | 'blur' | 'hidden' | 'pagehide' | 'suspended' | 'dispose' | 'error';
|
|
14
|
+
/** What a wheel's deltas count: pixels, lines or pages. */
|
|
13
15
|
export type WheelUnit = 'pixel' | 'line' | 'page';
|
|
16
|
+
/** A pointer moving over the surface without a press: which pointer, where and when. */
|
|
14
17
|
export interface HoverSample {
|
|
15
18
|
readonly pointerId: number;
|
|
16
19
|
readonly pointerType: HoverPointerType;
|
|
@@ -28,6 +31,7 @@ export interface HoverTransition extends HoverPoint {
|
|
|
28
31
|
/** On an enter, what the pointer left in the same movement. On a leave, what it is going to. */
|
|
29
32
|
readonly related?: DisplayObject;
|
|
30
33
|
}
|
|
34
|
+
/** A turn of a wheel: where the pointer is, how far it turned in each axis, in what unit and when. */
|
|
31
35
|
export interface WheelSample {
|
|
32
36
|
readonly globalX: number;
|
|
33
37
|
readonly globalY: number;
|
|
@@ -40,10 +44,12 @@ export interface WheelSample {
|
|
|
40
44
|
/** The platform's zoom modifier was held, as a pinch on a trackpad also reports. */
|
|
41
45
|
readonly zoom?: boolean;
|
|
42
46
|
}
|
|
47
|
+
/** A wheel sample in order, with the viewport it was taken in. */
|
|
43
48
|
export interface WheelPoint extends WheelSample {
|
|
44
49
|
readonly sequence: number;
|
|
45
50
|
readonly viewportRevision: number;
|
|
46
51
|
}
|
|
52
|
+
/** A target that a pointer entered, moved over or left, and why it left. */
|
|
47
53
|
export interface HoverNotification {
|
|
48
54
|
readonly kind: 'enter' | 'move' | 'leave';
|
|
49
55
|
readonly point: HoverPoint;
|
|
@@ -53,12 +59,14 @@ export interface HoverNotification {
|
|
|
53
59
|
/** On an enter, what the pointer left in the same movement. On a leave, what it is going to. */
|
|
54
60
|
readonly related?: DisplayObject;
|
|
55
61
|
}
|
|
62
|
+
/** A wheel turn and the target it went to, and whether that target took it. */
|
|
56
63
|
export interface WheelNotification {
|
|
57
64
|
readonly point: WheelPoint;
|
|
58
65
|
readonly target: DisplayObject | undefined;
|
|
59
66
|
/** A listener on the target path prevented the default. */
|
|
60
67
|
readonly consumed: boolean;
|
|
61
68
|
}
|
|
69
|
+
/** Hover input to make: its engine and scope, the surface's size, its limits, and what is called. */
|
|
62
70
|
export interface HoverInputOptions {
|
|
63
71
|
readonly engine: Engine;
|
|
64
72
|
readonly scope: Scope;
|
|
@@ -72,6 +80,7 @@ export interface HoverInputOptions {
|
|
|
72
80
|
/** Runs after the target path of a wheel. Returning true consumes a wheel nothing else consumed. */
|
|
73
81
|
readonly onWheel?: (notification: WheelNotification) => boolean | void;
|
|
74
82
|
}
|
|
83
|
+
/** The event types hover input dispatches: enter, move, leave and wheel. */
|
|
75
84
|
export interface HoverInputEvents {
|
|
76
85
|
readonly enter: EventType<HoverTransition>;
|
|
77
86
|
readonly move: EventType<HoverPoint>;
|
|
@@ -80,6 +89,7 @@ export interface HoverInputEvents {
|
|
|
80
89
|
}>;
|
|
81
90
|
readonly wheel: EventType<WheelPoint>;
|
|
82
91
|
}
|
|
92
|
+
/** Where a pointer hovers and the target under it. */
|
|
83
93
|
export interface HoverState {
|
|
84
94
|
readonly point: HoverPoint;
|
|
85
95
|
readonly target: DisplayObject | undefined;
|