@egret/engine 0.0.0-stage → 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/LICENSE +201 -0
- package/NOTICE +21 -0
- package/README.md +101 -2
- package/README.zh-CN.md +102 -0
- package/dist/Engine.d.ts +77 -0
- package/dist/Engine.js +469 -0
- package/dist/animation/index.d.ts +6 -0
- package/dist/animation/index.js +5 -0
- package/dist/animation/sequenceController.d.ts +22 -0
- package/dist/animation/sequenceController.js +618 -0
- package/dist/animation/sequenceCoordinator.d.ts +26 -0
- package/dist/animation/sequenceCoordinator.js +161 -0
- package/dist/animation/sequenceInput.d.ts +25 -0
- package/dist/animation/sequenceInput.js +108 -0
- package/dist/animation/sequenceMath.d.ts +35 -0
- package/dist/animation/sequenceMath.js +164 -0
- package/dist/animation/sequenceResetSlot.d.ts +7 -0
- package/dist/animation/sequenceResetSlot.js +367 -0
- package/dist/animation/sequenceResetTypes.d.ts +48 -0
- package/dist/animation/sequenceResetTypes.js +2 -0
- package/dist/animation/types.d.ts +75 -0
- package/dist/animation/types.js +2 -0
- package/dist/assetBundle.d.ts +54 -0
- package/dist/assetBundle.js +173 -0
- package/dist/assetGroup.d.ts +17 -0
- package/dist/assetGroup.js +332 -0
- package/dist/assetGroupTypes.d.ts +17 -0
- package/dist/assetGroupTypes.js +2 -0
- package/dist/audio.d.ts +4 -0
- package/dist/audio.js +4 -0
- package/dist/audioCues.d.ts +47 -0
- package/dist/audioCues.js +127 -0
- package/dist/audioMixer.d.ts +7 -0
- package/dist/audioMixer.js +785 -0
- package/dist/audioTypes.d.ts +246 -0
- package/dist/audioTypes.js +3 -0
- package/dist/bitmapBindingTicket.d.ts +24 -0
- package/dist/bitmapBindingTicket.js +215 -0
- package/dist/bitmapButton.d.ts +4 -0
- package/dist/bitmapButton.js +407 -0
- package/dist/bitmapButtonTypes.d.ts +31 -0
- package/dist/bitmapButtonTypes.js +2 -0
- package/dist/bitmapFontParse.d.ts +10 -0
- package/dist/bitmapFontParse.js +246 -0
- package/dist/bitmapFontTypes.d.ts +112 -0
- package/dist/bitmapFontTypes.js +2 -0
- package/dist/bitmapResourceSlot.d.ts +26 -0
- package/dist/bitmapResourceSlot.js +340 -0
- package/dist/bitmapText.d.ts +6 -0
- package/dist/bitmapText.js +320 -0
- package/dist/bitmapfont.d.ts +5 -0
- package/dist/bitmapfont.js +5 -0
- package/dist/camera.d.ts +4 -0
- package/dist/camera.js +4 -0
- package/dist/camera2d.d.ts +7 -0
- package/dist/camera2d.js +419 -0
- package/dist/cameraTypes.d.ts +126 -0
- package/dist/cameraTypes.js +2 -0
- package/dist/closeHost.d.ts +4 -0
- package/dist/closeHost.js +66 -0
- package/dist/contentArtifacts.d.ts +12 -0
- package/dist/contentArtifacts.js +153 -0
- package/dist/contentAtlasPages.d.ts +13 -0
- package/dist/contentAtlasPages.js +117 -0
- package/dist/contentLoader.d.ts +6 -0
- package/dist/contentLoader.js +327 -0
- package/dist/contentTypes.d.ts +35 -0
- package/dist/contentTypes.js +2 -0
- package/dist/createEngine.d.ts +7 -0
- package/dist/createEngine.js +25 -0
- package/dist/createEngineForProfile.d.ts +5 -0
- package/dist/createEngineForProfile.js +45 -0
- package/dist/displaySubtreeTicket.d.ts +25 -0
- package/dist/displaySubtreeTicket.js +76 -0
- package/dist/fontContentLoader.d.ts +6 -0
- package/dist/fontContentLoader.js +298 -0
- package/dist/fontContentTypes.d.ts +39 -0
- package/dist/fontContentTypes.js +2 -0
- package/dist/gameClock.d.ts +24 -0
- package/dist/gameClock.js +246 -0
- package/dist/gameClockTypes.d.ts +37 -0
- package/dist/gameClockTypes.js +2 -0
- package/dist/gameRun.d.ts +53 -0
- package/dist/gameRun.js +97 -0
- package/dist/gamepad.d.ts +5 -0
- package/dist/gamepad.js +5 -0
- package/dist/gamepadInput.d.ts +4 -0
- package/dist/gamepadInput.js +281 -0
- package/dist/gamepadKeys.d.ts +4 -0
- package/dist/gamepadKeys.js +205 -0
- package/dist/gamepadTypes.d.ts +142 -0
- package/dist/gamepadTypes.js +3 -0
- package/dist/hover.d.ts +4 -0
- package/dist/hover.js +4 -0
- package/dist/hoverInput.d.ts +8 -0
- package/dist/hoverInput.js +503 -0
- package/dist/hoverInputTypes.d.ts +129 -0
- package/dist/hoverInputTypes.js +2 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +21 -0
- package/dist/input.d.ts +6 -0
- package/dist/input.js +5 -0
- package/dist/inputActions.d.ts +86 -0
- package/dist/inputActions.js +330 -0
- package/dist/internal/contentFactoryState.d.ts +19 -0
- package/dist/internal/contentFactoryState.js +42 -0
- package/dist/internal/mouseInputFactoryState.d.ts +57 -0
- package/dist/internal/mouseInputFactoryState.js +125 -0
- package/dist/internal/sequenceControllerFactoryState.d.ts +42 -0
- package/dist/internal/sequenceControllerFactoryState.js +98 -0
- package/dist/internal/textFieldFactoryState.d.ts +11 -0
- package/dist/internal/textFieldFactoryState.js +32 -0
- package/dist/internal/texturedFrameState.d.ts +4 -0
- package/dist/internal/texturedFrameState.js +12 -0
- package/dist/internal/uiFactoryState.d.ts +68 -0
- package/dist/internal/uiFactoryState.js +173 -0
- package/dist/internal/uiRootState.d.ts +67 -0
- package/dist/internal/uiRootState.js +103 -0
- package/dist/keyboardInput.d.ts +13 -0
- package/dist/keyboardInput.js +579 -0
- package/dist/keyboardInputTypes.d.ts +93 -0
- package/dist/keyboardInputTypes.js +2 -0
- package/dist/kit.d.ts +16 -0
- package/dist/kit.js +10 -0
- package/dist/layout.d.ts +5 -0
- package/dist/layout.js +132 -0
- package/dist/layoutTypes.d.ts +28 -0
- package/dist/layoutTypes.js +2 -0
- package/dist/manifestAssetGroup.d.ts +10 -0
- package/dist/manifestAssetGroup.js +477 -0
- package/dist/manifestResourceState.d.ts +17 -0
- package/dist/manifestResourceState.js +58 -0
- package/dist/manifestResourceTypes.d.ts +26 -0
- package/dist/manifestResourceTypes.js +2 -0
- package/dist/motion.d.ts +35 -0
- package/dist/motion.js +206 -0
- package/dist/mouseInput.d.ts +102 -0
- package/dist/mouseInput.js +562 -0
- package/dist/mouseInputTypes.d.ts +41 -0
- package/dist/mouseInputTypes.js +2 -0
- package/dist/paragraph.d.ts +8 -0
- package/dist/paragraph.js +7 -0
- package/dist/particleEmitter.d.ts +4 -0
- package/dist/particleEmitter.js +300 -0
- package/dist/particleTypes.d.ts +115 -0
- package/dist/particleTypes.js +2 -0
- package/dist/particles.d.ts +4 -0
- package/dist/particles.js +4 -0
- package/dist/physics2d.d.ts +4 -0
- package/dist/physics2d.js +4 -0
- package/dist/physics2dGeometry.d.ts +39 -0
- package/dist/physics2dGeometry.js +230 -0
- package/dist/physics2dTypes.d.ts +221 -0
- package/dist/physics2dTypes.js +2 -0
- package/dist/physics2dWorld.d.ts +4 -0
- package/dist/physics2dWorld.js +823 -0
- package/dist/pointerInput.d.ts +12 -0
- package/dist/pointerInput.js +300 -0
- package/dist/pointerInputTypes.d.ts +41 -0
- package/dist/pointerInputTypes.js +2 -0
- package/dist/random.d.ts +30 -0
- package/dist/random.js +131 -0
- package/dist/rendering/ownedPreparationFailure2D.d.ts +5 -0
- package/dist/rendering/ownedPreparationFailure2D.js +33 -0
- package/dist/rendering/packSharedDraws2D.d.ts +50 -0
- package/dist/rendering/packSharedDraws2D.js +379 -0
- package/dist/rendering/packedOrientation.d.ts +4 -0
- package/dist/rendering/packedOrientation.js +7 -0
- package/dist/rendering/prepareRectangles2D.d.ts +92 -0
- package/dist/rendering/prepareRectangles2D.js +481 -0
- package/dist/rendering/prepareSharedDraws2D.d.ts +90 -0
- package/dist/rendering/prepareSharedDraws2D.js +663 -0
- package/dist/rendering/preparedBatches2D.d.ts +17 -0
- package/dist/rendering/preparedBatches2D.js +30 -0
- package/dist/rendering/preparedSharedBatches2D.d.ts +44 -0
- package/dist/rendering/preparedSharedBatches2D.js +247 -0
- package/dist/rendering/sharedColor2D.d.ts +52 -0
- package/dist/rendering/sharedColor2D.js +191 -0
- package/dist/rendering/sharedEffects2D.d.ts +23 -0
- package/dist/rendering/sharedEffects2D.js +126 -0
- package/dist/rendering/sharedPreparationRetention2D.d.ts +120 -0
- package/dist/rendering/sharedPreparationRetention2D.js +357 -0
- package/dist/rendering/srgbBytes.d.ts +3 -0
- package/dist/rendering/srgbBytes.js +64 -0
- package/dist/rendering/texturedPreparationBudget2D.d.ts +31 -0
- package/dist/rendering/texturedPreparationBudget2D.js +81 -0
- package/dist/rendering/world3d/Animation3D.d.ts +104 -0
- package/dist/rendering/world3d/Animation3D.js +384 -0
- package/dist/rendering/world3d/AnimationTexture3D.d.ts +163 -0
- package/dist/rendering/world3d/AnimationTexture3D.js +603 -0
- package/dist/rendering/world3d/Batch3D.d.ts +75 -0
- package/dist/rendering/world3d/Batch3D.js +332 -0
- package/dist/rendering/world3d/Camera3D.d.ts +62 -0
- package/dist/rendering/world3d/Camera3D.js +132 -0
- package/dist/rendering/world3d/Character3D.d.ts +127 -0
- package/dist/rendering/world3d/Character3D.js +305 -0
- package/dist/rendering/world3d/Cloth3D.d.ts +130 -0
- package/dist/rendering/world3d/Cloth3D.js +503 -0
- package/dist/rendering/world3d/Compression3D.d.ts +22 -0
- package/dist/rendering/world3d/Compression3D.js +703 -0
- package/dist/rendering/world3d/Curves3D.d.ts +119 -0
- package/dist/rendering/world3d/Curves3D.js +460 -0
- package/dist/rendering/world3d/Decal3D.d.ts +43 -0
- package/dist/rendering/world3d/Decal3D.js +242 -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 +95 -0
- package/dist/rendering/world3d/Geometry3D.js +335 -0
- package/dist/rendering/world3d/GeometryBuilder3D.d.ts +53 -0
- package/dist/rendering/world3d/GeometryBuilder3D.js +196 -0
- package/dist/rendering/world3d/Gizmo3D.d.ts +80 -0
- package/dist/rendering/world3d/Gizmo3D.js +514 -0
- package/dist/rendering/world3d/Gltf3D.d.ts +73 -0
- package/dist/rendering/world3d/Gltf3D.js +996 -0
- package/dist/rendering/world3d/GpuParticles3D.d.ts +109 -0
- package/dist/rendering/world3d/GpuParticles3D.js +401 -0
- package/dist/rendering/world3d/Hdr3D.d.ts +35 -0
- package/dist/rendering/world3d/Hdr3D.js +191 -0
- package/dist/rendering/world3d/Jelly3D.d.ts +77 -0
- package/dist/rendering/world3d/Jelly3D.js +267 -0
- package/dist/rendering/world3d/Ktx23D.d.ts +30 -0
- package/dist/rendering/world3d/Ktx23D.js +112 -0
- package/dist/rendering/world3d/Light3D.d.ts +84 -0
- package/dist/rendering/world3d/Light3D.js +97 -0
- package/dist/rendering/world3d/Material3D.d.ts +253 -0
- package/dist/rendering/world3d/Material3D.js +269 -0
- package/dist/rendering/world3d/Mesh3D.d.ts +112 -0
- package/dist/rendering/world3d/Mesh3D.js +337 -0
- package/dist/rendering/world3d/Meshopt3D.d.ts +15 -0
- package/dist/rendering/world3d/Meshopt3D.js +276 -0
- package/dist/rendering/world3d/Navigation3D.d.ts +213 -0
- package/dist/rendering/world3d/Navigation3D.js +1043 -0
- package/dist/rendering/world3d/Object3D.d.ts +118 -0
- package/dist/rendering/world3d/Object3D.js +315 -0
- package/dist/rendering/world3d/Particles3D.d.ts +90 -0
- package/dist/rendering/world3d/Particles3D.js +277 -0
- package/dist/rendering/world3d/Physics3D.d.ts +430 -0
- package/dist/rendering/world3d/Physics3D.js +2840 -0
- package/dist/rendering/world3d/PhysicsHull3D.d.ts +37 -0
- package/dist/rendering/world3d/PhysicsHull3D.js +229 -0
- package/dist/rendering/world3d/PhysicsMesh3D.d.ts +41 -0
- package/dist/rendering/world3d/PhysicsMesh3D.js +340 -0
- package/dist/rendering/world3d/PhysicsQueries3D.d.ts +24 -0
- package/dist/rendering/world3d/PhysicsQueries3D.js +323 -0
- package/dist/rendering/world3d/PhysicsRemote3D.d.ts +179 -0
- package/dist/rendering/world3d/PhysicsRemote3D.js +536 -0
- package/dist/rendering/world3d/Ragdoll3D.d.ts +74 -0
- package/dist/rendering/world3d/Ragdoll3D.js +202 -0
- package/dist/rendering/world3d/Raycast3D.d.ts +40 -0
- package/dist/rendering/world3d/Raycast3D.js +247 -0
- package/dist/rendering/world3d/RenderList3D.d.ts +91 -0
- package/dist/rendering/world3d/RenderList3D.js +502 -0
- package/dist/rendering/world3d/Retarget3D.d.ts +21 -0
- package/dist/rendering/world3d/Retarget3D.js +185 -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 +66 -0
- package/dist/rendering/world3d/Serialize3D.js +629 -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 +87 -0
- package/dist/rendering/world3d/StateMachine3D.js +280 -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 +248 -0
- package/dist/rendering/world3d/Terrain3D.js +827 -0
- package/dist/rendering/world3d/Text3D.d.ts +95 -0
- package/dist/rendering/world3d/Text3D.js +560 -0
- package/dist/rendering/world3d/Texture3D.d.ts +148 -0
- package/dist/rendering/world3d/Texture3D.js +270 -0
- package/dist/rendering/world3d/Trail3D.d.ts +62 -0
- package/dist/rendering/world3d/Trail3D.js +195 -0
- package/dist/rendering/world3d/Vehicle3D.d.ts +102 -0
- package/dist/rendering/world3d/Vehicle3D.js +228 -0
- package/dist/rendering/world3d/VolumetricFog3D.d.ts +57 -0
- package/dist/rendering/world3d/VolumetricFog3D.js +230 -0
- package/dist/rendering/world3d/Water3D.d.ts +165 -0
- package/dist/rendering/world3d/Water3D.js +607 -0
- package/dist/rendering/world3d/core3D.d.ts +36 -0
- package/dist/rendering/world3d/core3D.js +99 -0
- package/dist/rendering/world3d/debug3D.d.ts +69 -0
- package/dist/rendering/world3d/debug3D.js +262 -0
- package/dist/rendering/world3d/decoders3D.d.ts +42 -0
- package/dist/rendering/world3d/decoders3D.js +133 -0
- package/dist/rendering/world3d/geometries3D.d.ts +111 -0
- package/dist/rendering/world3d/geometries3D.js +610 -0
- package/dist/rendering/world3d/helpers3D.d.ts +67 -0
- package/dist/rendering/world3d/helpers3D.js +178 -0
- package/dist/rendering/world3d/index.d.ts +103 -0
- package/dist/rendering/world3d/index.js +62 -0
- package/dist/rendering/world3d/math3D.d.ts +114 -0
- package/dist/rendering/world3d/math3D.js +675 -0
- package/dist/rendering/world3d/primitives3D.d.ts +67 -0
- package/dist/rendering/world3d/primitives3D.js +197 -0
- package/dist/resources.d.ts +8 -0
- package/dist/resources.js +6 -0
- package/dist/saveStore.d.ts +71 -0
- package/dist/saveStore.js +182 -0
- package/dist/semanticList.d.ts +126 -0
- package/dist/semanticList.js +175 -0
- package/dist/semanticTree.d.ts +10 -0
- package/dist/semanticTree.js +539 -0
- package/dist/semanticTypes.d.ts +175 -0
- package/dist/semanticTypes.js +2 -0
- package/dist/semantics.d.ts +6 -0
- package/dist/semantics.js +5 -0
- package/dist/sequencePlayback.d.ts +19 -0
- package/dist/sequencePlayback.js +391 -0
- package/dist/sequencePlaybackTypes.d.ts +24 -0
- package/dist/sequencePlaybackTypes.js +2 -0
- package/dist/sequenceTargetClaims.d.ts +10 -0
- package/dist/sequenceTargetClaims.js +31 -0
- package/dist/srgbBytes.d.ts +3 -0
- package/dist/srgbBytes.js +64 -0
- package/dist/startEngine.d.ts +5 -0
- package/dist/startEngine.js +31 -0
- package/dist/surfaceOwnership.d.ts +3 -0
- package/dist/surfaceOwnership.js +15 -0
- package/dist/text.d.ts +24 -0
- package/dist/text.js +4 -0
- package/dist/textField.d.ts +6 -0
- package/dist/textField.js +6 -0
- package/dist/textTable.d.ts +41 -0
- package/dist/textTable.js +114 -0
- package/dist/tileMapDraw.d.ts +7 -0
- package/dist/tileMapDraw.js +310 -0
- package/dist/tiledImport.d.ts +9 -0
- package/dist/tiledImport.js +357 -0
- package/dist/tilemap.d.ts +5 -0
- package/dist/tilemap.js +5 -0
- package/dist/tilemapTypes.d.ts +182 -0
- package/dist/tilemapTypes.js +2 -0
- package/dist/timer.d.ts +34 -0
- package/dist/timer.js +119 -0
- package/dist/tween.d.ts +15 -0
- package/dist/tween.js +329 -0
- package/dist/tweenTypes.d.ts +31 -0
- package/dist/tweenTypes.js +2 -0
- package/dist/ui/controlKeys.d.ts +113 -0
- package/dist/ui/controlKeys.js +250 -0
- package/dist/ui/controls.d.ts +58 -0
- package/dist/ui/controls.js +290 -0
- package/dist/ui/editing.d.ts +3 -0
- package/dist/ui/editing.js +3 -0
- package/dist/ui/index.d.ts +19 -0
- package/dist/ui/index.js +11 -0
- package/dist/ui/keyboardFocus.d.ts +32 -0
- package/dist/ui/keyboardFocus.js +146 -0
- package/dist/ui/layerTypes.d.ts +98 -0
- package/dist/ui/layerTypes.js +2 -0
- package/dist/ui/layers.d.ts +4 -0
- package/dist/ui/layers.js +586 -0
- package/dist/ui/leafContent.d.ts +21 -0
- package/dist/ui/leafContent.js +136 -0
- package/dist/ui/rangeControl.d.ts +53 -0
- package/dist/ui/rangeControl.js +168 -0
- package/dist/ui/scrollControl.d.ts +84 -0
- package/dist/ui/scrollControl.js +222 -0
- package/dist/ui/stateControls.d.ts +90 -0
- package/dist/ui/stateControls.js +331 -0
- package/dist/ui/textEditor.d.ts +54 -0
- package/dist/ui/textEditor.js +371 -0
- package/dist/ui/textEditorTypes.d.ts +85 -0
- package/dist/ui/textEditorTypes.js +2 -0
- package/dist/ui/textFieldControl.d.ts +100 -0
- package/dist/ui/textFieldControl.js +260 -0
- package/dist/ui/theme.d.ts +64 -0
- package/dist/ui/theme.js +166 -0
- package/dist/ui/types.d.ts +285 -0
- package/dist/ui/types.js +2 -0
- package/dist/ui/uiRoot.d.ts +4 -0
- package/dist/ui/uiRoot.js +1526 -0
- package/dist/ui/uiRootDisplay.d.ts +46 -0
- package/dist/ui/uiRootDisplay.js +148 -0
- package/dist/ui/uiRootModel.d.ts +114 -0
- package/dist/ui/uiRootModel.js +66 -0
- package/dist/ui/virtualList.d.ts +20 -0
- package/dist/ui/virtualList.js +105 -0
- package/dist/video.d.ts +4 -0
- package/dist/video.js +4 -0
- package/dist/videoPlayer.d.ts +4 -0
- package/dist/videoPlayer.js +215 -0
- package/dist/videoTypes.d.ts +77 -0
- package/dist/videoTypes.js +2 -0
- package/dist/web/BrowserAssetBundle.d.ts +41 -0
- package/dist/web/BrowserAssetBundle.js +136 -0
- package/dist/web/BrowserAudio.d.ts +74 -0
- package/dist/web/BrowserAudio.js +503 -0
- package/dist/web/BrowserFrameLoop.d.ts +69 -0
- package/dist/web/BrowserFrameLoop.js +125 -0
- package/dist/web/BrowserGame.d.ts +174 -0
- package/dist/web/BrowserGame.js +473 -0
- package/dist/web/BrowserGamepadInput.d.ts +38 -0
- package/dist/web/BrowserGamepadInput.js +134 -0
- package/dist/web/BrowserHoverInput.d.ts +25 -0
- package/dist/web/BrowserHoverInput.js +266 -0
- package/dist/web/BrowserImageTextures.d.ts +72 -0
- package/dist/web/BrowserImageTextures.js +169 -0
- package/dist/web/BrowserInputActions.d.ts +63 -0
- package/dist/web/BrowserInputActions.js +345 -0
- package/dist/web/BrowserKeyboardInput.d.ts +4 -0
- package/dist/web/BrowserKeyboardInput.js +223 -0
- package/dist/web/BrowserPlay.d.ts +417 -0
- package/dist/web/BrowserPlay.js +1648 -0
- package/dist/web/BrowserPointerInput.d.ts +4 -0
- package/dist/web/BrowserPointerInput.js +511 -0
- package/dist/web/BrowserPreferences.d.ts +10 -0
- package/dist/web/BrowserPreferences.js +39 -0
- package/dist/web/BrowserSemantics.d.ts +36 -0
- package/dist/web/BrowserSemantics.js +418 -0
- package/dist/web/BrowserStatsPanel.d.ts +56 -0
- package/dist/web/BrowserStatsPanel.js +143 -0
- package/dist/web/BrowserStorage.d.ts +35 -0
- package/dist/web/BrowserStorage.js +132 -0
- package/dist/web/BrowserTextEditor.d.ts +52 -0
- package/dist/web/BrowserTextEditor.js +839 -0
- package/dist/web/BrowserTextInput.d.ts +89 -0
- package/dist/web/BrowserTextInput.js +524 -0
- package/dist/web/BrowserTextureProvider.d.ts +58 -0
- package/dist/web/BrowserTextureProvider.js +935 -0
- package/dist/web/BrowserVideo.d.ts +40 -0
- package/dist/web/BrowserVideo.js +237 -0
- package/dist/web/CanvasKitFontSetProvider.d.ts +32 -0
- package/dist/web/CanvasKitFontSetProvider.js +215 -0
- package/dist/web/CanvasKitParagraphProvider.d.ts +173 -0
- package/dist/web/CanvasKitParagraphProvider.js +692 -0
- package/dist/web/CanvasTextRasterProvider.d.ts +4 -0
- package/dist/web/CanvasTextRasterProvider.js +312 -0
- package/dist/web/ManifestByteSource.d.ts +151 -0
- package/dist/web/ManifestByteSource.js +975 -0
- package/dist/web/ManifestFontContentLoader.d.ts +13 -0
- package/dist/web/ManifestFontContentLoader.js +30 -0
- package/dist/web/MouseInput.d.ts +4 -0
- package/dist/web/MouseInput.js +218 -0
- package/dist/web/WebGL2Host.d.ts +5 -0
- package/dist/web/WebGL2Host.js +2711 -0
- package/dist/web/WebGPUHost.d.ts +100 -0
- package/dist/web/WebGPUHost.js +3430 -0
- package/dist/web/audio.d.ts +3 -0
- package/dist/web/audio.js +4 -0
- package/dist/web/canvasKitParagraphGeometry.d.ts +27 -0
- package/dist/web/canvasKitParagraphGeometry.js +83 -0
- package/dist/web/editing.d.ts +5 -0
- package/dist/web/editing.js +4 -0
- package/dist/web/editorFonts.d.ts +54 -0
- package/dist/web/editorFonts.js +297 -0
- package/dist/web/game.d.ts +5 -0
- package/dist/web/game.js +6 -0
- package/dist/web/gamepad.d.ts +3 -0
- package/dist/web/gamepad.js +4 -0
- package/dist/web/hover.d.ts +3 -0
- package/dist/web/hover.js +4 -0
- package/dist/web/image.d.ts +4 -0
- package/dist/web/image.js +4 -0
- package/dist/web/imageProjections2D.d.ts +16 -0
- package/dist/web/imageProjections2D.js +2 -0
- package/dist/web/input.d.ts +6 -0
- package/dist/web/input.js +4 -0
- package/dist/web/keyboard.d.ts +3 -0
- package/dist/web/keyboard.js +3 -0
- package/dist/web/kit.d.ts +11 -0
- package/dist/web/kit.js +8 -0
- package/dist/web/loop.d.ts +3 -0
- package/dist/web/loop.js +4 -0
- package/dist/web/paragraph.d.ts +6 -0
- package/dist/web/paragraph.js +4 -0
- package/dist/web/play.d.ts +10 -0
- package/dist/web/play.js +9 -0
- package/dist/web/playMusic.d.ts +33 -0
- package/dist/web/playMusic.js +194 -0
- package/dist/web/playSfx.d.ts +36 -0
- package/dist/web/playSfx.js +112 -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/pointer.d.ts +3 -0
- package/dist/web/pointer.js +3 -0
- package/dist/web/prepareSharedSubmission2D.d.ts +27 -0
- package/dist/web/prepareSharedSubmission2D.js +63 -0
- package/dist/web/resources.d.ts +29 -0
- package/dist/web/resources.js +96 -0
- package/dist/web/semantics.d.ts +3 -0
- package/dist/web/semantics.js +4 -0
- package/dist/web/sharedDeviceSession.d.ts +64 -0
- package/dist/web/sharedDeviceSession.js +2 -0
- package/dist/web/sharedEffectShaders.d.ts +13 -0
- package/dist/web/sharedEffectShaders.js +181 -0
- package/dist/web/sharedFrameUpload.d.ts +25 -0
- package/dist/web/sharedFrameUpload.js +2 -0
- package/dist/web/sharedHostDeferred.d.ts +7 -0
- package/dist/web/sharedHostDeferred.js +12 -0
- package/dist/web/sharedRetentionLedger.d.ts +85 -0
- package/dist/web/sharedRetentionLedger.js +391 -0
- package/dist/web/sharedSubmissionStorage2D.d.ts +56 -0
- package/dist/web/sharedSubmissionStorage2D.js +73 -0
- package/dist/web/sharedWebGL2Arena.d.ts +40 -0
- package/dist/web/sharedWebGL2Arena.js +77 -0
- package/dist/web/sharedWebGL2Options.d.ts +33 -0
- package/dist/web/sharedWebGL2Options.js +102 -0
- package/dist/web/sharedWebGL2Shaders.d.ts +33 -0
- package/dist/web/sharedWebGL2Shaders.js +408 -0
- package/dist/web/sharedWebGPUOptions.d.ts +41 -0
- package/dist/web/sharedWebGPUOptions.js +130 -0
- package/dist/web/text.d.ts +3 -0
- package/dist/web/text.js +3 -0
- package/dist/web/textInput.d.ts +3 -0
- package/dist/web/textInput.js +3 -0
- package/dist/web/video.d.ts +3 -0
- package/dist/web/video.js +4 -0
- package/dist/web/webgl2.d.ts +7 -0
- package/dist/web/webgl2.js +4 -0
- package/dist/web/webgl2LayerState.d.ts +50 -0
- package/dist/web/webgl2LayerState.js +102 -0
- package/dist/web/webgl2Native.d.ts +72 -0
- package/dist/web/webgl2Native.js +572 -0
- package/dist/web/webgl2Types.d.ts +150 -0
- package/dist/web/webgl2Types.js +2 -0
- package/dist/web/webgpu.d.ts +6 -0
- package/dist/web/webgpu.js +2 -0
- package/dist/web/webgpuBindingCache.d.ts +26 -0
- package/dist/web/webgpuBindingCache.js +223 -0
- package/dist/web/webgpuBufferPool.d.ts +51 -0
- package/dist/web/webgpuBufferPool.js +58 -0
- package/dist/web/webgpuImageResidency.d.ts +56 -0
- package/dist/web/webgpuImageResidency.js +65 -0
- package/dist/web/webgpuLifetime.d.ts +45 -0
- package/dist/web/webgpuLifetime.js +64 -0
- package/dist/web/webgpuRetentionPool.d.ts +66 -0
- package/dist/web/webgpuRetentionPool.js +85 -0
- package/dist/web/webgpuSharedPass.d.ts +7 -0
- package/dist/web/webgpuSharedPass.js +293 -0
- package/dist/web/webgpuSharedResolvePass.d.ts +3 -0
- package/dist/web/webgpuSharedResolvePass.js +34 -0
- package/dist/web/world3d/Audio3D.d.ts +85 -0
- package/dist/web/world3d/Audio3D.js +271 -0
- package/dist/web/world3d/BrowserPlay3D.d.ts +295 -0
- package/dist/web/world3d/BrowserPlay3D.js +1256 -0
- package/dist/web/world3d/FlyControls3D.d.ts +59 -0
- package/dist/web/world3d/FlyControls3D.js +162 -0
- package/dist/web/world3d/FollowControls3D.d.ts +31 -0
- package/dist/web/world3d/FollowControls3D.js +119 -0
- package/dist/web/world3d/OrbitControls3D.d.ts +58 -0
- package/dist/web/world3d/OrbitControls3D.js +189 -0
- package/dist/web/world3d/TransformControls3D.d.ts +37 -0
- package/dist/web/world3d/TransformControls3D.js +128 -0
- package/dist/web/world3d/WebGL2Renderer3D.d.ts +136 -0
- package/dist/web/world3d/WebGL2Renderer3D.js +1175 -0
- package/dist/web/world3d/WebGPURenderer3D.d.ts +112 -0
- package/dist/web/world3d/WebGPURenderer3D.js +1916 -0
- package/dist/web/world3d/World3DView.d.ts +54 -0
- package/dist/web/world3d/World3DView.js +79 -0
- package/dist/web/world3d/app3D.d.ts +143 -0
- package/dist/web/world3d/app3D.js +305 -0
- package/dist/web/world3d/assets3D.d.ts +39 -0
- package/dist/web/world3d/assets3D.js +112 -0
- package/dist/web/world3d/atmosphere3D.d.ts +56 -0
- package/dist/web/world3d/atmosphere3D.js +193 -0
- package/dist/web/world3d/canvasFont3D.d.ts +21 -0
- package/dist/web/world3d/canvasFont3D.js +165 -0
- package/dist/web/world3d/frame3D.d.ts +144 -0
- package/dist/web/world3d/frame3D.js +388 -0
- package/dist/web/world3d/gpuResources3D.d.ts +98 -0
- package/dist/web/world3d/gpuResources3D.js +901 -0
- package/dist/web/world3d/host3D.d.ts +24 -0
- package/dist/web/world3d/host3D.js +61 -0
- package/dist/web/world3d/index.d.ts +40 -0
- package/dist/web/world3d/index.js +24 -0
- package/dist/web/world3d/loaders3D.d.ts +27 -0
- package/dist/web/world3d/loaders3D.js +138 -0
- package/dist/web/world3d/markers3D.d.ts +53 -0
- package/dist/web/world3d/markers3D.js +130 -0
- package/dist/web/world3d/materialWebGL23D.d.ts +34 -0
- package/dist/web/world3d/materialWebGL23D.js +218 -0
- package/dist/web/world3d/overlay3D.d.ts +47 -0
- package/dist/web/world3d/overlay3D.js +187 -0
- package/dist/web/world3d/post3D.d.ts +116 -0
- package/dist/web/world3d/post3D.js +462 -0
- package/dist/web/world3d/postWebGL23D.d.ts +24 -0
- package/dist/web/world3d/postWebGL23D.js +237 -0
- package/dist/web/world3d/postWebGPU3D.d.ts +23 -0
- package/dist/web/world3d/postWebGPU3D.js +255 -0
- package/dist/web/world3d/probe3D.d.ts +15 -0
- package/dist/web/world3d/probe3D.js +66 -0
- package/dist/web/world3d/shaders3D.d.ts +43 -0
- package/dist/web/world3d/shaders3D.js +851 -0
- package/dist/web/world3d/stats3D.d.ts +34 -0
- package/dist/web/world3d/stats3D.js +81 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.d.ts +71 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.js +185 -0
- package/dist/web/world3d/webgpu.d.ts +37 -0
- package/dist/web/world3d/webgpu.js +23 -0
- package/dist/web/world3d/webgpuPacking3D.d.ts +13 -0
- package/dist/web/world3d/webgpuPacking3D.js +85 -0
- package/dist/web/world3d/wgsl3D.d.ts +68 -0
- package/dist/web/world3d/wgsl3D.js +781 -0
- package/package.json +220 -4
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Camera2D, Camera2DOptions } from './cameraTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* A camera over a container that holds the world. It places that container, and the layers given it,
|
|
4
|
+
* so that the world is seen from where the camera looks. It keeps no clock: `update` moves it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createCamera2D(options: Camera2DOptions): Camera2D;
|
|
7
|
+
//# sourceMappingURL=camera2d.d.ts.map
|
package/dist/camera2d.js
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { DisplayObject, EgretError } from '@egret/runtime';
|
|
3
|
+
const finite = (value) => typeof value === 'number' && Number.isFinite(value);
|
|
4
|
+
const positive = (value) => finite(value) && value > 0;
|
|
5
|
+
const record = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
6
|
+
const point = (value) => record(value) && finite(value['x']) && finite(value['y']);
|
|
7
|
+
const rect = (value) => record(value) &&
|
|
8
|
+
finite(value['x']) &&
|
|
9
|
+
finite(value['y']) &&
|
|
10
|
+
finite(value['width']) &&
|
|
11
|
+
finite(value['height']) &&
|
|
12
|
+
value['width'] >= 0 &&
|
|
13
|
+
value['height'] >= 0;
|
|
14
|
+
const smooth = (t) => t * t * (3 - 2 * t);
|
|
15
|
+
const read = (object) => ({
|
|
16
|
+
x: object.x,
|
|
17
|
+
y: object.y,
|
|
18
|
+
scaleX: object.scaleX,
|
|
19
|
+
scaleY: object.scaleY,
|
|
20
|
+
rotation: object.rotation,
|
|
21
|
+
anchorOffsetX: object.anchorOffsetX,
|
|
22
|
+
anchorOffsetY: object.anchorOffsetY
|
|
23
|
+
});
|
|
24
|
+
function write(object, placed) {
|
|
25
|
+
object.anchorOffsetX = placed.anchorOffsetX;
|
|
26
|
+
object.anchorOffsetY = placed.anchorOffsetY;
|
|
27
|
+
object.scaleX = placed.scaleX;
|
|
28
|
+
object.scaleY = placed.scaleY;
|
|
29
|
+
object.rotation = placed.rotation;
|
|
30
|
+
object.x = placed.x;
|
|
31
|
+
object.y = placed.y;
|
|
32
|
+
}
|
|
33
|
+
/** Smooth noise between -1 and 1: two random values a step apart, eased between. The same seed gives the same shake. */
|
|
34
|
+
function noise(seed, channel, t) {
|
|
35
|
+
const at = Math.floor(t), f = t - at;
|
|
36
|
+
const hash = (n) => {
|
|
37
|
+
let h = Math.imul(n ^ Math.imul(seed, 0x9e3779b1) ^ Math.imul(channel + 1, 0x85ebca6b), 0x27d4eb2d);
|
|
38
|
+
h ^= h >>> 15;
|
|
39
|
+
h = Math.imul(h, 0x2c1b3c6d);
|
|
40
|
+
h ^= h >>> 12;
|
|
41
|
+
return ((h >>> 0) / 0xffffffff) * 2 - 1;
|
|
42
|
+
};
|
|
43
|
+
return hash(at) + (hash(at + 1) - hash(at)) * smooth(f);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A camera over a container that holds the world. It places that container, and the layers given it,
|
|
47
|
+
* so that the world is seen from where the camera looks. It keeps no clock: `update` moves it.
|
|
48
|
+
*/
|
|
49
|
+
export function createCamera2D(options) {
|
|
50
|
+
if (!record(options))
|
|
51
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
52
|
+
const { world, width: w0, height: h0, center: c0, zoom: z0 = 1, minZoom = 0.25, maxZoom = 4, rotation: r0 = 0, bounds: b0, shakeOffset = 16, shakeRotation = 0, shakeDecay = 1, shakeFrequency = 15, seed = 1, roundToPixel = false } = options;
|
|
53
|
+
if (!(world instanceof DisplayObject) ||
|
|
54
|
+
world.isDisposed ||
|
|
55
|
+
!positive(w0) ||
|
|
56
|
+
!positive(h0) ||
|
|
57
|
+
(c0 !== undefined && !point(c0)) ||
|
|
58
|
+
!positive(minZoom) ||
|
|
59
|
+
!positive(maxZoom) ||
|
|
60
|
+
minZoom > maxZoom ||
|
|
61
|
+
!finite(z0) ||
|
|
62
|
+
z0 < minZoom ||
|
|
63
|
+
z0 > maxZoom ||
|
|
64
|
+
!finite(r0) ||
|
|
65
|
+
(b0 !== undefined && !rect(b0)) ||
|
|
66
|
+
!finite(shakeOffset) ||
|
|
67
|
+
shakeOffset < 0 ||
|
|
68
|
+
!finite(shakeRotation) ||
|
|
69
|
+
shakeRotation < 0 ||
|
|
70
|
+
!finite(shakeDecay) ||
|
|
71
|
+
shakeDecay < 0 ||
|
|
72
|
+
!positive(shakeFrequency) ||
|
|
73
|
+
!Number.isSafeInteger(seed) ||
|
|
74
|
+
typeof roundToPixel !== 'boolean')
|
|
75
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
76
|
+
const before = read(world);
|
|
77
|
+
const layers = [];
|
|
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, shakeScale = 1, time = 0, closed = false;
|
|
80
|
+
let follow, move, zoomMove;
|
|
81
|
+
let shakeX = 0, shakeY = 0, shakeAngle = 0;
|
|
82
|
+
function open() {
|
|
83
|
+
if (closed)
|
|
84
|
+
throw new EgretError('CAMERA_CLOSED');
|
|
85
|
+
}
|
|
86
|
+
function clamp() {
|
|
87
|
+
if (bounds === undefined)
|
|
88
|
+
return;
|
|
89
|
+
const halfW = width / zoom / 2, halfH = height / zoom / 2;
|
|
90
|
+
cx =
|
|
91
|
+
bounds.width <= halfW * 2
|
|
92
|
+
? bounds.x + bounds.width / 2
|
|
93
|
+
: Math.min(Math.max(cx, bounds.x + halfW), bounds.x + bounds.width - halfW);
|
|
94
|
+
cy =
|
|
95
|
+
bounds.height <= halfH * 2
|
|
96
|
+
? bounds.y + bounds.height / 2
|
|
97
|
+
: Math.min(Math.max(cy, bounds.y + halfH), bounds.y + bounds.height - halfH);
|
|
98
|
+
}
|
|
99
|
+
function targetOf(target) {
|
|
100
|
+
if (target instanceof DisplayObject) {
|
|
101
|
+
if (target.isDisposed)
|
|
102
|
+
throw new EgretError('CAMERA_TARGET_INVALID');
|
|
103
|
+
// The target's place in world units, wherever it is nested inside the world: out to the stage and back.
|
|
104
|
+
const onStage = target.localToGlobal(0, 0);
|
|
105
|
+
return world.globalToLocal(onStage.x, onStage.y);
|
|
106
|
+
}
|
|
107
|
+
const value = target();
|
|
108
|
+
if (!point(value))
|
|
109
|
+
throw new EgretError('CAMERA_TARGET_INVALID');
|
|
110
|
+
return value;
|
|
111
|
+
}
|
|
112
|
+
function place() {
|
|
113
|
+
const sx = viewX(), sy = viewY();
|
|
114
|
+
write(world, {
|
|
115
|
+
anchorOffsetX: cx,
|
|
116
|
+
anchorOffsetY: cy,
|
|
117
|
+
scaleX: zoom,
|
|
118
|
+
scaleY: zoom,
|
|
119
|
+
rotation: rotation + shakeAngle,
|
|
120
|
+
x: sx,
|
|
121
|
+
y: sy
|
|
122
|
+
});
|
|
123
|
+
for (const layer of layers) {
|
|
124
|
+
const scale = 1 + (zoom - 1) * layer.zoomFactor;
|
|
125
|
+
// At the middle of the view a layer is where it was put; it moves the part of the camera's way its factor says.
|
|
126
|
+
write(layer.object, {
|
|
127
|
+
anchorOffsetX: width / 2 + (cx - width / 2) * layer.fx,
|
|
128
|
+
anchorOffsetY: height / 2 + (cy - height / 2) * layer.fy,
|
|
129
|
+
scaleX: scale,
|
|
130
|
+
scaleY: scale,
|
|
131
|
+
rotation: rotation + shakeAngle,
|
|
132
|
+
x: sx,
|
|
133
|
+
y: sy
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const viewX = () => {
|
|
138
|
+
const x = width / 2 + shakeX;
|
|
139
|
+
return roundToPixel ? Math.round(x - cx * zoom) + cx * zoom : x;
|
|
140
|
+
};
|
|
141
|
+
const viewY = () => {
|
|
142
|
+
const y = height / 2 + shakeY;
|
|
143
|
+
return roundToPixel ? Math.round(y - cy * zoom) + cy * zoom : y;
|
|
144
|
+
};
|
|
145
|
+
function settle() {
|
|
146
|
+
clamp();
|
|
147
|
+
place();
|
|
148
|
+
}
|
|
149
|
+
clamp();
|
|
150
|
+
try {
|
|
151
|
+
place();
|
|
152
|
+
}
|
|
153
|
+
catch (cause) {
|
|
154
|
+
write(world, before);
|
|
155
|
+
throw cause;
|
|
156
|
+
}
|
|
157
|
+
const camera = Object.freeze({
|
|
158
|
+
get state() {
|
|
159
|
+
return closed ? 'closed' : 'active';
|
|
160
|
+
},
|
|
161
|
+
get center() {
|
|
162
|
+
return Object.freeze({ x: cx, y: cy });
|
|
163
|
+
},
|
|
164
|
+
get zoom() {
|
|
165
|
+
return zoom;
|
|
166
|
+
},
|
|
167
|
+
get rotation() {
|
|
168
|
+
return rotation;
|
|
169
|
+
},
|
|
170
|
+
get width() {
|
|
171
|
+
return width;
|
|
172
|
+
},
|
|
173
|
+
get height() {
|
|
174
|
+
return height;
|
|
175
|
+
},
|
|
176
|
+
lookAt(x, y) {
|
|
177
|
+
if (!finite(x) || !finite(y))
|
|
178
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
179
|
+
open();
|
|
180
|
+
move = undefined;
|
|
181
|
+
cx = x;
|
|
182
|
+
cy = y;
|
|
183
|
+
settle();
|
|
184
|
+
},
|
|
185
|
+
panTo(x, y, seconds) {
|
|
186
|
+
if (!finite(x) || !finite(y) || !finite(seconds) || seconds < 0)
|
|
187
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
188
|
+
open();
|
|
189
|
+
follow = undefined;
|
|
190
|
+
if (seconds === 0) {
|
|
191
|
+
move = undefined;
|
|
192
|
+
cx = x;
|
|
193
|
+
cy = y;
|
|
194
|
+
settle();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
move = { fromX: cx, fromY: cy, toX: x, toY: y, seconds, elapsed: 0 };
|
|
198
|
+
},
|
|
199
|
+
setZoom(value) {
|
|
200
|
+
if (!finite(value) || value < minZoom || value > maxZoom)
|
|
201
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
202
|
+
open();
|
|
203
|
+
zoomMove = undefined;
|
|
204
|
+
zoom = value;
|
|
205
|
+
settle();
|
|
206
|
+
},
|
|
207
|
+
zoomTo(value, seconds) {
|
|
208
|
+
if (!finite(value) || value < minZoom || value > maxZoom || !finite(seconds) || seconds < 0)
|
|
209
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
210
|
+
open();
|
|
211
|
+
if (seconds === 0) {
|
|
212
|
+
zoomMove = undefined;
|
|
213
|
+
zoom = value;
|
|
214
|
+
settle();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
zoomMove = { from: zoom, to: value, seconds, elapsed: 0 };
|
|
218
|
+
},
|
|
219
|
+
setRotation(degrees) {
|
|
220
|
+
if (!finite(degrees))
|
|
221
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
222
|
+
open();
|
|
223
|
+
rotation = degrees;
|
|
224
|
+
place();
|
|
225
|
+
},
|
|
226
|
+
follow(target, followOptions = {}) {
|
|
227
|
+
if (!(target instanceof DisplayObject) && typeof target !== 'function')
|
|
228
|
+
throw new EgretError('CAMERA_TARGET_INVALID');
|
|
229
|
+
if (!record(followOptions))
|
|
230
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
231
|
+
const { smoothing = 0.15, deadZone, offset } = followOptions;
|
|
232
|
+
if (!finite(smoothing) ||
|
|
233
|
+
smoothing < 0 ||
|
|
234
|
+
(deadZone !== undefined &&
|
|
235
|
+
(!record(deadZone) ||
|
|
236
|
+
!finite(deadZone.width) ||
|
|
237
|
+
!finite(deadZone.height) ||
|
|
238
|
+
deadZone.width < 0 ||
|
|
239
|
+
deadZone.height < 0)) ||
|
|
240
|
+
(offset !== undefined && !point(offset)))
|
|
241
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
242
|
+
open();
|
|
243
|
+
move = undefined;
|
|
244
|
+
follow = {
|
|
245
|
+
target,
|
|
246
|
+
smoothing,
|
|
247
|
+
deadWidth: deadZone === undefined ? 0 : deadZone.width,
|
|
248
|
+
deadHeight: deadZone === undefined ? 0 : deadZone.height,
|
|
249
|
+
ox: offset?.x ?? 0,
|
|
250
|
+
oy: offset?.y ?? 0
|
|
251
|
+
};
|
|
252
|
+
},
|
|
253
|
+
stopFollowing() {
|
|
254
|
+
follow = undefined;
|
|
255
|
+
},
|
|
256
|
+
setBounds(value) {
|
|
257
|
+
if (value !== undefined && !rect(value))
|
|
258
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
259
|
+
open();
|
|
260
|
+
bounds = value === undefined ? undefined : { ...value };
|
|
261
|
+
settle();
|
|
262
|
+
},
|
|
263
|
+
resize(newWidth, newHeight) {
|
|
264
|
+
if (!positive(newWidth) || !positive(newHeight))
|
|
265
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
266
|
+
open();
|
|
267
|
+
width = newWidth;
|
|
268
|
+
height = newHeight;
|
|
269
|
+
settle();
|
|
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
|
+
},
|
|
279
|
+
shake(shakeOptions = {}) {
|
|
280
|
+
if (!record(shakeOptions))
|
|
281
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
282
|
+
const { trauma: added = 0.5 } = shakeOptions;
|
|
283
|
+
if (!finite(added) || added < 0 || added > 1)
|
|
284
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
285
|
+
open();
|
|
286
|
+
trauma = Math.min(1, trauma + added);
|
|
287
|
+
},
|
|
288
|
+
addLayer(layer, layerOptions = {}) {
|
|
289
|
+
if (!(layer instanceof DisplayObject) ||
|
|
290
|
+
layer.isDisposed ||
|
|
291
|
+
layer === world ||
|
|
292
|
+
layers.some(other => other.object === layer))
|
|
293
|
+
throw new EgretError('CAMERA_LAYER_INVALID');
|
|
294
|
+
if (!record(layerOptions))
|
|
295
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
296
|
+
const { factor = 0.5, zoomFactor = 1 } = layerOptions;
|
|
297
|
+
const fx = typeof factor === 'number' ? factor : point(factor) ? factor.x : NaN, fy = typeof factor === 'number' ? factor : point(factor) ? factor.y : NaN;
|
|
298
|
+
if (!finite(fx) || !finite(fy) || !finite(zoomFactor) || zoomFactor < 0 || zoomFactor > 1)
|
|
299
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
300
|
+
open();
|
|
301
|
+
const entry = { object: layer, fx, fy, zoomFactor, before: read(layer) };
|
|
302
|
+
layers.push(entry);
|
|
303
|
+
place();
|
|
304
|
+
return () => {
|
|
305
|
+
const index = layers.indexOf(entry);
|
|
306
|
+
if (index < 0)
|
|
307
|
+
return;
|
|
308
|
+
layers.splice(index, 1);
|
|
309
|
+
if (!layer.isDisposed)
|
|
310
|
+
write(layer, entry.before);
|
|
311
|
+
};
|
|
312
|
+
},
|
|
313
|
+
update(seconds) {
|
|
314
|
+
if (!finite(seconds) || seconds < 0)
|
|
315
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
316
|
+
open();
|
|
317
|
+
time += seconds;
|
|
318
|
+
if (zoomMove !== undefined) {
|
|
319
|
+
zoomMove.elapsed = Math.min(zoomMove.seconds, zoomMove.elapsed + seconds);
|
|
320
|
+
zoom = zoomMove.from + (zoomMove.to - zoomMove.from) * smooth(zoomMove.elapsed / zoomMove.seconds);
|
|
321
|
+
if (zoomMove.elapsed >= zoomMove.seconds) {
|
|
322
|
+
zoom = zoomMove.to;
|
|
323
|
+
zoomMove = undefined;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (move !== undefined) {
|
|
327
|
+
move.elapsed = Math.min(move.seconds, move.elapsed + seconds);
|
|
328
|
+
const t = smooth(move.elapsed / move.seconds);
|
|
329
|
+
cx = move.fromX + (move.toX - move.fromX) * t;
|
|
330
|
+
cy = move.fromY + (move.toY - move.fromY) * t;
|
|
331
|
+
if (move.elapsed >= move.seconds) {
|
|
332
|
+
cx = move.toX;
|
|
333
|
+
cy = move.toY;
|
|
334
|
+
move = undefined;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else if (follow !== undefined) {
|
|
338
|
+
const target = targetOf(follow.target), tx = target.x + follow.ox, ty = target.y + follow.oy;
|
|
339
|
+
// Inside the dead zone the target moves alone; outside it the camera is pulled to its edge.
|
|
340
|
+
const halfW = follow.deadWidth / 2, halfH = follow.deadHeight / 2;
|
|
341
|
+
const wantX = tx > cx + halfW ? tx - halfW : tx < cx - halfW ? tx + halfW : cx;
|
|
342
|
+
const wantY = ty > cy + halfH ? ty - halfH : ty < cy - halfH ? ty + halfH : cy;
|
|
343
|
+
// The same distance closed in the same time, whatever the frames.
|
|
344
|
+
const pull = follow.smoothing === 0 ? 1 : 1 - Math.exp(-seconds / follow.smoothing);
|
|
345
|
+
cx += (wantX - cx) * pull;
|
|
346
|
+
cy += (wantY - cy) * pull;
|
|
347
|
+
}
|
|
348
|
+
trauma = Math.max(0, trauma - shakeDecay * seconds);
|
|
349
|
+
const strength = trauma * trauma * shakeScale, t = time * shakeFrequency;
|
|
350
|
+
shakeX = shakeOffset * strength * noise(seed, 0, t);
|
|
351
|
+
shakeY = shakeOffset * strength * noise(seed, 1, t);
|
|
352
|
+
shakeAngle = shakeRotation * strength * noise(seed, 2, t);
|
|
353
|
+
settle();
|
|
354
|
+
},
|
|
355
|
+
worldToScreen(x, y) {
|
|
356
|
+
if (!finite(x) || !finite(y))
|
|
357
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
358
|
+
const angle = ((rotation + shakeAngle) * Math.PI) / 180, cos = Math.cos(angle), sin = Math.sin(angle);
|
|
359
|
+
const dx = (x - cx) * zoom, dy = (y - cy) * zoom;
|
|
360
|
+
return Object.freeze({ x: viewX() + dx * cos - dy * sin, y: viewY() + dx * sin + dy * cos });
|
|
361
|
+
},
|
|
362
|
+
screenToWorld(x, y) {
|
|
363
|
+
if (!finite(x) || !finite(y))
|
|
364
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
365
|
+
const angle = ((rotation + shakeAngle) * Math.PI) / 180, cos = Math.cos(angle), sin = Math.sin(angle);
|
|
366
|
+
const dx = x - viewX(), dy = y - viewY();
|
|
367
|
+
return Object.freeze({ x: cx + (dx * cos + dy * sin) / zoom, y: cy + (-dx * sin + dy * cos) / zoom });
|
|
368
|
+
},
|
|
369
|
+
isVisible(value) {
|
|
370
|
+
if (!rect(value))
|
|
371
|
+
throw new EgretError('CAMERA_OPTIONS_INVALID');
|
|
372
|
+
const halfW = width / zoom / 2, halfH = height / zoom / 2;
|
|
373
|
+
return (value.x <= cx + halfW &&
|
|
374
|
+
value.x + value.width >= cx - halfW &&
|
|
375
|
+
value.y <= cy + halfH &&
|
|
376
|
+
value.y + value.height >= cy - halfH);
|
|
377
|
+
},
|
|
378
|
+
snapshot() {
|
|
379
|
+
const halfW = width / zoom / 2, halfH = height / zoom / 2;
|
|
380
|
+
return Object.freeze({
|
|
381
|
+
center: Object.freeze({ x: cx, y: cy }),
|
|
382
|
+
zoom,
|
|
383
|
+
rotation,
|
|
384
|
+
trauma,
|
|
385
|
+
view: Object.freeze({ x: cx - halfW, y: cy - halfH, width: halfW * 2, height: halfH * 2 }),
|
|
386
|
+
following: follow !== undefined,
|
|
387
|
+
time
|
|
388
|
+
});
|
|
389
|
+
},
|
|
390
|
+
dispose() {
|
|
391
|
+
if (closed)
|
|
392
|
+
return;
|
|
393
|
+
closed = true;
|
|
394
|
+
follow = undefined;
|
|
395
|
+
move = undefined;
|
|
396
|
+
zoomMove = undefined;
|
|
397
|
+
const failures = [];
|
|
398
|
+
for (const layer of layers.splice(0))
|
|
399
|
+
try {
|
|
400
|
+
if (!layer.object.isDisposed)
|
|
401
|
+
write(layer.object, layer.before);
|
|
402
|
+
}
|
|
403
|
+
catch (cause) {
|
|
404
|
+
failures.push(cause);
|
|
405
|
+
}
|
|
406
|
+
try {
|
|
407
|
+
if (!world.isDisposed)
|
|
408
|
+
write(world, before);
|
|
409
|
+
}
|
|
410
|
+
catch (cause) {
|
|
411
|
+
failures.push(cause);
|
|
412
|
+
}
|
|
413
|
+
if (failures.length > 0)
|
|
414
|
+
throw new EgretError('CAMERA_CLEANUP_FAILED', { cause: failures[0], cleanupErrors: failures.slice(1) });
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
return camera;
|
|
418
|
+
}
|
|
419
|
+
//# sourceMappingURL=camera2d.js.map
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { DisplayObject } from '@egret/runtime';
|
|
2
|
+
/** A point in world coordinates. */
|
|
3
|
+
export interface CameraPoint {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
}
|
|
7
|
+
/** A rectangle in world coordinates. */
|
|
8
|
+
export interface CameraRect {
|
|
9
|
+
readonly x: number;
|
|
10
|
+
readonly y: number;
|
|
11
|
+
readonly width: number;
|
|
12
|
+
readonly height: number;
|
|
13
|
+
}
|
|
14
|
+
/** What the camera follows: a display object inside the world, or a function that says where to look. */
|
|
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. */
|
|
17
|
+
export interface CameraFollowOptions {
|
|
18
|
+
/** Seconds for the camera to close most of the distance (about 63 %). 0 follows at once. Defaults to 0.15. */
|
|
19
|
+
readonly smoothing?: number;
|
|
20
|
+
/** A rectangle around the middle of the view, in world units, inside which the target moves without the camera. */
|
|
21
|
+
readonly deadZone?: {
|
|
22
|
+
readonly width: number;
|
|
23
|
+
readonly height: number;
|
|
24
|
+
};
|
|
25
|
+
/** Added to the target's place, in world units. */
|
|
26
|
+
readonly offset?: CameraPoint;
|
|
27
|
+
}
|
|
28
|
+
/** How a layer moves and zooms with the camera, for parallax. */
|
|
29
|
+
export interface CameraLayerOptions {
|
|
30
|
+
/**
|
|
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
|
|
32
|
+
* camera looks at the middle of the view the layer is where it was put. Defaults to 0.5.
|
|
33
|
+
*/
|
|
34
|
+
readonly factor?: number | CameraPoint;
|
|
35
|
+
/** How much of the zoom the layer takes: 0 none, 1 all of it. Defaults to 1. */
|
|
36
|
+
readonly zoomFactor?: number;
|
|
37
|
+
}
|
|
38
|
+
/** How much a shake adds to the camera's trauma. */
|
|
39
|
+
export interface CameraShakeOptions {
|
|
40
|
+
/** Added trauma, 0 to 1. The shake is as strong as the square of the trauma. Defaults to 0.5. */
|
|
41
|
+
readonly trauma?: number;
|
|
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. */
|
|
44
|
+
export interface Camera2DOptions {
|
|
45
|
+
/** The container that holds the world. The camera owns its place, scale, rotation and anchor. */
|
|
46
|
+
readonly world: DisplayObject;
|
|
47
|
+
/** The size of what is shown, in stage units. */
|
|
48
|
+
readonly width: number;
|
|
49
|
+
readonly height: number;
|
|
50
|
+
/** Where the camera looks first, in world units. Defaults to the middle of the view. */
|
|
51
|
+
readonly center?: CameraPoint;
|
|
52
|
+
/** Defaults to 1. */
|
|
53
|
+
readonly zoom?: number;
|
|
54
|
+
/** Defaults to 0.25 and 4. */
|
|
55
|
+
readonly minZoom?: number;
|
|
56
|
+
readonly maxZoom?: number;
|
|
57
|
+
/** Degrees. Defaults to 0. */
|
|
58
|
+
readonly rotation?: number;
|
|
59
|
+
/** The camera never shows outside this rectangle of the world. Rotation is not taken into account. */
|
|
60
|
+
readonly bounds?: CameraRect;
|
|
61
|
+
/** The farthest a shake moves the view, in stage units. Defaults to 16. */
|
|
62
|
+
readonly shakeOffset?: number;
|
|
63
|
+
/** The farthest a shake turns the view, in degrees. Defaults to 0. */
|
|
64
|
+
readonly shakeRotation?: number;
|
|
65
|
+
/** Trauma lost each second. Defaults to 1. */
|
|
66
|
+
readonly shakeDecay?: number;
|
|
67
|
+
/** Shakes per second. Defaults to 15. */
|
|
68
|
+
readonly shakeFrequency?: number;
|
|
69
|
+
/** The same seed shakes the same way. Defaults to 1. */
|
|
70
|
+
readonly seed?: number;
|
|
71
|
+
/** Whole stage units for the place of the world, so that pixel art does not shimmer. Defaults to false. */
|
|
72
|
+
readonly roundToPixel?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** The camera as it is now: where it looks, its zoom and rotation, its trauma and its view. */
|
|
75
|
+
export interface CameraSnapshot {
|
|
76
|
+
readonly center: CameraPoint;
|
|
77
|
+
readonly zoom: number;
|
|
78
|
+
readonly rotation: number;
|
|
79
|
+
readonly trauma: number;
|
|
80
|
+
/** The rectangle of the world that is shown, before any shake and rotation. */
|
|
81
|
+
readonly view: CameraRect;
|
|
82
|
+
readonly following: boolean;
|
|
83
|
+
/** Seconds the camera has been updated for. */
|
|
84
|
+
readonly time: number;
|
|
85
|
+
}
|
|
86
|
+
/** A view of a 2D world: where it looks, how close, what it follows, and how it shakes. It is moved by `update`. */
|
|
87
|
+
export interface Camera2D {
|
|
88
|
+
readonly state: 'active' | 'closed';
|
|
89
|
+
readonly center: CameraPoint;
|
|
90
|
+
readonly zoom: number;
|
|
91
|
+
readonly rotation: number;
|
|
92
|
+
readonly width: number;
|
|
93
|
+
readonly height: number;
|
|
94
|
+
/** Looks at a place at once. A follow still pulls the camera back at the next update. */
|
|
95
|
+
lookAt(x: number, y: number): void;
|
|
96
|
+
/** Moves to a place over the seconds given. A follow is stopped. */
|
|
97
|
+
panTo(x: number, y: number, seconds: number): void;
|
|
98
|
+
setZoom(zoom: number): void;
|
|
99
|
+
/** Zooms over the seconds given, keeping the middle of the view where it is. */
|
|
100
|
+
zoomTo(zoom: number, seconds: number): void;
|
|
101
|
+
setRotation(degrees: number): void;
|
|
102
|
+
follow(target: CameraTarget, options?: CameraFollowOptions): void;
|
|
103
|
+
stopFollowing(): void;
|
|
104
|
+
setBounds(bounds: CameraRect | undefined): void;
|
|
105
|
+
/** Changes what is shown, as when the canvas is resized. */
|
|
106
|
+
resize(width: number, height: number): void;
|
|
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;
|
|
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. */
|
|
114
|
+
addLayer(layer: DisplayObject, options?: CameraLayerOptions): () => void;
|
|
115
|
+
/** Advances the follow, the pan, the zoom and the shake by the seconds given, and places the world and the layers. */
|
|
116
|
+
update(seconds: number): void;
|
|
117
|
+
/** Where a point of the world is on the stage, and back, as the camera places them now. */
|
|
118
|
+
worldToScreen(x: number, y: number): CameraPoint;
|
|
119
|
+
screenToWorld(x: number, y: number): CameraPoint;
|
|
120
|
+
/** Whether a rectangle of the world can be seen, before any shake and rotation. */
|
|
121
|
+
isVisible(rect: CameraRect): boolean;
|
|
122
|
+
snapshot(): CameraSnapshot;
|
|
123
|
+
/** Gives the world and the layers back their place, scale, rotation and anchor. A scope can own a camera through this. */
|
|
124
|
+
dispose(): void;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=cameraTypes.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DiagnosticHandler, HostAdapter } from "@egret/contracts";
|
|
2
|
+
/** Deadline rejects the caller; it never cancels or destroys borrowed host work. */
|
|
3
|
+
export declare function closeHost(host: HostAdapter, timeoutMs: number, releaseSurface: () => void, errors: unknown[], onDiagnostic: DiagnosticHandler | undefined): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=closeHost.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { EgretError, reportDiagnostic } from "@egret/runtime";
|
|
2
|
+
function closeFailure(errors) {
|
|
3
|
+
return new EgretError("ENGINE_CLOSE_FAILED", { cause: errors[0], cleanupErrors: errors.slice(1) });
|
|
4
|
+
}
|
|
5
|
+
/** Deadline rejects the caller; it never cancels or destroys borrowed host work. */
|
|
6
|
+
export function closeHost(host, timeoutMs, releaseSurface, errors, onDiagnostic) {
|
|
7
|
+
let closing;
|
|
8
|
+
try {
|
|
9
|
+
closing = Promise.resolve(host.close());
|
|
10
|
+
}
|
|
11
|
+
catch (cause) {
|
|
12
|
+
closing = Promise.reject(cause);
|
|
13
|
+
}
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
// Caller deadline and physical host completion are independent states.
|
|
16
|
+
let callerSettled = false;
|
|
17
|
+
let cancelTimer = () => { };
|
|
18
|
+
const complete = (failed, cause) => {
|
|
19
|
+
// A rejection cannot prove safe return of borrowed/in-flight host resources.
|
|
20
|
+
// Even after a timeout, only successful host completion releases it.
|
|
21
|
+
if (!failed)
|
|
22
|
+
releaseSurface();
|
|
23
|
+
if (callerSettled) {
|
|
24
|
+
if (failed)
|
|
25
|
+
reportDiagnostic(onDiagnostic, {
|
|
26
|
+
code: "HOST_CLOSE_LATE_FAILURE",
|
|
27
|
+
phase: "engine",
|
|
28
|
+
severity: "error",
|
|
29
|
+
cause
|
|
30
|
+
});
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
callerSettled = true;
|
|
34
|
+
try {
|
|
35
|
+
cancelTimer();
|
|
36
|
+
}
|
|
37
|
+
catch (timerCause) {
|
|
38
|
+
errors.push(timerCause);
|
|
39
|
+
}
|
|
40
|
+
if (failed)
|
|
41
|
+
errors.push(cause);
|
|
42
|
+
if (errors.length !== 0)
|
|
43
|
+
reject(closeFailure(errors));
|
|
44
|
+
else
|
|
45
|
+
resolve();
|
|
46
|
+
};
|
|
47
|
+
// Both outcomes are attached before the deadline port can call user code.
|
|
48
|
+
void closing.then(() => complete(false), (cause) => complete(true, cause));
|
|
49
|
+
try {
|
|
50
|
+
cancelTimer = host.setTimeout(() => {
|
|
51
|
+
if (callerSettled)
|
|
52
|
+
return;
|
|
53
|
+
callerSettled = true;
|
|
54
|
+
const error = new EgretError("ENGINE_CLOSE_TIMEOUT", { cause: errors[0], cleanupErrors: errors.slice(1) });
|
|
55
|
+
reportDiagnostic(onDiagnostic, { code: error.code, phase: "engine", severity: "error", cause: error });
|
|
56
|
+
reject(error);
|
|
57
|
+
}, timeoutMs);
|
|
58
|
+
}
|
|
59
|
+
catch (cause) {
|
|
60
|
+
callerSettled = true;
|
|
61
|
+
errors.push(cause);
|
|
62
|
+
reject(closeFailure(errors));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=closeHost.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EgretError } from '@egret/runtime';
|
|
2
|
+
import type { SequenceClipInput, SpriteSheetFrameInput } from '@egret/runtime';
|
|
3
|
+
export interface AtlasArtifact {
|
|
4
|
+
readonly width: number;
|
|
5
|
+
readonly height: number;
|
|
6
|
+
readonly frames: readonly SpriteSheetFrameInput[];
|
|
7
|
+
readonly sequenceInput: SequenceClipInput;
|
|
8
|
+
}
|
|
9
|
+
export declare function contentFault(stage: string, id: string, cause?: unknown): EgretError;
|
|
10
|
+
export declare function parseAtlasArtifact(text: string, id: string): AtlasArtifact;
|
|
11
|
+
export declare function parseSequenceArtifact(text: string, id: string, atlas: AtlasArtifact): SequenceClipInput;
|
|
12
|
+
//# sourceMappingURL=contentArtifacts.d.ts.map
|