@egret/engine 0.0.0-stage → 7.0.1-rc.3
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 +464 -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 +42 -0
- package/dist/animation/sequenceResetTypes.js +2 -0
- package/dist/animation/types.d.ts +69 -0
- package/dist/animation/types.js +2 -0
- package/dist/assetBundle.d.ts +52 -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 +15 -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 +43 -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 +233 -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 +29 -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 +109 -0
- package/dist/bitmapFontTypes.js +2 -0
- package/dist/bitmapResourceSlot.d.ts +25 -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 +411 -0
- package/dist/cameraTypes.d.ts +114 -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 +33 -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 +42 -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 +34 -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 +31 -0
- package/dist/gameClockTypes.js +2 -0
- package/dist/gameRun.d.ts +50 -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 +134 -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 +119 -0
- package/dist/hoverInputTypes.js +2 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +20 -0
- package/dist/input.d.ts +6 -0
- package/dist/input.js +5 -0
- package/dist/inputActions.d.ts +81 -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 +64 -0
- package/dist/internal/uiFactoryState.js +157 -0
- package/dist/internal/uiRootState.d.ts +67 -0
- package/dist/internal/uiRootState.js +103 -0
- package/dist/keyboardInput.d.ts +12 -0
- package/dist/keyboardInput.js +578 -0
- package/dist/keyboardInputTypes.d.ts +81 -0
- package/dist/keyboardInputTypes.js +2 -0
- package/dist/kit.d.ts +14 -0
- package/dist/kit.js +9 -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 +16 -0
- package/dist/manifestResourceState.js +57 -0
- package/dist/manifestResourceTypes.d.ts +25 -0
- package/dist/manifestResourceTypes.js +2 -0
- package/dist/motion.d.ts +33 -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 +37 -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 +292 -0
- package/dist/particleTypes.d.ts +107 -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 +167 -0
- package/dist/physics2dTypes.js +2 -0
- package/dist/physics2dWorld.d.ts +4 -0
- package/dist/physics2dWorld.js +623 -0
- package/dist/pointerInput.d.ts +11 -0
- package/dist/pointerInput.js +299 -0
- package/dist/pointerInputTypes.d.ts +38 -0
- package/dist/pointerInputTypes.js +2 -0
- package/dist/random.d.ts +29 -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 +331 -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 +88 -0
- package/dist/rendering/prepareSharedDraws2D.js +652 -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 +18 -0
- package/dist/rendering/sharedColor2D.js +68 -0
- package/dist/rendering/sharedEffects2D.d.ts +23 -0
- package/dist/rendering/sharedEffects2D.js +118 -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 +95 -0
- package/dist/rendering/world3d/Animation3D.js +380 -0
- package/dist/rendering/world3d/AnimationTexture3D.d.ts +157 -0
- package/dist/rendering/world3d/AnimationTexture3D.js +601 -0
- package/dist/rendering/world3d/Batch3D.d.ts +71 -0
- package/dist/rendering/world3d/Batch3D.js +329 -0
- package/dist/rendering/world3d/Camera3D.d.ts +57 -0
- package/dist/rendering/world3d/Camera3D.js +129 -0
- package/dist/rendering/world3d/Character3D.d.ts +123 -0
- package/dist/rendering/world3d/Character3D.js +303 -0
- package/dist/rendering/world3d/Cloth3D.d.ts +115 -0
- package/dist/rendering/world3d/Cloth3D.js +498 -0
- package/dist/rendering/world3d/Compression3D.d.ts +21 -0
- package/dist/rendering/world3d/Compression3D.js +702 -0
- package/dist/rendering/world3d/Curves3D.d.ts +111 -0
- package/dist/rendering/world3d/Curves3D.js +455 -0
- package/dist/rendering/world3d/Decal3D.d.ts +41 -0
- package/dist/rendering/world3d/Decal3D.js +241 -0
- package/dist/rendering/world3d/Geometry3D.d.ts +85 -0
- package/dist/rendering/world3d/Geometry3D.js +326 -0
- package/dist/rendering/world3d/GeometryBuilder3D.d.ts +51 -0
- package/dist/rendering/world3d/GeometryBuilder3D.js +196 -0
- package/dist/rendering/world3d/Gizmo3D.d.ts +75 -0
- package/dist/rendering/world3d/Gizmo3D.js +512 -0
- package/dist/rendering/world3d/Gltf3D.d.ts +67 -0
- package/dist/rendering/world3d/Gltf3D.js +976 -0
- package/dist/rendering/world3d/GpuParticles3D.d.ts +107 -0
- package/dist/rendering/world3d/GpuParticles3D.js +400 -0
- package/dist/rendering/world3d/Hdr3D.d.ts +33 -0
- package/dist/rendering/world3d/Hdr3D.js +190 -0
- package/dist/rendering/world3d/Jelly3D.d.ts +75 -0
- package/dist/rendering/world3d/Jelly3D.js +266 -0
- package/dist/rendering/world3d/Ktx23D.d.ts +27 -0
- package/dist/rendering/world3d/Ktx23D.js +112 -0
- package/dist/rendering/world3d/Light3D.d.ts +75 -0
- package/dist/rendering/world3d/Light3D.js +93 -0
- package/dist/rendering/world3d/Material3D.d.ts +243 -0
- package/dist/rendering/world3d/Material3D.js +267 -0
- package/dist/rendering/world3d/Mesh3D.d.ts +108 -0
- package/dist/rendering/world3d/Mesh3D.js +323 -0
- package/dist/rendering/world3d/Meshopt3D.d.ts +12 -0
- package/dist/rendering/world3d/Meshopt3D.js +275 -0
- package/dist/rendering/world3d/Navigation3D.d.ts +173 -0
- package/dist/rendering/world3d/Navigation3D.js +971 -0
- package/dist/rendering/world3d/Object3D.d.ts +107 -0
- package/dist/rendering/world3d/Object3D.js +305 -0
- package/dist/rendering/world3d/Particles3D.d.ts +85 -0
- package/dist/rendering/world3d/Particles3D.js +274 -0
- package/dist/rendering/world3d/Physics3D.d.ts +416 -0
- package/dist/rendering/world3d/Physics3D.js +2835 -0
- package/dist/rendering/world3d/PhysicsHull3D.d.ts +35 -0
- package/dist/rendering/world3d/PhysicsHull3D.js +227 -0
- package/dist/rendering/world3d/PhysicsMesh3D.d.ts +39 -0
- package/dist/rendering/world3d/PhysicsMesh3D.js +338 -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 +174 -0
- package/dist/rendering/world3d/PhysicsRemote3D.js +534 -0
- package/dist/rendering/world3d/Ragdoll3D.d.ts +69 -0
- package/dist/rendering/world3d/Ragdoll3D.js +200 -0
- package/dist/rendering/world3d/Raycast3D.d.ts +37 -0
- package/dist/rendering/world3d/Raycast3D.js +246 -0
- package/dist/rendering/world3d/RenderList3D.d.ts +88 -0
- package/dist/rendering/world3d/RenderList3D.js +490 -0
- package/dist/rendering/world3d/Retarget3D.d.ts +20 -0
- package/dist/rendering/world3d/Retarget3D.js +185 -0
- package/dist/rendering/world3d/Serialize3D.d.ts +49 -0
- package/dist/rendering/world3d/Serialize3D.js +607 -0
- package/dist/rendering/world3d/StateMachine3D.d.ts +78 -0
- package/dist/rendering/world3d/StateMachine3D.js +277 -0
- package/dist/rendering/world3d/Terrain3D.d.ts +227 -0
- package/dist/rendering/world3d/Terrain3D.js +803 -0
- package/dist/rendering/world3d/Text3D.d.ts +90 -0
- package/dist/rendering/world3d/Text3D.js +558 -0
- package/dist/rendering/world3d/Texture3D.d.ts +133 -0
- package/dist/rendering/world3d/Texture3D.js +252 -0
- package/dist/rendering/world3d/Trail3D.d.ts +59 -0
- package/dist/rendering/world3d/Trail3D.js +193 -0
- package/dist/rendering/world3d/Vehicle3D.d.ts +97 -0
- package/dist/rendering/world3d/Vehicle3D.js +226 -0
- package/dist/rendering/world3d/VolumetricFog3D.d.ts +55 -0
- package/dist/rendering/world3d/VolumetricFog3D.js +229 -0
- package/dist/rendering/world3d/Water3D.d.ts +163 -0
- package/dist/rendering/world3d/Water3D.js +606 -0
- package/dist/rendering/world3d/core3D.d.ts +34 -0
- package/dist/rendering/world3d/core3D.js +99 -0
- package/dist/rendering/world3d/debug3D.d.ts +64 -0
- package/dist/rendering/world3d/debug3D.js +257 -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 +99 -0
- package/dist/rendering/world3d/geometries3D.js +605 -0
- package/dist/rendering/world3d/helpers3D.d.ts +65 -0
- package/dist/rendering/world3d/helpers3D.js +177 -0
- package/dist/rendering/world3d/index.d.ts +91 -0
- package/dist/rendering/world3d/index.js +56 -0
- package/dist/rendering/world3d/math3D.d.ts +78 -0
- package/dist/rendering/world3d/math3D.js +640 -0
- package/dist/rendering/world3d/primitives3D.d.ts +60 -0
- package/dist/rendering/world3d/primitives3D.js +196 -0
- package/dist/resources.d.ts +8 -0
- package/dist/resources.js +6 -0
- package/dist/saveStore.d.ts +56 -0
- package/dist/saveStore.js +163 -0
- package/dist/semanticList.d.ts +122 -0
- package/dist/semanticList.js +174 -0
- package/dist/semanticTree.d.ts +10 -0
- package/dist/semanticTree.js +532 -0
- package/dist/semanticTypes.d.ts +167 -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 +21 -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 +23 -0
- package/dist/text.js +4 -0
- package/dist/textField.d.ts +6 -0
- package/dist/textField.js +6 -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 +169 -0
- package/dist/tilemapTypes.js +2 -0
- package/dist/tween.d.ts +15 -0
- package/dist/tween.js +329 -0
- package/dist/tweenTypes.d.ts +27 -0
- package/dist/tweenTypes.js +2 -0
- package/dist/ui/controlKeys.d.ts +109 -0
- package/dist/ui/controlKeys.js +249 -0
- package/dist/ui/controls.d.ts +52 -0
- package/dist/ui/controls.js +288 -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 +91 -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 +50 -0
- package/dist/ui/rangeControl.js +167 -0
- package/dist/ui/scrollControl.d.ts +72 -0
- package/dist/ui/scrollControl.js +218 -0
- package/dist/ui/stateControls.d.ts +82 -0
- package/dist/ui/stateControls.js +328 -0
- package/dist/ui/textEditor.d.ts +53 -0
- package/dist/ui/textEditor.js +370 -0
- package/dist/ui/textEditorTypes.d.ts +78 -0
- package/dist/ui/textEditorTypes.js +2 -0
- package/dist/ui/textFieldControl.d.ts +96 -0
- package/dist/ui/textFieldControl.js +259 -0
- package/dist/ui/theme.d.ts +59 -0
- package/dist/ui/theme.js +165 -0
- package/dist/ui/types.d.ts +265 -0
- package/dist/ui/types.js +2 -0
- package/dist/ui/uiRoot.d.ts +4 -0
- package/dist/ui/uiRoot.js +1497 -0
- package/dist/ui/uiRootDisplay.d.ts +46 -0
- package/dist/ui/uiRootDisplay.js +148 -0
- package/dist/ui/uiRootModel.d.ts +112 -0
- package/dist/ui/uiRootModel.js +60 -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 +74 -0
- package/dist/videoTypes.js +2 -0
- package/dist/web/BrowserAssetBundle.d.ts +39 -0
- package/dist/web/BrowserAssetBundle.js +136 -0
- package/dist/web/BrowserAudio.d.ts +41 -0
- package/dist/web/BrowserAudio.js +473 -0
- package/dist/web/BrowserFrameLoop.d.ts +65 -0
- package/dist/web/BrowserFrameLoop.js +125 -0
- package/dist/web/BrowserGame.d.ts +112 -0
- package/dist/web/BrowserGame.js +352 -0
- package/dist/web/BrowserGamepadInput.d.ts +35 -0
- package/dist/web/BrowserGamepadInput.js +134 -0
- package/dist/web/BrowserHoverInput.d.ts +24 -0
- package/dist/web/BrowserHoverInput.js +266 -0
- package/dist/web/BrowserImageTextures.d.ts +66 -0
- package/dist/web/BrowserImageTextures.js +169 -0
- package/dist/web/BrowserInputActions.d.ts +53 -0
- package/dist/web/BrowserInputActions.js +342 -0
- package/dist/web/BrowserKeyboardInput.d.ts +4 -0
- package/dist/web/BrowserKeyboardInput.js +223 -0
- package/dist/web/BrowserPlay.d.ts +289 -0
- package/dist/web/BrowserPlay.js +1301 -0
- package/dist/web/BrowserPointerInput.d.ts +4 -0
- package/dist/web/BrowserPointerInput.js +511 -0
- package/dist/web/BrowserSemantics.d.ts +34 -0
- package/dist/web/BrowserSemantics.js +418 -0
- package/dist/web/BrowserStatsPanel.d.ts +46 -0
- package/dist/web/BrowserStatsPanel.js +137 -0
- package/dist/web/BrowserStorage.d.ts +33 -0
- package/dist/web/BrowserStorage.js +132 -0
- package/dist/web/BrowserTextEditor.d.ts +49 -0
- package/dist/web/BrowserTextEditor.js +839 -0
- package/dist/web/BrowserTextInput.d.ts +83 -0
- package/dist/web/BrowserTextInput.js +524 -0
- package/dist/web/BrowserTextureProvider.d.ts +52 -0
- package/dist/web/BrowserTextureProvider.js +935 -0
- package/dist/web/BrowserVideo.d.ts +28 -0
- package/dist/web/BrowserVideo.js +211 -0
- package/dist/web/CanvasKitFontSetProvider.d.ts +29 -0
- package/dist/web/CanvasKitFontSetProvider.js +215 -0
- package/dist/web/CanvasKitParagraphProvider.d.ts +169 -0
- package/dist/web/CanvasKitParagraphProvider.js +691 -0
- package/dist/web/CanvasTextRasterProvider.d.ts +4 -0
- package/dist/web/CanvasTextRasterProvider.js +312 -0
- package/dist/web/ManifestByteSource.d.ts +147 -0
- package/dist/web/ManifestByteSource.js +974 -0
- package/dist/web/ManifestFontContentLoader.d.ts +12 -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 +2672 -0
- package/dist/web/WebGPUHost.d.ts +87 -0
- package/dist/web/WebGPUHost.js +3349 -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 +50 -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 +14 -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 +10 -0
- package/dist/web/kit.js +7 -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 +5 -0
- package/dist/web/play.js +6 -0
- package/dist/web/playSfx.d.ts +36 -0
- package/dist/web/playSfx.js +112 -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 +57 -0
- package/dist/web/resources.d.ts +27 -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 +9 -0
- package/dist/web/sharedEffectShaders.js +165 -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 +30 -0
- package/dist/web/sharedWebGL2Options.js +96 -0
- package/dist/web/sharedWebGL2Shaders.d.ts +20 -0
- package/dist/web/sharedWebGL2Shaders.js +314 -0
- package/dist/web/sharedWebGPUOptions.d.ts +37 -0
- package/dist/web/sharedWebGPUOptions.js +126 -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 +70 -0
- package/dist/web/webgl2Native.js +568 -0
- package/dist/web/webgl2Types.d.ts +132 -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 +53 -0
- package/dist/web/webgpuImageResidency.js +61 -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 +84 -0
- package/dist/web/webgpuSharedPass.d.ts +7 -0
- package/dist/web/webgpuSharedPass.js +211 -0
- package/dist/web/webgpuSharedResolvePass.d.ts +3 -0
- package/dist/web/webgpuSharedResolvePass.js +29 -0
- package/dist/web/world3d/Audio3D.d.ts +68 -0
- package/dist/web/world3d/Audio3D.js +212 -0
- package/dist/web/world3d/BrowserPlay3D.d.ts +182 -0
- package/dist/web/world3d/BrowserPlay3D.js +851 -0
- package/dist/web/world3d/FlyControls3D.d.ts +55 -0
- package/dist/web/world3d/FlyControls3D.js +160 -0
- package/dist/web/world3d/FollowControls3D.d.ts +28 -0
- package/dist/web/world3d/FollowControls3D.js +117 -0
- package/dist/web/world3d/OrbitControls3D.d.ts +55 -0
- package/dist/web/world3d/OrbitControls3D.js +187 -0
- package/dist/web/world3d/TransformControls3D.d.ts +34 -0
- package/dist/web/world3d/TransformControls3D.js +125 -0
- package/dist/web/world3d/WebGL2Renderer3D.d.ts +133 -0
- package/dist/web/world3d/WebGL2Renderer3D.js +1173 -0
- package/dist/web/world3d/WebGPURenderer3D.d.ts +110 -0
- package/dist/web/world3d/WebGPURenderer3D.js +1915 -0
- package/dist/web/world3d/World3DView.d.ts +51 -0
- package/dist/web/world3d/World3DView.js +77 -0
- package/dist/web/world3d/app3D.d.ts +136 -0
- package/dist/web/world3d/app3D.js +304 -0
- package/dist/web/world3d/assets3D.d.ts +38 -0
- package/dist/web/world3d/assets3D.js +112 -0
- package/dist/web/world3d/atmosphere3D.d.ts +47 -0
- package/dist/web/world3d/atmosphere3D.js +178 -0
- package/dist/web/world3d/frame3D.d.ts +142 -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 +23 -0
- package/dist/web/world3d/host3D.js +61 -0
- package/dist/web/world3d/index.d.ts +38 -0
- package/dist/web/world3d/index.js +23 -0
- package/dist/web/world3d/loaders3D.d.ts +26 -0
- package/dist/web/world3d/loaders3D.js +138 -0
- package/dist/web/world3d/markers3D.d.ts +49 -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 +28 -0
- package/dist/web/world3d/overlay3D.js +170 -0
- package/dist/web/world3d/post3D.d.ts +112 -0
- package/dist/web/world3d/post3D.js +459 -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 +14 -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 +31 -0
- package/dist/web/world3d/stats3D.js +80 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.d.ts +66 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.js +185 -0
- package/dist/web/world3d/webgpu.d.ts +35 -0
- package/dist/web/world3d/webgpu.js +22 -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
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { Engine } from './Engine.js';
|
|
2
|
+
export { createEngine } from './createEngine.js';
|
|
3
|
+
export { createEngineForProfile } from './createEngineForProfile.js';
|
|
4
|
+
export { animate } from './motion.js';
|
|
5
|
+
export { describeErrorCode, setErrorLanguage, getErrorLanguage } from '@egret/runtime';
|
|
6
|
+
export { CancellationController, EgretError, Event, createEventType, EventDispatcher, DisplayObject, DisplayObjectContainer, Scope, Stage } from '@egret/runtime';
|
|
7
|
+
export { AssetManager, AssetLease, createAssetType, createAssetRef } from '@egret/runtime';
|
|
8
|
+
export { Sprite, Graphics } from '@egret/runtime';
|
|
9
|
+
export { IMAGE_LIMITS_2D, createImageData2D, isImageData2D, copyImageData2DPixels } from '@egret/contracts';
|
|
10
|
+
export { createTexturedGeometry2D, isTexturedGeometry2D } from '@egret/contracts';
|
|
11
|
+
export { createSharedMaterial2D, createSharedGeometry2D } from '@egret/contracts';
|
|
12
|
+
export { SHARED_FRAME_PROFILE_2D } from '@egret/contracts';
|
|
13
|
+
export { Texture, createTexture, createTextureView, isTexture, Bitmap, Mesh2D } from '@egret/runtime';
|
|
14
|
+
export { createSequenceClip, SequencePlayer } from '@egret/runtime';
|
|
15
|
+
export { ByteReader, BYTE_READER_LIMITS } from '@egret/runtime';
|
|
16
|
+
export { ByteWriter, BYTE_WRITER_LIMITS } from '@egret/runtime';
|
|
17
|
+
export { createNineSliceGeometry2D } from '@egret/runtime';
|
|
18
|
+
export { NineSliceBitmap } from '@egret/runtime';
|
|
19
|
+
export { createSpriteSheet } from '@egret/runtime';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Optional input: no browser listeners or renderer are loaded by this entry. */
|
|
2
|
+
export { createPointerInput } from './pointerInput.js';
|
|
3
|
+
export type { PointerInput, PointerInputOptions, PointerInputEvents, PointerNotification, PointerCancelReason, PointerContact, PointerEventKind, PointerSample, PointerSession, PointerType, PointerUpdate, PointerRouterState } from './pointerInputTypes.js';
|
|
4
|
+
export { createKeyboardInput } from './keyboardInput.js';
|
|
5
|
+
export type * from './keyboardInputTypes.js';
|
|
6
|
+
//# sourceMappingURL=input.d.ts.map
|
package/dist/input.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/** Optional input: no browser listeners or renderer are loaded by this entry. */
|
|
3
|
+
export { createPointerInput } from './pointerInput.js';
|
|
4
|
+
export { createKeyboardInput } from './keyboardInput.js';
|
|
5
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One physical control, written as a short string:
|
|
3
|
+
* `Key:KeyW` (a `KeyboardEvent.code`), `Mouse:0` (a button number), `Pad:a` or `Pad:7` (a standard gamepad button
|
|
4
|
+
* name or number), `Pad:leftStick` / `Pad:rightStick` (a stick, for vector actions), `Pad:leftStickX+` (one half of a
|
|
5
|
+
* stick axis, for buttons and axes), and `Touch:<name>` for an on-screen control.
|
|
6
|
+
*/
|
|
7
|
+
export type InputBinding = string;
|
|
8
|
+
export type InputActionKind = 'button' | 'axis' | 'vector';
|
|
9
|
+
/** An action and the controls that drive it. */
|
|
10
|
+
export interface InputActionDefinition {
|
|
11
|
+
/** `button` (the default) is pressed or not; `axis` runs from -1 to 1; `vector` is a direction of length up to 1. */
|
|
12
|
+
readonly kind?: InputActionKind;
|
|
13
|
+
/** For a button: any of these presses it. */
|
|
14
|
+
readonly bindings?: readonly InputBinding[];
|
|
15
|
+
/** For an axis: controls that push it negative and positive. */
|
|
16
|
+
readonly negative?: readonly InputBinding[];
|
|
17
|
+
readonly positive?: readonly InputBinding[];
|
|
18
|
+
/** For a vector: controls for each direction, and sticks or touch sticks that give the whole vector. */
|
|
19
|
+
readonly up?: readonly InputBinding[];
|
|
20
|
+
readonly down?: readonly InputBinding[];
|
|
21
|
+
readonly left?: readonly InputBinding[];
|
|
22
|
+
readonly right?: readonly InputBinding[];
|
|
23
|
+
readonly sticks?: readonly InputBinding[];
|
|
24
|
+
/** Analog input below this is taken as nothing. Defaults to 0.2. */
|
|
25
|
+
readonly deadZone?: number;
|
|
26
|
+
}
|
|
27
|
+
export type InputActionMap = Readonly<Record<string, InputActionDefinition>>;
|
|
28
|
+
/** A slot of an action that a binding can be put in: `bindings`, `negative`, `positive`, `up`, ... */
|
|
29
|
+
export type InputBindingSlot = 'bindings' | 'negative' | 'positive' | 'up' | 'down' | 'left' | 'right' | 'sticks';
|
|
30
|
+
export interface InputVector {
|
|
31
|
+
readonly x: number;
|
|
32
|
+
readonly y: number;
|
|
33
|
+
}
|
|
34
|
+
export interface InputActions {
|
|
35
|
+
/** The names of the actions, in the order they were defined. */
|
|
36
|
+
readonly names: readonly string[];
|
|
37
|
+
/** A control was pressed, or moved to `value` (0 to 1). Unknown controls are ignored. */
|
|
38
|
+
press(binding: InputBinding, value?: number): void;
|
|
39
|
+
release(binding: InputBinding): void;
|
|
40
|
+
/** A stick or touch stick points at x, y (each -1 to 1, y down). */
|
|
41
|
+
setStick(binding: InputBinding, x: number, y: number): void;
|
|
42
|
+
/** Lets every control go, as when the page loses focus. */
|
|
43
|
+
releaseAll(): void;
|
|
44
|
+
/** True while a button action is held. */
|
|
45
|
+
pressed(action: string): boolean;
|
|
46
|
+
/** True on the frame a button action went down, or up. */
|
|
47
|
+
justPressed(action: string): boolean;
|
|
48
|
+
justReleased(action: string): boolean;
|
|
49
|
+
/** An axis action from -1 to 1, or a button action as 0 or 1. */
|
|
50
|
+
value(action: string): number;
|
|
51
|
+
/** A vector action, of length at most 1; y is down. */
|
|
52
|
+
vector(action: string): InputVector;
|
|
53
|
+
/** Ends the frame: the "just" states are cleared. Call once a frame after the game read its input. */
|
|
54
|
+
endFrame(): void;
|
|
55
|
+
/** The controls of one slot of an action. */
|
|
56
|
+
bindingsOf(action: string, slot?: InputBindingSlot): readonly InputBinding[];
|
|
57
|
+
/** Puts `binding` at `index` of a slot (appending when `index` is the slot's length) and takes it off any other action. */
|
|
58
|
+
rebind(action: string, binding: InputBinding, options?: {
|
|
59
|
+
readonly slot?: InputBindingSlot;
|
|
60
|
+
readonly index?: number;
|
|
61
|
+
}): void;
|
|
62
|
+
/** Back to the bindings the map was made with. */
|
|
63
|
+
resetBindings(): void;
|
|
64
|
+
/** The bindings that differ from the map, as plain data to save. */
|
|
65
|
+
saveBindings(): InputBindingsSave;
|
|
66
|
+
/** Applies saved bindings; unknown actions and malformed entries are skipped. */
|
|
67
|
+
loadBindings(saved: unknown): void;
|
|
68
|
+
/** Told after each press or release that changed an action, with the action's name. */
|
|
69
|
+
subscribe(listener: (action: string, pressed: boolean) => void): () => void;
|
|
70
|
+
/** The control last pressed, for a "press a key" rebinding screen; undefined after `endFrame` until another. */
|
|
71
|
+
readonly lastPressed: InputBinding | undefined;
|
|
72
|
+
}
|
|
73
|
+
export interface InputBindingsSave {
|
|
74
|
+
readonly version: 1;
|
|
75
|
+
readonly actions: Readonly<Record<string, Partial<Record<InputBindingSlot, readonly InputBinding[]>>>>;
|
|
76
|
+
}
|
|
77
|
+
/** Makes the actions of `map`. */
|
|
78
|
+
export declare function createInputActions(map: InputActionMap): InputActions;
|
|
79
|
+
/** A readable name for a binding, for settings screens: `Key:KeyW` is `W`, `Mouse:0` is `Left button`. */
|
|
80
|
+
export declare function describeInputBinding(binding: InputBinding): string;
|
|
81
|
+
//# sourceMappingURL=inputActions.d.ts.map
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Named game actions over keys, mouse buttons, gamepad buttons and sticks, and
|
|
3
|
+
// on-screen controls. A game asks "is Jump pressed", "was Fire just pressed",
|
|
4
|
+
// "which way does Move point" and never which key that is; the player can
|
|
5
|
+
// rebind, and the bindings can be saved and loaded. This core takes no browser
|
|
6
|
+
// events: the browser kit entry feeds it from the page, and tests feed it
|
|
7
|
+
// directly.
|
|
8
|
+
import { EgretError } from '@egret/runtime';
|
|
9
|
+
const SLOTS = [
|
|
10
|
+
'bindings',
|
|
11
|
+
'negative',
|
|
12
|
+
'positive',
|
|
13
|
+
'up',
|
|
14
|
+
'down',
|
|
15
|
+
'left',
|
|
16
|
+
'right',
|
|
17
|
+
'sticks'
|
|
18
|
+
];
|
|
19
|
+
const PATTERN = /^(Key|Mouse|Pad|Touch):[A-Za-z0-9_+\-]{1,40}$/;
|
|
20
|
+
const MAX_ACTIONS = 256;
|
|
21
|
+
const MAX_BINDINGS = 16;
|
|
22
|
+
const invalid = (detail) => {
|
|
23
|
+
throw new EgretError('INPUT_ACTIONS_INVALID', { cause: new TypeError(detail) });
|
|
24
|
+
};
|
|
25
|
+
const clamp = (value, low, high) => (value < low ? low : value > high ? high : value);
|
|
26
|
+
function checkBinding(binding) {
|
|
27
|
+
if (typeof binding !== 'string' || !PATTERN.test(binding))
|
|
28
|
+
invalid('binding ' + String(binding));
|
|
29
|
+
return binding;
|
|
30
|
+
}
|
|
31
|
+
function slotsOf(definition, kind) {
|
|
32
|
+
const slots = Object.fromEntries(SLOTS.map(slot => [slot, []]));
|
|
33
|
+
const allowed = kind === 'button'
|
|
34
|
+
? ['bindings']
|
|
35
|
+
: kind === 'axis'
|
|
36
|
+
? ['negative', 'positive']
|
|
37
|
+
: ['up', 'down', 'left', 'right', 'sticks'];
|
|
38
|
+
for (const slot of SLOTS) {
|
|
39
|
+
const list = definition[slot];
|
|
40
|
+
if (list === undefined)
|
|
41
|
+
continue;
|
|
42
|
+
if (!allowed.includes(slot))
|
|
43
|
+
invalid(`${slot} on a ${kind} action`);
|
|
44
|
+
if (!Array.isArray(list) || list.length > MAX_BINDINGS)
|
|
45
|
+
invalid(slot);
|
|
46
|
+
slots[slot] = list.map(checkBinding);
|
|
47
|
+
}
|
|
48
|
+
return slots;
|
|
49
|
+
}
|
|
50
|
+
/** Makes the actions of `map`. */
|
|
51
|
+
export function createInputActions(map) {
|
|
52
|
+
if (typeof map !== 'object' || map === null)
|
|
53
|
+
invalid('map');
|
|
54
|
+
const names = Object.keys(map);
|
|
55
|
+
if (names.length === 0 || names.length > MAX_ACTIONS)
|
|
56
|
+
invalid('action count');
|
|
57
|
+
const actions = new Map();
|
|
58
|
+
const defaults = new Map();
|
|
59
|
+
for (const name of names) {
|
|
60
|
+
if (!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(name))
|
|
61
|
+
invalid('action name ' + name);
|
|
62
|
+
const definition = map[name];
|
|
63
|
+
if (typeof definition !== 'object' || definition === null)
|
|
64
|
+
invalid('action ' + name);
|
|
65
|
+
const kind = definition.kind ?? 'button';
|
|
66
|
+
if (kind !== 'button' && kind !== 'axis' && kind !== 'vector')
|
|
67
|
+
invalid('kind of ' + name);
|
|
68
|
+
const deadZone = definition.deadZone ?? 0.2;
|
|
69
|
+
if (!(deadZone >= 0 && deadZone < 1))
|
|
70
|
+
invalid('deadZone of ' + name);
|
|
71
|
+
const slots = slotsOf(definition, kind);
|
|
72
|
+
defaults.set(name, structuredCloneSlots(slots));
|
|
73
|
+
actions.set(name, { name, kind, deadZone, slots, down: false, wentDown: false, wentUp: false });
|
|
74
|
+
}
|
|
75
|
+
// What each control is doing now: a press value, or a stick's x and y.
|
|
76
|
+
const values = new Map();
|
|
77
|
+
const sticks = new Map();
|
|
78
|
+
const listeners = new Set();
|
|
79
|
+
let lastPressed;
|
|
80
|
+
const action = (name) => actions.get(name) ?? invalid('unknown action ' + name);
|
|
81
|
+
const level = (binding) => {
|
|
82
|
+
const direct = values.get(binding);
|
|
83
|
+
if (direct !== undefined)
|
|
84
|
+
return direct;
|
|
85
|
+
// Half of a stick axis: Pad:leftStickX+ reads the x of Pad:leftStick.
|
|
86
|
+
const half = /^(.*)([XY])([+-])$/.exec(binding);
|
|
87
|
+
if (half) {
|
|
88
|
+
const stick = sticks.get(half[1]);
|
|
89
|
+
if (stick) {
|
|
90
|
+
const v = half[2] === 'X' ? stick.x : stick.y;
|
|
91
|
+
return half[3] === '+' ? Math.max(0, v) : Math.max(0, -v);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return 0;
|
|
95
|
+
};
|
|
96
|
+
const strongest = (list) => {
|
|
97
|
+
let best = 0;
|
|
98
|
+
for (const binding of list)
|
|
99
|
+
best = Math.max(best, level(binding));
|
|
100
|
+
return best;
|
|
101
|
+
};
|
|
102
|
+
const buttonLevel = (a) => {
|
|
103
|
+
switch (a.kind) {
|
|
104
|
+
case 'button':
|
|
105
|
+
return strongest(a.slots.bindings);
|
|
106
|
+
case 'axis':
|
|
107
|
+
return Math.abs(axisOf(a));
|
|
108
|
+
default: {
|
|
109
|
+
const v = vectorOf(a);
|
|
110
|
+
return Math.hypot(v.x, v.y);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const axisOf = (a) => {
|
|
115
|
+
const raw = strongest(a.slots.positive) - strongest(a.slots.negative);
|
|
116
|
+
return Math.abs(raw) <= a.deadZone ? 0 : clamp(raw, -1, 1);
|
|
117
|
+
};
|
|
118
|
+
const vectorOf = (a) => {
|
|
119
|
+
let x = strongest(a.slots.right) - strongest(a.slots.left), y = strongest(a.slots.down) - strongest(a.slots.up);
|
|
120
|
+
for (const binding of a.slots.sticks) {
|
|
121
|
+
const stick = sticks.get(binding);
|
|
122
|
+
if (stick && Math.hypot(stick.x, stick.y) > Math.hypot(x, y)) {
|
|
123
|
+
x = stick.x;
|
|
124
|
+
y = stick.y;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const length = Math.hypot(x, y);
|
|
128
|
+
if (length <= a.deadZone)
|
|
129
|
+
return { x: 0, y: 0 };
|
|
130
|
+
// The dead zone is taken out and the rest stretched to reach 1, so small pushes start from zero.
|
|
131
|
+
const scaled = Math.min(1, (length - a.deadZone) / (1 - a.deadZone));
|
|
132
|
+
return { x: (x / length) * scaled, y: (y / length) * scaled };
|
|
133
|
+
};
|
|
134
|
+
const refresh = () => {
|
|
135
|
+
for (const a of actions.values()) {
|
|
136
|
+
const down = buttonLevel(a) > (a.kind === 'button' ? 0.5 : 0);
|
|
137
|
+
if (down === a.down)
|
|
138
|
+
continue;
|
|
139
|
+
a.down = down;
|
|
140
|
+
if (down)
|
|
141
|
+
a.wentDown = true;
|
|
142
|
+
else
|
|
143
|
+
a.wentUp = true;
|
|
144
|
+
for (const listener of [...listeners])
|
|
145
|
+
listener(a.name, down);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const api = {
|
|
149
|
+
names: Object.freeze([...names]),
|
|
150
|
+
press(binding, value = 1) {
|
|
151
|
+
checkBinding(binding);
|
|
152
|
+
if (!(value >= 0 && value <= 1))
|
|
153
|
+
invalid('press value');
|
|
154
|
+
if (value === 0)
|
|
155
|
+
values.delete(binding);
|
|
156
|
+
else {
|
|
157
|
+
if (!values.has(binding))
|
|
158
|
+
lastPressed = binding;
|
|
159
|
+
values.set(binding, value);
|
|
160
|
+
}
|
|
161
|
+
refresh();
|
|
162
|
+
},
|
|
163
|
+
release(binding) {
|
|
164
|
+
checkBinding(binding);
|
|
165
|
+
values.delete(binding);
|
|
166
|
+
refresh();
|
|
167
|
+
},
|
|
168
|
+
setStick(binding, x, y) {
|
|
169
|
+
checkBinding(binding);
|
|
170
|
+
if (!Number.isFinite(x) || !Number.isFinite(y))
|
|
171
|
+
invalid('stick value');
|
|
172
|
+
const length = Math.hypot(x, y);
|
|
173
|
+
if (length > 1) {
|
|
174
|
+
x /= length;
|
|
175
|
+
y /= length;
|
|
176
|
+
}
|
|
177
|
+
if (x === 0 && y === 0)
|
|
178
|
+
sticks.delete(binding);
|
|
179
|
+
else
|
|
180
|
+
sticks.set(binding, { x, y });
|
|
181
|
+
refresh();
|
|
182
|
+
},
|
|
183
|
+
releaseAll() {
|
|
184
|
+
values.clear();
|
|
185
|
+
sticks.clear();
|
|
186
|
+
refresh();
|
|
187
|
+
},
|
|
188
|
+
pressed: name => action(name).down,
|
|
189
|
+
justPressed: name => action(name).wentDown,
|
|
190
|
+
justReleased: name => action(name).wentUp,
|
|
191
|
+
value(name) {
|
|
192
|
+
const a = action(name);
|
|
193
|
+
if (a.kind === 'axis')
|
|
194
|
+
return axisOf(a);
|
|
195
|
+
if (a.kind === 'button')
|
|
196
|
+
return a.down ? 1 : 0;
|
|
197
|
+
return Math.hypot(vectorOf(a).x, vectorOf(a).y);
|
|
198
|
+
},
|
|
199
|
+
vector(name) {
|
|
200
|
+
const a = action(name);
|
|
201
|
+
if (a.kind === 'vector')
|
|
202
|
+
return vectorOf(a);
|
|
203
|
+
if (a.kind === 'axis')
|
|
204
|
+
return { x: axisOf(a), y: 0 };
|
|
205
|
+
return { x: a.down ? 1 : 0, y: 0 };
|
|
206
|
+
},
|
|
207
|
+
endFrame() {
|
|
208
|
+
for (const a of actions.values())
|
|
209
|
+
a.wentDown = a.wentUp = false;
|
|
210
|
+
lastPressed = undefined;
|
|
211
|
+
},
|
|
212
|
+
bindingsOf(name, slot) {
|
|
213
|
+
const a = action(name);
|
|
214
|
+
return Object.freeze([...a.slots[slot ?? defaultSlot(a.kind)]]);
|
|
215
|
+
},
|
|
216
|
+
rebind(name, binding, options = {}) {
|
|
217
|
+
const a = action(name);
|
|
218
|
+
checkBinding(binding);
|
|
219
|
+
const slot = options.slot ?? defaultSlot(a.kind);
|
|
220
|
+
if (!SLOTS.includes(slot) || !slotsOf({ [slot]: [binding] }, a.kind))
|
|
221
|
+
invalid('slot');
|
|
222
|
+
const list = a.slots[slot];
|
|
223
|
+
const index = options.index ?? 0;
|
|
224
|
+
if (!Number.isSafeInteger(index) || index < 0 || index > list.length || index >= MAX_BINDINGS)
|
|
225
|
+
invalid('index');
|
|
226
|
+
// A control does one thing: it is taken off wherever else it was.
|
|
227
|
+
for (const other of actions.values())
|
|
228
|
+
for (const s of SLOTS) {
|
|
229
|
+
const at = other.slots[s].indexOf(binding);
|
|
230
|
+
if (at >= 0 && !(other === a && s === slot && at === index))
|
|
231
|
+
other.slots[s].splice(at, 1);
|
|
232
|
+
}
|
|
233
|
+
if (index < list.length)
|
|
234
|
+
list[index] = binding;
|
|
235
|
+
else
|
|
236
|
+
list.push(binding);
|
|
237
|
+
refresh();
|
|
238
|
+
},
|
|
239
|
+
resetBindings() {
|
|
240
|
+
for (const [name, slots] of defaults)
|
|
241
|
+
action(name).slots = structuredCloneSlots(slots);
|
|
242
|
+
refresh();
|
|
243
|
+
},
|
|
244
|
+
saveBindings() {
|
|
245
|
+
const saved = {};
|
|
246
|
+
for (const [name, slots] of defaults) {
|
|
247
|
+
const now = action(name).slots;
|
|
248
|
+
for (const slot of SLOTS)
|
|
249
|
+
if (now[slot].join('\n') !== slots[slot].join('\n'))
|
|
250
|
+
(saved[name] ??= {})[slot] = [...now[slot]];
|
|
251
|
+
}
|
|
252
|
+
return { version: 1, actions: saved };
|
|
253
|
+
},
|
|
254
|
+
loadBindings(saved) {
|
|
255
|
+
const data = saved;
|
|
256
|
+
if (!data || data.version !== 1 || typeof data.actions !== 'object' || data.actions === null)
|
|
257
|
+
return;
|
|
258
|
+
for (const [name, slots] of Object.entries(data.actions)) {
|
|
259
|
+
const a = actions.get(name);
|
|
260
|
+
if (!a || typeof slots !== 'object' || slots === null)
|
|
261
|
+
continue;
|
|
262
|
+
for (const [slot, list] of Object.entries(slots)) {
|
|
263
|
+
if (!SLOTS.includes(slot) || !Array.isArray(list) || list.length > MAX_BINDINGS)
|
|
264
|
+
continue;
|
|
265
|
+
if (!list.every(b => typeof b === 'string' && PATTERN.test(b)))
|
|
266
|
+
continue;
|
|
267
|
+
try {
|
|
268
|
+
slotsOf({ [slot]: list }, a.kind);
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
a.slots[slot] = [...list];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
refresh();
|
|
277
|
+
},
|
|
278
|
+
subscribe(listener) {
|
|
279
|
+
if (typeof listener !== 'function')
|
|
280
|
+
invalid('listener');
|
|
281
|
+
listeners.add(listener);
|
|
282
|
+
return () => listeners.delete(listener);
|
|
283
|
+
},
|
|
284
|
+
get lastPressed() {
|
|
285
|
+
return lastPressed;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
return Object.freeze(api);
|
|
289
|
+
}
|
|
290
|
+
function defaultSlot(kind) {
|
|
291
|
+
return kind === 'button' ? 'bindings' : kind === 'axis' ? 'positive' : 'sticks';
|
|
292
|
+
}
|
|
293
|
+
function structuredCloneSlots(slots) {
|
|
294
|
+
return Object.fromEntries(SLOTS.map(slot => [slot, [...slots[slot]]]));
|
|
295
|
+
}
|
|
296
|
+
/** A readable name for a binding, for settings screens: `Key:KeyW` is `W`, `Mouse:0` is `Left button`. */
|
|
297
|
+
export function describeInputBinding(binding) {
|
|
298
|
+
checkBinding(binding);
|
|
299
|
+
const [device, control] = binding.split(':');
|
|
300
|
+
if (device === 'Key') {
|
|
301
|
+
if (/^Key[A-Z]$/.test(control))
|
|
302
|
+
return control.slice(3);
|
|
303
|
+
if (/^Digit[0-9]$/.test(control))
|
|
304
|
+
return control.slice(5);
|
|
305
|
+
const named = {
|
|
306
|
+
Space: 'Space',
|
|
307
|
+
Enter: 'Enter',
|
|
308
|
+
Escape: 'Esc',
|
|
309
|
+
ShiftLeft: 'Shift',
|
|
310
|
+
ShiftRight: 'Right Shift',
|
|
311
|
+
ControlLeft: 'Ctrl',
|
|
312
|
+
ControlRight: 'Right Ctrl',
|
|
313
|
+
AltLeft: 'Alt',
|
|
314
|
+
AltRight: 'Right Alt',
|
|
315
|
+
ArrowUp: '↑',
|
|
316
|
+
ArrowDown: '↓',
|
|
317
|
+
ArrowLeft: '←',
|
|
318
|
+
ArrowRight: '→',
|
|
319
|
+
Tab: 'Tab',
|
|
320
|
+
Backspace: 'Backspace'
|
|
321
|
+
};
|
|
322
|
+
return named[control] ?? control;
|
|
323
|
+
}
|
|
324
|
+
if (device === 'Mouse')
|
|
325
|
+
return ['Left button', 'Middle button', 'Right button'][Number(control)] ?? `Mouse ${control}`;
|
|
326
|
+
if (device === 'Pad')
|
|
327
|
+
return `Pad ${control}`;
|
|
328
|
+
return control;
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=inputActions.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AssetProvider, AssetType, Scope, SequenceClip, SequenceFrameInput } from '@egret/runtime';
|
|
2
|
+
import type { AdmittedResourceManifest } from '@egret/contracts/resources';
|
|
3
|
+
import type { ManifestAssetGroup, ManifestBinding, ManifestGroupOptions } from '../manifestResourceTypes.js';
|
|
4
|
+
export interface ContentEngineOperations {
|
|
5
|
+
assertOpen(): void;
|
|
6
|
+
isScope(value: unknown): value is Scope;
|
|
7
|
+
register<T>(type: AssetType<T>, provider: AssetProvider<T>): void;
|
|
8
|
+
group(scope: Scope, manifest: AdmittedResourceManifest, roots: readonly string[], bindings: readonly ManifestBinding[], options?: ManifestGroupOptions): ManifestAssetGroup;
|
|
9
|
+
own(dispose: () => void): () => void;
|
|
10
|
+
}
|
|
11
|
+
/** Only genuine Engine construction installs captured manager and Scope authority. */
|
|
12
|
+
export declare function registerContentEngine(engine: object, operations: ContentEngineOperations): void;
|
|
13
|
+
export declare function requireContentEngine(engine: unknown): ContentEngineOperations;
|
|
14
|
+
export declare function registerContentLoader(loader: object, authenticate: (scope: Scope, imageId: string, sequenceId: string) => void): void;
|
|
15
|
+
export declare function authenticateContentLoader(loader: unknown, scope: Scope, imageId: string, sequenceId: string): void;
|
|
16
|
+
export declare function registerSequenceTimeline(clip: SequenceClip, frames: readonly SequenceFrameInput[]): void;
|
|
17
|
+
export declare function hasSequenceTimeline(clip: SequenceClip): boolean;
|
|
18
|
+
export declare function hasMatchingSequenceTimeline(source: SequenceClip, candidate: SequenceClip): boolean;
|
|
19
|
+
//# sourceMappingURL=contentFactoryState.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { EgretError } from '@egret/runtime';
|
|
3
|
+
const engines = new WeakMap();
|
|
4
|
+
/** Only genuine Engine construction installs captured manager and Scope authority. */
|
|
5
|
+
export function registerContentEngine(engine, operations) {
|
|
6
|
+
engines.set(engine, Object.freeze(operations));
|
|
7
|
+
}
|
|
8
|
+
export function requireContentEngine(engine) {
|
|
9
|
+
const value = engines.get(engine);
|
|
10
|
+
if (value === undefined)
|
|
11
|
+
throw new EgretError('CONTENT_ENGINE_INVALID');
|
|
12
|
+
value.assertOpen();
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
/** Private loader identity and catalog relationship; no structural loader grants authority. */
|
|
16
|
+
const contentLoaders = new WeakMap();
|
|
17
|
+
export function registerContentLoader(loader, authenticate) {
|
|
18
|
+
contentLoaders.set(loader, authenticate);
|
|
19
|
+
}
|
|
20
|
+
export function authenticateContentLoader(loader, scope, imageId, sequenceId) {
|
|
21
|
+
const authenticate = contentLoaders.get(loader);
|
|
22
|
+
if (!authenticate)
|
|
23
|
+
throw new EgretError('SEQUENCE_RESET_LOADER_INVALID');
|
|
24
|
+
authenticate(scope, imageId, sequenceId);
|
|
25
|
+
}
|
|
26
|
+
/** Retain only the authored frame boundaries of genuine ContentLoader clips. */
|
|
27
|
+
const sequenceTimelines = new WeakMap();
|
|
28
|
+
export function registerSequenceTimeline(clip, frames) {
|
|
29
|
+
let end = 0;
|
|
30
|
+
sequenceTimelines.set(clip, Object.freeze(frames.map(frame => (end += frame.durationSeconds))));
|
|
31
|
+
}
|
|
32
|
+
export function hasSequenceTimeline(clip) {
|
|
33
|
+
return sequenceTimelines.has(clip);
|
|
34
|
+
}
|
|
35
|
+
export function hasMatchingSequenceTimeline(source, candidate) {
|
|
36
|
+
const first = sequenceTimelines.get(source), second = sequenceTimelines.get(candidate);
|
|
37
|
+
return (first !== undefined &&
|
|
38
|
+
second !== undefined &&
|
|
39
|
+
first.length === second.length &&
|
|
40
|
+
first.every((end, index) => end === second[index]));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=contentFactoryState.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Bitmap, DisplayObject } from '@egret/runtime';
|
|
2
|
+
import type { AssetLease, Texture } from '@egret/runtime';
|
|
3
|
+
import type { Rectangle2D, TextureRegion2D } from '@egret/contracts';
|
|
4
|
+
import type { MouseInputEnginePort } from '../mouseInput.js';
|
|
5
|
+
import type { MouseInputPayload } from '../mouseInputTypes.js';
|
|
6
|
+
/** Assembly installs authority before publishing the genuine Engine. */
|
|
7
|
+
export declare function registerMouseInputEngine(engine: object, port: MouseInputEnginePort): void;
|
|
8
|
+
export declare function requireMouseInputEngine(engine: unknown): MouseInputEnginePort;
|
|
9
|
+
/** Successful Host startup is separate from ordinary open-state observation. */
|
|
10
|
+
export declare function markMouseInputEngineStarted(engine: object): void;
|
|
11
|
+
/** Eager Engine assembly records genuine Scope origin without retaining its Engine. */
|
|
12
|
+
export declare function registerMouseInputScope(scope: object, engine: object): void;
|
|
13
|
+
/** Button admission distinguishes foreign genuine Scope from an unregistered value. */
|
|
14
|
+
export declare function assertBitmapButtonScopeOrigin(scope: unknown, engine: object): void;
|
|
15
|
+
/** Native delivery alone owns these associations and their opaque gesture tokens. */
|
|
16
|
+
export interface BitmapButtonAssociation {
|
|
17
|
+
readonly target: Bitmap;
|
|
18
|
+
syncTerminal(): void;
|
|
19
|
+
beforeBegin(token: object): void;
|
|
20
|
+
beforeEnd(token: object): void;
|
|
21
|
+
cancel(): void;
|
|
22
|
+
afterActivate(token: object, payload: MouseInputPayload, eligible: () => boolean): void;
|
|
23
|
+
finish(token: object): void;
|
|
24
|
+
retire(): readonly unknown[];
|
|
25
|
+
}
|
|
26
|
+
export interface BitmapButtonInputPort {
|
|
27
|
+
assertOpen(): void;
|
|
28
|
+
add(association: BitmapButtonAssociation): void;
|
|
29
|
+
remove(association: BitmapButtonAssociation): void;
|
|
30
|
+
}
|
|
31
|
+
/** Keep only an opaque origin token after input retirement, not its Engine. */
|
|
32
|
+
export declare function registerMouseInputInstance(input: object, engine: object, port: BitmapButtonInputPort): void;
|
|
33
|
+
export declare function requireBitmapButtonInput(input: unknown, engine: object): BitmapButtonInputPort;
|
|
34
|
+
/** Public accessors read original private slots despite later instance/prototype shadows. */
|
|
35
|
+
export declare const bitmapButtonOperations: Readonly<{
|
|
36
|
+
lease(bitmap: Bitmap): AssetLease<Texture> | undefined;
|
|
37
|
+
crop(bitmap: Bitmap): TextureRegion2D | undefined;
|
|
38
|
+
hit(bitmap: Bitmap): Rectangle2D | undefined;
|
|
39
|
+
touch(bitmap: Bitmap): boolean;
|
|
40
|
+
disposed(bitmap: Bitmap): boolean;
|
|
41
|
+
setLease(bitmap: Bitmap, lease: AssetLease<Texture> | undefined): void;
|
|
42
|
+
setCrop(bitmap: Bitmap, crop: TextureRegion2D): void;
|
|
43
|
+
setHit(bitmap: Bitmap, hit: Rectangle2D): void;
|
|
44
|
+
setTouch(bitmap: Bitmap, enabled: boolean): void;
|
|
45
|
+
dispose(bitmap: Bitmap): void;
|
|
46
|
+
disposeDisplay(bitmap: Bitmap): void;
|
|
47
|
+
invoke(callback: (payload: MouseInputPayload) => void, payload: MouseInputPayload): unknown;
|
|
48
|
+
}>;
|
|
49
|
+
declare const inputRuntimePrimitives: Readonly<{
|
|
50
|
+
parent(target: DisplayObject): DisplayObject | undefined;
|
|
51
|
+
visible(target: DisplayObject): boolean;
|
|
52
|
+
disposed(target: DisplayObject): boolean;
|
|
53
|
+
}>;
|
|
54
|
+
/** Optional keyboard admission reuses getters captured before Engine publication. */
|
|
55
|
+
export declare function captureMouseInputRuntimePrimitives(): typeof inputRuntimePrimitives;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=mouseInputFactoryState.d.ts.map
|