1681-engine 0.0.0-stage → 0.5.9
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/CHANGELOG.md +357 -0
- package/LICENSE +21 -0
- package/README.md +164 -2
- package/dist/1681-engine.js +471 -0
- package/dist/ambient/ColorGrade.js +40 -0
- package/dist/ambient/DayClock.js +56 -0
- package/dist/ambient/WeatherLayer.js +90 -0
- package/dist/ambient/grade.js +12 -0
- package/dist/ambient/weather.js +51 -0
- package/dist/anim/AnimStateMachine.js +163 -0
- package/dist/anim/Animator.js +66 -0
- package/dist/anim/animStateCompile.js +112 -0
- package/dist/anim/animStateSystem.js +16 -0
- package/dist/anim/animationSystem.js +14 -0
- package/dist/anim/asepriteSlices.js +21 -0
- package/dist/anim/asepriteTags.js +34 -0
- package/dist/anim/parseAseprite.js +82 -0
- package/dist/assets/AssetLoader.js +202 -0
- package/dist/assets/loadAseprite.js +49 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +30 -0
- package/dist/assets/textureAtlas.js +58 -0
- package/dist/audio/Footsteps.js +25 -0
- package/dist/audio/MusicPlayer.js +77 -0
- package/dist/audio/SoundEngine.js +125 -0
- package/dist/audio/cleanTake.js +29 -0
- package/dist/audio/music/ElementVoice.js +34 -0
- package/dist/audio/music/GraphVoice.js +38 -0
- package/dist/audio/music/MusicChannel.js +57 -0
- package/dist/audio/music/musicVoice.js +12 -0
- package/dist/audio/sampleBank.js +81 -0
- package/dist/audio/soundTable.js +8 -0
- package/dist/audio/synth.js +35 -0
- package/dist/core/BitmapLabel.js +48 -0
- package/dist/core/Camera.js +149 -0
- package/dist/core/Clock.js +40 -0
- package/dist/core/Graphics.js +68 -0
- package/dist/core/Group.js +28 -0
- package/dist/core/Image.js +50 -0
- package/dist/core/ObjectFactory.js +54 -0
- package/dist/core/Pointer.js +80 -0
- package/dist/core/Rectangle.js +50 -0
- package/dist/core/Stage.js +85 -0
- package/dist/core/Text.js +21 -0
- package/dist/core/TextureRegistry.js +141 -0
- package/dist/core/Timeline.js +210 -0
- package/dist/core/TimelineBuilder.js +72 -0
- package/dist/core/TimelineChild.js +83 -0
- package/dist/core/Tweener.js +135 -0
- package/dist/core/atlas.js +37 -0
- package/dist/core/atlasPlan.js +21 -0
- package/dist/core/blendLayer.js +11 -0
- package/dist/core/eases.js +20 -0
- package/dist/core/gameObject.js +117 -0
- package/dist/core/pixelZoom.js +43 -0
- package/dist/core/pixiPatches.js +17 -0
- package/dist/core/runDue.js +28 -0
- package/dist/core/silhouette.js +49 -0
- package/dist/core/timelinePlace.js +23 -0
- package/dist/core/tweenProps.js +11 -0
- package/dist/debug/DebugOverlay.js +93 -0
- package/dist/debug/DrawCallCounter.js +44 -0
- package/dist/debug/ErrorLog.js +21 -0
- package/dist/debug/FrameStats.js +41 -0
- package/dist/debug/inspectWorld.js +28 -0
- package/dist/diagnostics/ErrorDeduper.js +26 -0
- package/dist/diagnostics/FrameSampler.js +41 -0
- package/dist/diagnostics/bootWatch.js +20 -0
- package/dist/diagnostics/captureErrors.js +26 -0
- package/dist/diagnostics/contextLoss.js +24 -0
- package/dist/diagnostics/frameStats.js +30 -0
- package/dist/diagnostics/gpuInfo.js +21 -0
- package/dist/diagnostics/renderGuard.js +23 -0
- package/dist/ecs/SparseSet.js +54 -0
- package/dist/ecs/World.js +306 -0
- package/dist/ecs/fields.js +25 -0
- package/dist/engine/Engine.js +106 -0
- package/dist/engine/FixedLoop.js +36 -0
- package/dist/engine/HiddenPause.js +27 -0
- package/dist/engine/Scene.js +78 -0
- package/dist/engine/SceneManager.js +72 -0
- package/dist/events/EventBus.js +41 -0
- package/dist/fx/Afterimages.js +82 -0
- package/dist/fx/FloatingText.js +71 -0
- package/dist/fx/hitStop.js +27 -0
- package/dist/fx/viewCull.js +9 -0
- package/dist/i18n/Translator.js +71 -0
- package/dist/i18n/extractStrings.js +57 -0
- package/dist/i18n/formatMessage.js +18 -0
- package/dist/input/Actions.js +139 -0
- package/dist/input/AimGesture.js +74 -0
- package/dist/input/Keyboard.js +53 -0
- package/dist/input/Keymap.js +170 -0
- package/dist/input/TargetLock.js +72 -0
- package/dist/input/aimAxis.js +7 -0
- package/dist/input/keyChord.js +28 -0
- package/dist/input/longPress.js +31 -0
- package/dist/input/rumble.js +42 -0
- package/dist/input/stickAxis.js +22 -0
- package/dist/input/touchDetect.js +6 -0
- package/dist/light/LightLayer.js +83 -0
- package/dist/nav/MinHeap.js +38 -0
- package/dist/nav/findPath.js +77 -0
- package/dist/nav/navGrid.js +35 -0
- package/dist/nav/nearestOpen.js +18 -0
- package/dist/nav/straightenPath.js +50 -0
- package/dist/net/Connection.js +107 -0
- package/dist/net/InterpolationBuffer.js +56 -0
- package/dist/net/PredictedMover.js +60 -0
- package/dist/net/Room.js +91 -0
- package/dist/net/RoomHost.js +100 -0
- package/dist/net/cadence.js +21 -0
- package/dist/net/constants.js +10 -0
- package/dist/net/lobby/LobbyClient.js +123 -0
- package/dist/net/lobby/LobbyHost.js +365 -0
- package/dist/net/lobby/LobbyRooms.js +65 -0
- package/dist/net/lobby/Matchmaker.js +105 -0
- package/dist/net/movement.js +84 -0
- package/dist/net/protocol.js +10 -0
- package/dist/net/reconnect.js +10 -0
- package/dist/net/serverClock.js +21 -0
- package/dist/net/snapshotCodec.js +91 -0
- package/dist/parallax/Parallax.js +31 -0
- package/dist/parallax/ParallaxLayer.js +69 -0
- package/dist/parallax/parallaxMath.js +26 -0
- package/dist/particles/Emitter.js +107 -0
- package/dist/particles/ParticleBudget.js +31 -0
- package/dist/particles/ParticleSim.js +59 -0
- package/dist/particles/particleCurves.js +47 -0
- package/dist/particles/particleSampling.js +29 -0
- package/dist/physics/Body.js +201 -0
- package/dist/physics/BroadPhase.js +55 -0
- package/dist/physics/Contact.js +75 -0
- package/dist/physics/ContactSolver.js +69 -0
- package/dist/physics/PhysicsWorld.js +220 -0
- package/dist/physics/SpatialHash.js +38 -0
- package/dist/physics/collide.js +75 -0
- package/dist/physics/collidePolygon.js +93 -0
- package/dist/physics/contactReport.js +13 -0
- package/dist/physics/drawColliders.js +30 -0
- package/dist/physics/physicsSystem.js +7 -0
- package/dist/physics/polygon.js +79 -0
- package/dist/physics/raycast.js +61 -0
- package/dist/physics/syncToBody.js +18 -0
- package/dist/physics/tileBodies.js +58 -0
- package/dist/physics/types.js +7 -0
- package/dist/pixel/Darkness.js +169 -0
- package/dist/pixel/DitherVignette.js +56 -0
- package/dist/pixel/Evaporation.js +84 -0
- package/dist/pixel/NightShade.js +33 -0
- package/dist/pixel/PixelLayer.js +210 -0
- package/dist/pixel/PixelMarks.js +99 -0
- package/dist/pixel/SwayProp.js +74 -0
- package/dist/pixel/aimPixels.js +67 -0
- package/dist/pixel/lights.js +43 -0
- package/dist/pixel/nineSlice.js +61 -0
- package/dist/pixel/paintLayer.js +35 -0
- package/dist/pixel/palette.js +56 -0
- package/dist/pixel/pixel.js +277 -0
- package/dist/pixel/pixelPaint.js +197 -0
- package/dist/pixel/pixelParticles.js +35 -0
- package/dist/pixel/pixelTone.js +163 -0
- package/dist/pixel/propKit.js +40 -0
- package/dist/pixel/ramp.js +101 -0
- package/dist/pixel/selout.js +34 -0
- package/dist/pixel/spritePixels.js +58 -0
- package/dist/pixel/swayRig.js +86 -0
- package/dist/pixel/vignetteMask.js +23 -0
- package/dist/pixel/weatherArt.js +60 -0
- package/dist/pixel.js +96 -0
- package/dist/platform/appResume.js +18 -0
- package/dist/platform/fullscreen.js +52 -0
- package/dist/platform/orientation.js +26 -0
- package/dist/platform/pointerLock.js +37 -0
- package/dist/platform/reducedMotion.js +23 -0
- package/dist/platform/timeoutSignal.js +14 -0
- package/dist/platform/touch.js +32 -0
- package/dist/postfx/BloomFilter.js +64 -0
- package/dist/postfx/ChromaticAberrationFilter.js +24 -0
- package/dist/postfx/ColorAdjustFilter.js +75 -0
- package/dist/postfx/CrtFilter.js +41 -0
- package/dist/postfx/PixelateFilter.js +26 -0
- package/dist/postfx/PostFx.js +122 -0
- package/dist/postfx/ShockwaveFilter.js +48 -0
- package/dist/postfx/VignetteFilter.js +36 -0
- package/dist/postfx/fxAnimator.js +37 -0
- package/dist/postfx/fxShader.js +127 -0
- package/dist/postfx.js +25 -0
- package/dist/react/ChoiceDialog.js +50 -0
- package/dist/react/ConfirmDialog.js +52 -0
- package/dist/react/Glyph.js +62 -0
- package/dist/react/Modal.js +37 -0
- package/dist/react/Panel.js +23 -0
- package/dist/react/PixelImage.js +23 -0
- package/dist/react/Select.js +98 -0
- package/dist/react/Slider.js +61 -0
- package/dist/react/SplitPane.js +23 -0
- package/dist/react/TabStrip.js +31 -0
- package/dist/react/TitleTips.js +41 -0
- package/dist/react/Tooltip.js +27 -0
- package/dist/react/UiProvider.js +49 -0
- package/dist/react/baseCss.js +221 -0
- package/dist/react/choiceStore.js +22 -0
- package/dist/react/classNames.js +18 -0
- package/dist/react/confirmStore.js +29 -0
- package/dist/react/labels.js +17 -0
- package/dist/react/placement.js +48 -0
- package/dist/react/useFillSheet.js +22 -0
- package/dist/react/useFitToViewport.js +28 -0
- package/dist/react/usePicked.js +12 -0
- package/dist/react/useStore.js +8 -0
- package/dist/react/useViewport.js +16 -0
- package/dist/react.js +77 -0
- package/dist/rig/PosePlayer.js +91 -0
- package/dist/rig/RigView.js +124 -0
- package/dist/rig/Skeleton.js +30 -0
- package/dist/rig/humanoid.js +5 -0
- package/dist/rig/humanoid.json.js +29 -0
- package/dist/rig/humanoidPoses.js +29 -0
- package/dist/rig/poseMath.js +53 -0
- package/dist/rig/poses.json.js +149 -0
- package/dist/save/Autosaver.js +53 -0
- package/dist/save/MemoryBackend.js +18 -0
- package/dist/save/SaveStore.js +102 -0
- package/dist/save/WebStorageBackend.js +26 -0
- package/dist/save/checksum.js +9 -0
- package/dist/save/migrateSave.js +26 -0
- package/dist/settings.js +26 -0
- package/dist/tilemap/TilemapView.js +68 -0
- package/dist/tilemap/collision.js +24 -0
- package/dist/tilemap/tiled.js +137 -0
- package/dist/transitions/CrossfadeTransition.js +23 -0
- package/dist/transitions/DitherWipeTransition.js +69 -0
- package/dist/transitions/FadeTransition.js +33 -0
- package/dist/transitions/Letterbox.js +41 -0
- package/dist/transitions/ditherMask.js +14 -0
- package/dist/transitions/transitionTo.js +27 -0
- package/dist/transitions/tweenDone.js +14 -0
- package/dist/types/ambient/ColorGrade.d.ts +41 -0
- package/dist/types/ambient/ColorGrade.d.ts.map +1 -0
- package/dist/types/ambient/DayClock.d.ts +80 -0
- package/dist/types/ambient/DayClock.d.ts.map +1 -0
- package/dist/types/ambient/WeatherLayer.d.ts +78 -0
- package/dist/types/ambient/WeatherLayer.d.ts.map +1 -0
- package/dist/types/ambient/grade.d.ts +22 -0
- package/dist/types/ambient/grade.d.ts.map +1 -0
- package/dist/types/ambient/weather.d.ts +49 -0
- package/dist/types/ambient/weather.d.ts.map +1 -0
- package/dist/types/anim/AnimStateMachine.d.ts +80 -0
- package/dist/types/anim/AnimStateMachine.d.ts.map +1 -0
- package/dist/types/anim/Animator.d.ts +50 -0
- package/dist/types/anim/Animator.d.ts.map +1 -0
- package/dist/types/anim/animStateCompile.d.ts +52 -0
- package/dist/types/anim/animStateCompile.d.ts.map +1 -0
- package/dist/types/anim/animStateSystem.d.ts +10 -0
- package/dist/types/anim/animStateSystem.d.ts.map +1 -0
- package/dist/types/anim/animStateTypes.d.ts +50 -0
- package/dist/types/anim/animStateTypes.d.ts.map +1 -0
- package/dist/types/anim/animationSystem.d.ts +13 -0
- package/dist/types/anim/animationSystem.d.ts.map +1 -0
- package/dist/types/anim/asepriteSlices.d.ts +19 -0
- package/dist/types/anim/asepriteSlices.d.ts.map +1 -0
- package/dist/types/anim/asepriteTags.d.ts +16 -0
- package/dist/types/anim/asepriteTags.d.ts.map +1 -0
- package/dist/types/anim/asepriteTypes.d.ts +159 -0
- package/dist/types/anim/asepriteTypes.d.ts.map +1 -0
- package/dist/types/anim/parseAseprite.d.ts +21 -0
- package/dist/types/anim/parseAseprite.d.ts.map +1 -0
- package/dist/types/assets/AssetLoader.d.ts +140 -0
- package/dist/types/assets/AssetLoader.d.ts.map +1 -0
- package/dist/types/assets/loadAseprite.d.ts +27 -0
- package/dist/types/assets/loadAseprite.d.ts.map +1 -0
- package/dist/types/assets/textureAtlas.d.ts +35 -0
- package/dist/types/assets/textureAtlas.d.ts.map +1 -0
- package/dist/types/audio/Footsteps.d.ts +33 -0
- package/dist/types/audio/Footsteps.d.ts.map +1 -0
- package/dist/types/audio/MusicPlayer.d.ts +65 -0
- package/dist/types/audio/MusicPlayer.d.ts.map +1 -0
- package/dist/types/audio/SoundEngine.d.ts +47 -0
- package/dist/types/audio/SoundEngine.d.ts.map +1 -0
- package/dist/types/audio/cleanTake.d.ts +3 -0
- package/dist/types/audio/cleanTake.d.ts.map +1 -0
- package/dist/types/audio/music/ElementVoice.d.ts +14 -0
- package/dist/types/audio/music/ElementVoice.d.ts.map +1 -0
- package/dist/types/audio/music/GraphVoice.d.ts +22 -0
- package/dist/types/audio/music/GraphVoice.d.ts.map +1 -0
- package/dist/types/audio/music/MusicChannel.d.ts +35 -0
- package/dist/types/audio/music/MusicChannel.d.ts.map +1 -0
- package/dist/types/audio/music/musicVoice.d.ts +26 -0
- package/dist/types/audio/music/musicVoice.d.ts.map +1 -0
- package/dist/types/audio/sampleBank.d.ts +27 -0
- package/dist/types/audio/sampleBank.d.ts.map +1 -0
- package/dist/types/audio/soundTable.d.ts +14 -0
- package/dist/types/audio/soundTable.d.ts.map +1 -0
- package/dist/types/audio/synth.d.ts +34 -0
- package/dist/types/audio/synth.d.ts.map +1 -0
- package/dist/types/audio/takeCleanerWorker.d.ts +2 -0
- package/dist/types/audio/takeCleanerWorker.d.ts.map +1 -0
- package/dist/types/core/BitmapLabel.d.ts +36 -0
- package/dist/types/core/BitmapLabel.d.ts.map +1 -0
- package/dist/types/core/Camera.d.ts +115 -0
- package/dist/types/core/Camera.d.ts.map +1 -0
- package/dist/types/core/Clock.d.ts +23 -0
- package/dist/types/core/Clock.d.ts.map +1 -0
- package/dist/types/core/Graphics.d.ts +37 -0
- package/dist/types/core/Graphics.d.ts.map +1 -0
- package/dist/types/core/Group.d.ts +15 -0
- package/dist/types/core/Group.d.ts.map +1 -0
- package/dist/types/core/Image.d.ts +25 -0
- package/dist/types/core/Image.d.ts.map +1 -0
- package/dist/types/core/ObjectFactory.d.ts +34 -0
- package/dist/types/core/ObjectFactory.d.ts.map +1 -0
- package/dist/types/core/Pointer.d.ts +45 -0
- package/dist/types/core/Pointer.d.ts.map +1 -0
- package/dist/types/core/Rectangle.d.ts +26 -0
- package/dist/types/core/Rectangle.d.ts.map +1 -0
- package/dist/types/core/Stage.d.ts +58 -0
- package/dist/types/core/Stage.d.ts.map +1 -0
- package/dist/types/core/Text.d.ts +22 -0
- package/dist/types/core/Text.d.ts.map +1 -0
- package/dist/types/core/TextureRegistry.d.ts +90 -0
- package/dist/types/core/TextureRegistry.d.ts.map +1 -0
- package/dist/types/core/Timeline.d.ts +115 -0
- package/dist/types/core/Timeline.d.ts.map +1 -0
- package/dist/types/core/TimelineBuilder.d.ts +53 -0
- package/dist/types/core/TimelineBuilder.d.ts.map +1 -0
- package/dist/types/core/TimelineChild.d.ts +51 -0
- package/dist/types/core/TimelineChild.d.ts.map +1 -0
- package/dist/types/core/Tweener.d.ts +70 -0
- package/dist/types/core/Tweener.d.ts.map +1 -0
- package/dist/types/core/atlas.d.ts +16 -0
- package/dist/types/core/atlas.d.ts.map +1 -0
- package/dist/types/core/atlasPlan.d.ts +34 -0
- package/dist/types/core/atlasPlan.d.ts.map +1 -0
- package/dist/types/core/blendLayer.d.ts +23 -0
- package/dist/types/core/blendLayer.d.ts.map +1 -0
- package/dist/types/core/eases.d.ts +3 -0
- package/dist/types/core/eases.d.ts.map +1 -0
- package/dist/types/core/gameObject.d.ts +42 -0
- package/dist/types/core/gameObject.d.ts.map +1 -0
- package/dist/types/core/pixelZoom.d.ts +45 -0
- package/dist/types/core/pixelZoom.d.ts.map +1 -0
- package/dist/types/core/pixiPatches.d.ts +9 -0
- package/dist/types/core/pixiPatches.d.ts.map +1 -0
- package/dist/types/core/runDue.d.ts +15 -0
- package/dist/types/core/runDue.d.ts.map +1 -0
- package/dist/types/core/silhouette.d.ts +16 -0
- package/dist/types/core/silhouette.d.ts.map +1 -0
- package/dist/types/core/timelinePlace.d.ts +23 -0
- package/dist/types/core/timelinePlace.d.ts.map +1 -0
- package/dist/types/core/tweenProps.d.ts +8 -0
- package/dist/types/core/tweenProps.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +4 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/debug/DebugOverlay.d.ts +63 -0
- package/dist/types/debug/DebugOverlay.d.ts.map +1 -0
- package/dist/types/debug/DrawCallCounter.d.ts +20 -0
- package/dist/types/debug/DrawCallCounter.d.ts.map +1 -0
- package/dist/types/debug/ErrorLog.d.ts +20 -0
- package/dist/types/debug/ErrorLog.d.ts.map +1 -0
- package/dist/types/debug/FrameStats.d.ts +21 -0
- package/dist/types/debug/FrameStats.d.ts.map +1 -0
- package/dist/types/debug/inspectWorld.d.ts +14 -0
- package/dist/types/debug/inspectWorld.d.ts.map +1 -0
- package/dist/types/diagnostics/ErrorDeduper.d.ts +17 -0
- package/dist/types/diagnostics/ErrorDeduper.d.ts.map +1 -0
- package/dist/types/diagnostics/FrameSampler.d.ts +37 -0
- package/dist/types/diagnostics/FrameSampler.d.ts.map +1 -0
- package/dist/types/diagnostics/bootWatch.d.ts +25 -0
- package/dist/types/diagnostics/bootWatch.d.ts.map +1 -0
- package/dist/types/diagnostics/captureErrors.d.ts +24 -0
- package/dist/types/diagnostics/captureErrors.d.ts.map +1 -0
- package/dist/types/diagnostics/contextLoss.d.ts +35 -0
- package/dist/types/diagnostics/contextLoss.d.ts.map +1 -0
- package/dist/types/diagnostics/frameStats.d.ts +30 -0
- package/dist/types/diagnostics/frameStats.d.ts.map +1 -0
- package/dist/types/diagnostics/gpuInfo.d.ts +9 -0
- package/dist/types/diagnostics/gpuInfo.d.ts.map +1 -0
- package/dist/types/diagnostics/renderGuard.d.ts +12 -0
- package/dist/types/diagnostics/renderGuard.d.ts.map +1 -0
- package/dist/types/ecs/SparseSet.d.ts +25 -0
- package/dist/types/ecs/SparseSet.d.ts.map +1 -0
- package/dist/types/ecs/World.d.ts +137 -0
- package/dist/types/ecs/World.d.ts.map +1 -0
- package/dist/types/ecs/fields.d.ts +34 -0
- package/dist/types/ecs/fields.d.ts.map +1 -0
- package/dist/types/engine/Engine.d.ts +96 -0
- package/dist/types/engine/Engine.d.ts.map +1 -0
- package/dist/types/engine/FixedLoop.d.ts +32 -0
- package/dist/types/engine/FixedLoop.d.ts.map +1 -0
- package/dist/types/engine/HiddenPause.d.ts +22 -0
- package/dist/types/engine/HiddenPause.d.ts.map +1 -0
- package/dist/types/engine/Scene.d.ts +67 -0
- package/dist/types/engine/Scene.d.ts.map +1 -0
- package/dist/types/engine/SceneManager.d.ts +36 -0
- package/dist/types/engine/SceneManager.d.ts.map +1 -0
- package/dist/types/events/EventBus.d.ts +20 -0
- package/dist/types/events/EventBus.d.ts.map +1 -0
- package/dist/types/fx/Afterimages.d.ts +62 -0
- package/dist/types/fx/Afterimages.d.ts.map +1 -0
- package/dist/types/fx/FloatingText.d.ts +71 -0
- package/dist/types/fx/FloatingText.d.ts.map +1 -0
- package/dist/types/fx/hitStop.d.ts +20 -0
- package/dist/types/fx/hitStop.d.ts.map +1 -0
- package/dist/types/fx/viewCull.d.ts +14 -0
- package/dist/types/fx/viewCull.d.ts.map +1 -0
- package/dist/types/i18n/Translator.d.ts +52 -0
- package/dist/types/i18n/Translator.d.ts.map +1 -0
- package/dist/types/i18n/extractStrings.d.ts +25 -0
- package/dist/types/i18n/extractStrings.d.ts.map +1 -0
- package/dist/types/i18n/formatMessage.d.ts +10 -0
- package/dist/types/i18n/formatMessage.d.ts.map +1 -0
- package/dist/types/index.d.ts +164 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/input/Actions.d.ts +100 -0
- package/dist/types/input/Actions.d.ts.map +1 -0
- package/dist/types/input/AimGesture.d.ts +106 -0
- package/dist/types/input/AimGesture.d.ts.map +1 -0
- package/dist/types/input/Keyboard.d.ts +30 -0
- package/dist/types/input/Keyboard.d.ts.map +1 -0
- package/dist/types/input/Keymap.d.ts +85 -0
- package/dist/types/input/Keymap.d.ts.map +1 -0
- package/dist/types/input/TargetLock.d.ts +56 -0
- package/dist/types/input/TargetLock.d.ts.map +1 -0
- package/dist/types/input/aimAxis.d.ts +9 -0
- package/dist/types/input/aimAxis.d.ts.map +1 -0
- package/dist/types/input/keyChord.d.ts +15 -0
- package/dist/types/input/keyChord.d.ts.map +1 -0
- package/dist/types/input/longPress.d.ts +21 -0
- package/dist/types/input/longPress.d.ts.map +1 -0
- package/dist/types/input/rumble.d.ts +41 -0
- package/dist/types/input/rumble.d.ts.map +1 -0
- package/dist/types/input/stickAxis.d.ts +26 -0
- package/dist/types/input/stickAxis.d.ts.map +1 -0
- package/dist/types/input/touchDetect.d.ts +18 -0
- package/dist/types/input/touchDetect.d.ts.map +1 -0
- package/dist/types/light/LightLayer.d.ts +65 -0
- package/dist/types/light/LightLayer.d.ts.map +1 -0
- package/dist/types/nav/MinHeap.d.ts +15 -0
- package/dist/types/nav/MinHeap.d.ts.map +1 -0
- package/dist/types/nav/findPath.d.ts +38 -0
- package/dist/types/nav/findPath.d.ts.map +1 -0
- package/dist/types/nav/navGrid.d.ts +48 -0
- package/dist/types/nav/navGrid.d.ts.map +1 -0
- package/dist/types/nav/nearestOpen.d.ts +8 -0
- package/dist/types/nav/nearestOpen.d.ts.map +1 -0
- package/dist/types/nav/straightenPath.d.ts +13 -0
- package/dist/types/nav/straightenPath.d.ts.map +1 -0
- package/dist/types/net/Connection.d.ts +88 -0
- package/dist/types/net/Connection.d.ts.map +1 -0
- package/dist/types/net/InterpolationBuffer.d.ts +36 -0
- package/dist/types/net/InterpolationBuffer.d.ts.map +1 -0
- package/dist/types/net/PredictedMover.d.ts +43 -0
- package/dist/types/net/PredictedMover.d.ts.map +1 -0
- package/dist/types/net/Room.d.ts +69 -0
- package/dist/types/net/Room.d.ts.map +1 -0
- package/dist/types/net/RoomHost.d.ts +74 -0
- package/dist/types/net/RoomHost.d.ts.map +1 -0
- package/dist/types/net/cadence.d.ts +22 -0
- package/dist/types/net/cadence.d.ts.map +1 -0
- package/dist/types/net/constants.d.ts +33 -0
- package/dist/types/net/constants.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyClient.d.ts +107 -0
- package/dist/types/net/lobby/LobbyClient.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyHost.d.ts +147 -0
- package/dist/types/net/lobby/LobbyHost.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyRooms.d.ts +56 -0
- package/dist/types/net/lobby/LobbyRooms.d.ts.map +1 -0
- package/dist/types/net/lobby/Matchmaker.d.ts +57 -0
- package/dist/types/net/lobby/Matchmaker.d.ts.map +1 -0
- package/dist/types/net/lobby/index.d.ts +6 -0
- package/dist/types/net/lobby/index.d.ts.map +1 -0
- package/dist/types/net/lobby/lobbyProtocol.d.ts +143 -0
- package/dist/types/net/lobby/lobbyProtocol.d.ts.map +1 -0
- package/dist/types/net/movement.d.ts +50 -0
- package/dist/types/net/movement.d.ts.map +1 -0
- package/dist/types/net/protocol.d.ts +59 -0
- package/dist/types/net/protocol.d.ts.map +1 -0
- package/dist/types/net/reconnect.d.ts +14 -0
- package/dist/types/net/reconnect.d.ts.map +1 -0
- package/dist/types/net/serverClock.d.ts +14 -0
- package/dist/types/net/serverClock.d.ts.map +1 -0
- package/dist/types/net/snapshotCodec.d.ts +55 -0
- package/dist/types/net/snapshotCodec.d.ts.map +1 -0
- package/dist/types/parallax/Parallax.d.ts +37 -0
- package/dist/types/parallax/Parallax.d.ts.map +1 -0
- package/dist/types/parallax/ParallaxLayer.d.ts +80 -0
- package/dist/types/parallax/ParallaxLayer.d.ts.map +1 -0
- package/dist/types/parallax/parallaxMath.d.ts +50 -0
- package/dist/types/parallax/parallaxMath.d.ts.map +1 -0
- package/dist/types/particles/Emitter.d.ts +97 -0
- package/dist/types/particles/Emitter.d.ts.map +1 -0
- package/dist/types/particles/ParticleBudget.d.ts +28 -0
- package/dist/types/particles/ParticleBudget.d.ts.map +1 -0
- package/dist/types/particles/ParticleSim.d.ts +38 -0
- package/dist/types/particles/ParticleSim.d.ts.map +1 -0
- package/dist/types/particles/particleCurves.d.ts +21 -0
- package/dist/types/particles/particleCurves.d.ts.map +1 -0
- package/dist/types/particles/particleSampling.d.ts +20 -0
- package/dist/types/particles/particleSampling.d.ts.map +1 -0
- package/dist/types/physics/Body.d.ts +130 -0
- package/dist/types/physics/Body.d.ts.map +1 -0
- package/dist/types/physics/BroadPhase.d.ts +26 -0
- package/dist/types/physics/BroadPhase.d.ts.map +1 -0
- package/dist/types/physics/Contact.d.ts +62 -0
- package/dist/types/physics/Contact.d.ts.map +1 -0
- package/dist/types/physics/ContactSolver.d.ts +29 -0
- package/dist/types/physics/ContactSolver.d.ts.map +1 -0
- package/dist/types/physics/PhysicsWorld.d.ts +78 -0
- package/dist/types/physics/PhysicsWorld.d.ts.map +1 -0
- package/dist/types/physics/PhysicsWorldOptions.d.ts +24 -0
- package/dist/types/physics/PhysicsWorldOptions.d.ts.map +1 -0
- package/dist/types/physics/SpatialHash.d.ts +23 -0
- package/dist/types/physics/SpatialHash.d.ts.map +1 -0
- package/dist/types/physics/collide.d.ts +27 -0
- package/dist/types/physics/collide.d.ts.map +1 -0
- package/dist/types/physics/collidePolygon.d.ts +14 -0
- package/dist/types/physics/collidePolygon.d.ts.map +1 -0
- package/dist/types/physics/contactReport.d.ts +8 -0
- package/dist/types/physics/contactReport.d.ts.map +1 -0
- package/dist/types/physics/drawColliders.d.ts +43 -0
- package/dist/types/physics/drawColliders.d.ts.map +1 -0
- package/dist/types/physics/physicsSystem.d.ts +5 -0
- package/dist/types/physics/physicsSystem.d.ts.map +1 -0
- package/dist/types/physics/polygon.d.ts +28 -0
- package/dist/types/physics/polygon.d.ts.map +1 -0
- package/dist/types/physics/raycast.d.ts +19 -0
- package/dist/types/physics/raycast.d.ts.map +1 -0
- package/dist/types/physics/syncToBody.d.ts +16 -0
- package/dist/types/physics/syncToBody.d.ts.map +1 -0
- package/dist/types/physics/tileBodies.d.ts +36 -0
- package/dist/types/physics/tileBodies.d.ts.map +1 -0
- package/dist/types/physics/types.d.ts +116 -0
- package/dist/types/physics/types.d.ts.map +1 -0
- package/dist/types/pixel/Darkness.d.ts +90 -0
- package/dist/types/pixel/Darkness.d.ts.map +1 -0
- package/dist/types/pixel/DitherVignette.d.ts +35 -0
- package/dist/types/pixel/DitherVignette.d.ts.map +1 -0
- package/dist/types/pixel/Evaporation.d.ts +30 -0
- package/dist/types/pixel/Evaporation.d.ts.map +1 -0
- package/dist/types/pixel/NightShade.d.ts +38 -0
- package/dist/types/pixel/NightShade.d.ts.map +1 -0
- package/dist/types/pixel/PixelLayer.d.ts +85 -0
- package/dist/types/pixel/PixelLayer.d.ts.map +1 -0
- package/dist/types/pixel/PixelMarks.d.ts +68 -0
- package/dist/types/pixel/PixelMarks.d.ts.map +1 -0
- package/dist/types/pixel/SwayProp.d.ts +52 -0
- package/dist/types/pixel/SwayProp.d.ts.map +1 -0
- package/dist/types/pixel/aimPixels.d.ts +23 -0
- package/dist/types/pixel/aimPixels.d.ts.map +1 -0
- package/dist/types/pixel/index.d.ts +33 -0
- package/dist/types/pixel/index.d.ts.map +1 -0
- package/dist/types/pixel/lights.d.ts +34 -0
- package/dist/types/pixel/lights.d.ts.map +1 -0
- package/dist/types/pixel/nineSlice.d.ts +71 -0
- package/dist/types/pixel/nineSlice.d.ts.map +1 -0
- package/dist/types/pixel/paintLayer.d.ts +35 -0
- package/dist/types/pixel/paintLayer.d.ts.map +1 -0
- package/dist/types/pixel/palette.d.ts +58 -0
- package/dist/types/pixel/palette.d.ts.map +1 -0
- package/dist/types/pixel/pixel.d.ts +80 -0
- package/dist/types/pixel/pixel.d.ts.map +1 -0
- package/dist/types/pixel/pixelPaint.d.ts +44 -0
- package/dist/types/pixel/pixelPaint.d.ts.map +1 -0
- package/dist/types/pixel/pixelParticles.d.ts +21 -0
- package/dist/types/pixel/pixelParticles.d.ts.map +1 -0
- package/dist/types/pixel/pixelTone.d.ts +51 -0
- package/dist/types/pixel/pixelTone.d.ts.map +1 -0
- package/dist/types/pixel/propKit.d.ts +26 -0
- package/dist/types/pixel/propKit.d.ts.map +1 -0
- package/dist/types/pixel/ramp.d.ts +57 -0
- package/dist/types/pixel/ramp.d.ts.map +1 -0
- package/dist/types/pixel/selout.d.ts +3 -0
- package/dist/types/pixel/selout.d.ts.map +1 -0
- package/dist/types/pixel/spritePixels.d.ts +29 -0
- package/dist/types/pixel/spritePixels.d.ts.map +1 -0
- package/dist/types/pixel/swayRig.d.ts +72 -0
- package/dist/types/pixel/swayRig.d.ts.map +1 -0
- package/dist/types/pixel/vignetteMask.d.ts +16 -0
- package/dist/types/pixel/vignetteMask.d.ts.map +1 -0
- package/dist/types/pixel/weatherArt.d.ts +29 -0
- package/dist/types/pixel/weatherArt.d.ts.map +1 -0
- package/dist/types/platform/appResume.d.ts +25 -0
- package/dist/types/platform/appResume.d.ts.map +1 -0
- package/dist/types/platform/fullscreen.d.ts +37 -0
- package/dist/types/platform/fullscreen.d.ts.map +1 -0
- package/dist/types/platform/orientation.d.ts +19 -0
- package/dist/types/platform/orientation.d.ts.map +1 -0
- package/dist/types/platform/pointerLock.d.ts +26 -0
- package/dist/types/platform/pointerLock.d.ts.map +1 -0
- package/dist/types/platform/reducedMotion.d.ts +20 -0
- package/dist/types/platform/reducedMotion.d.ts.map +1 -0
- package/dist/types/platform/timeoutSignal.d.ts +6 -0
- package/dist/types/platform/timeoutSignal.d.ts.map +1 -0
- package/dist/types/platform/touch.d.ts +10 -0
- package/dist/types/platform/touch.d.ts.map +1 -0
- package/dist/types/postfx/BloomFilter.d.ts +33 -0
- package/dist/types/postfx/BloomFilter.d.ts.map +1 -0
- package/dist/types/postfx/ChromaticAberrationFilter.d.ts +11 -0
- package/dist/types/postfx/ChromaticAberrationFilter.d.ts.map +1 -0
- package/dist/types/postfx/ColorAdjustFilter.d.ts +32 -0
- package/dist/types/postfx/ColorAdjustFilter.d.ts.map +1 -0
- package/dist/types/postfx/CrtFilter.d.ts +16 -0
- package/dist/types/postfx/CrtFilter.d.ts.map +1 -0
- package/dist/types/postfx/PixelateFilter.d.ts +8 -0
- package/dist/types/postfx/PixelateFilter.d.ts.map +1 -0
- package/dist/types/postfx/PostFx.d.ts +92 -0
- package/dist/types/postfx/PostFx.d.ts.map +1 -0
- package/dist/types/postfx/ShockwaveFilter.d.ts +20 -0
- package/dist/types/postfx/ShockwaveFilter.d.ts.map +1 -0
- package/dist/types/postfx/VignetteFilter.d.ts +19 -0
- package/dist/types/postfx/VignetteFilter.d.ts.map +1 -0
- package/dist/types/postfx/fxAnimator.d.ts +32 -0
- package/dist/types/postfx/fxAnimator.d.ts.map +1 -0
- package/dist/types/postfx/fxShader.d.ts +49 -0
- package/dist/types/postfx/fxShader.d.ts.map +1 -0
- package/dist/types/postfx/index.d.ts +11 -0
- package/dist/types/postfx/index.d.ts.map +1 -0
- package/dist/types/react/ChoiceDialog.d.ts +8 -0
- package/dist/types/react/ChoiceDialog.d.ts.map +1 -0
- package/dist/types/react/ConfirmDialog.d.ts +9 -0
- package/dist/types/react/ConfirmDialog.d.ts.map +1 -0
- package/dist/types/react/Glyph.d.ts +54 -0
- package/dist/types/react/Glyph.d.ts.map +1 -0
- package/dist/types/react/Modal.d.ts +22 -0
- package/dist/types/react/Modal.d.ts.map +1 -0
- package/dist/types/react/Panel.d.ts +29 -0
- package/dist/types/react/Panel.d.ts.map +1 -0
- package/dist/types/react/PixelImage.d.ts +19 -0
- package/dist/types/react/PixelImage.d.ts.map +1 -0
- package/dist/types/react/Select.d.ts +27 -0
- package/dist/types/react/Select.d.ts.map +1 -0
- package/dist/types/react/Slider.d.ts +24 -0
- package/dist/types/react/Slider.d.ts.map +1 -0
- package/dist/types/react/SplitPane.d.ts +26 -0
- package/dist/types/react/SplitPane.d.ts.map +1 -0
- package/dist/types/react/TabStrip.d.ts +31 -0
- package/dist/types/react/TabStrip.d.ts.map +1 -0
- package/dist/types/react/TitleTips.d.ts +15 -0
- package/dist/types/react/TitleTips.d.ts.map +1 -0
- package/dist/types/react/Tooltip.d.ts +22 -0
- package/dist/types/react/Tooltip.d.ts.map +1 -0
- package/dist/types/react/UiProvider.d.ts +52 -0
- package/dist/types/react/UiProvider.d.ts.map +1 -0
- package/dist/types/react/baseCss.d.ts +27 -0
- package/dist/types/react/baseCss.d.ts.map +1 -0
- package/dist/types/react/choiceStore.d.ts +34 -0
- package/dist/types/react/choiceStore.d.ts.map +1 -0
- package/dist/types/react/classNames.d.ts +12 -0
- package/dist/types/react/classNames.d.ts.map +1 -0
- package/dist/types/react/confirmStore.d.ts +30 -0
- package/dist/types/react/confirmStore.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +33 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/react/labels.d.ts +24 -0
- package/dist/types/react/labels.d.ts.map +1 -0
- package/dist/types/react/placement.d.ts +59 -0
- package/dist/types/react/placement.d.ts.map +1 -0
- package/dist/types/react/useFillSheet.d.ts +9 -0
- package/dist/types/react/useFillSheet.d.ts.map +1 -0
- package/dist/types/react/useFitToViewport.d.ts +20 -0
- package/dist/types/react/useFitToViewport.d.ts.map +1 -0
- package/dist/types/react/usePicked.d.ts +9 -0
- package/dist/types/react/usePicked.d.ts.map +1 -0
- package/dist/types/react/useStore.d.ts +8 -0
- package/dist/types/react/useStore.d.ts.map +1 -0
- package/dist/types/react/useViewport.d.ts +4 -0
- package/dist/types/react/useViewport.d.ts.map +1 -0
- package/dist/types/rig/PosePlayer.d.ts +64 -0
- package/dist/types/rig/PosePlayer.d.ts.map +1 -0
- package/dist/types/rig/RigView.d.ts +68 -0
- package/dist/types/rig/RigView.d.ts.map +1 -0
- package/dist/types/rig/Skeleton.d.ts +14 -0
- package/dist/types/rig/Skeleton.d.ts.map +1 -0
- package/dist/types/rig/humanoid.d.ts +4 -0
- package/dist/types/rig/humanoid.d.ts.map +1 -0
- package/dist/types/rig/humanoidPoses.d.ts +117 -0
- package/dist/types/rig/humanoidPoses.d.ts.map +1 -0
- package/dist/types/rig/poseMath.d.ts +14 -0
- package/dist/types/rig/poseMath.d.ts.map +1 -0
- package/dist/types/rig/rigTypes.d.ts +82 -0
- package/dist/types/rig/rigTypes.d.ts.map +1 -0
- package/dist/types/save/Autosaver.d.ts +43 -0
- package/dist/types/save/Autosaver.d.ts.map +1 -0
- package/dist/types/save/MemoryBackend.d.ts +10 -0
- package/dist/types/save/MemoryBackend.d.ts.map +1 -0
- package/dist/types/save/SaveBackend.d.ts +14 -0
- package/dist/types/save/SaveBackend.d.ts.map +1 -0
- package/dist/types/save/SaveStore.d.ts +73 -0
- package/dist/types/save/SaveStore.d.ts.map +1 -0
- package/dist/types/save/WebStorageBackend.d.ts +14 -0
- package/dist/types/save/WebStorageBackend.d.ts.map +1 -0
- package/dist/types/save/checksum.d.ts +7 -0
- package/dist/types/save/checksum.d.ts.map +1 -0
- package/dist/types/save/migrateSave.d.ts +17 -0
- package/dist/types/save/migrateSave.d.ts.map +1 -0
- package/dist/types/settings.d.ts +25 -0
- package/dist/types/settings.d.ts.map +1 -0
- package/dist/types/tilemap/TilemapView.d.ts +42 -0
- package/dist/types/tilemap/TilemapView.d.ts.map +1 -0
- package/dist/types/tilemap/collision.d.ts +16 -0
- package/dist/types/tilemap/collision.d.ts.map +1 -0
- package/dist/types/tilemap/tiled.d.ts +104 -0
- package/dist/types/tilemap/tiled.d.ts.map +1 -0
- package/dist/types/transitions/CrossfadeTransition.d.ts +20 -0
- package/dist/types/transitions/CrossfadeTransition.d.ts.map +1 -0
- package/dist/types/transitions/DitherWipeTransition.d.ts +35 -0
- package/dist/types/transitions/DitherWipeTransition.d.ts.map +1 -0
- package/dist/types/transitions/FadeTransition.d.ts +20 -0
- package/dist/types/transitions/FadeTransition.d.ts.map +1 -0
- package/dist/types/transitions/Letterbox.d.ts +33 -0
- package/dist/types/transitions/Letterbox.d.ts.map +1 -0
- package/dist/types/transitions/Transition.d.ts +22 -0
- package/dist/types/transitions/Transition.d.ts.map +1 -0
- package/dist/types/transitions/ditherMask.d.ts +13 -0
- package/dist/types/transitions/ditherMask.d.ts.map +1 -0
- package/dist/types/transitions/transitionTo.d.ts +16 -0
- package/dist/types/transitions/transitionTo.d.ts.map +1 -0
- package/dist/types/transitions/tweenDone.d.ts +5 -0
- package/dist/types/transitions/tweenDone.d.ts.map +1 -0
- package/dist/types/ui/Bar.d.ts +41 -0
- package/dist/types/ui/Bar.d.ts.map +1 -0
- package/dist/types/ui/Button.d.ts +47 -0
- package/dist/types/ui/Button.d.ts.map +1 -0
- package/dist/types/ui/Dialog.d.ts +47 -0
- package/dist/types/ui/Dialog.d.ts.map +1 -0
- package/dist/types/ui/FocusManager.d.ts +53 -0
- package/dist/types/ui/FocusManager.d.ts.map +1 -0
- package/dist/types/ui/Label.d.ts +24 -0
- package/dist/types/ui/Label.d.ts.map +1 -0
- package/dist/types/ui/List.d.ts +23 -0
- package/dist/types/ui/List.d.ts.map +1 -0
- package/dist/types/ui/Panel.d.ts +38 -0
- package/dist/types/ui/Panel.d.ts.map +1 -0
- package/dist/types/ui/ScrollView.d.ts +56 -0
- package/dist/types/ui/ScrollView.d.ts.map +1 -0
- package/dist/types/ui/Slider.d.ts +47 -0
- package/dist/types/ui/Slider.d.ts.map +1 -0
- package/dist/types/ui/Stack.d.ts +16 -0
- package/dist/types/ui/Stack.d.ts.map +1 -0
- package/dist/types/ui/Toggle.d.ts +31 -0
- package/dist/types/ui/Toggle.d.ts.map +1 -0
- package/dist/types/ui/UiHost.d.ts +18 -0
- package/dist/types/ui/UiHost.d.ts.map +1 -0
- package/dist/types/ui/UiPointerGate.d.ts +17 -0
- package/dist/types/ui/UiPointerGate.d.ts.map +1 -0
- package/dist/types/ui/UiRoot.d.ts +73 -0
- package/dist/types/ui/UiRoot.d.ts.map +1 -0
- package/dist/types/ui/Widget.d.ts +56 -0
- package/dist/types/ui/Widget.d.ts.map +1 -0
- package/dist/types/ui/dom/DomOverlay.d.ts +52 -0
- package/dist/types/ui/dom/DomOverlay.d.ts.map +1 -0
- package/dist/types/ui/dom/DomWorldAnchors.d.ts +50 -0
- package/dist/types/ui/dom/DomWorldAnchors.d.ts.map +1 -0
- package/dist/types/ui/dom/InputShield.d.ts +20 -0
- package/dist/types/ui/dom/InputShield.d.ts.map +1 -0
- package/dist/types/ui/dom/createStore.d.ts +22 -0
- package/dist/types/ui/dom/createStore.d.ts.map +1 -0
- package/dist/types/ui/dom/shieldDecision.d.ts +34 -0
- package/dist/types/ui/dom/shieldDecision.d.ts.map +1 -0
- package/dist/types/ui/dom/worldToScreen.d.ts +24 -0
- package/dist/types/ui/dom/worldToScreen.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +42 -0
- package/dist/types/ui/index.d.ts.map +1 -0
- package/dist/types/ui/layout/anchor.d.ts +9 -0
- package/dist/types/ui/layout/anchor.d.ts.map +1 -0
- package/dist/types/ui/layout/barDrain.d.ts +25 -0
- package/dist/types/ui/layout/barDrain.d.ts.map +1 -0
- package/dist/types/ui/layout/fitToViewport.d.ts +32 -0
- package/dist/types/ui/layout/fitToViewport.d.ts.map +1 -0
- package/dist/types/ui/layout/focusNav.d.ts +13 -0
- package/dist/types/ui/layout/focusNav.d.ts.map +1 -0
- package/dist/types/ui/layout/geometry.d.ts +35 -0
- package/dist/types/ui/layout/geometry.d.ts.map +1 -0
- package/dist/types/ui/layout/listWidth.d.ts +13 -0
- package/dist/types/ui/layout/listWidth.d.ts.map +1 -0
- package/dist/types/ui/layout/placeTooltip.d.ts +23 -0
- package/dist/types/ui/layout/placeTooltip.d.ts.map +1 -0
- package/dist/types/ui/layout/scroll.d.ts +17 -0
- package/dist/types/ui/layout/scroll.d.ts.map +1 -0
- package/dist/types/ui/layout/slider.d.ts +7 -0
- package/dist/types/ui/layout/slider.d.ts.map +1 -0
- package/dist/types/ui/layout/stack.d.ts +26 -0
- package/dist/types/ui/layout/stack.d.ts.map +1 -0
- package/dist/types/ui/layout/wrapRow.d.ts +6 -0
- package/dist/types/ui/layout/wrapRow.d.ts.map +1 -0
- package/dist/types/ui/rich/RichText.d.ts +48 -0
- package/dist/types/ui/rich/RichText.d.ts.map +1 -0
- package/dist/types/ui/rich/richFonts.d.ts +70 -0
- package/dist/types/ui/rich/richFonts.d.ts.map +1 -0
- package/dist/types/ui/rich/richLayout.d.ts +76 -0
- package/dist/types/ui/rich/richLayout.d.ts.map +1 -0
- package/dist/types/ui/rich/richMarkup.d.ts +48 -0
- package/dist/types/ui/rich/richMarkup.d.ts.map +1 -0
- package/dist/ui/Bar.js +53 -0
- package/dist/ui/Button.js +57 -0
- package/dist/ui/Dialog.js +55 -0
- package/dist/ui/FocusManager.js +96 -0
- package/dist/ui/Label.js +35 -0
- package/dist/ui/List.js +44 -0
- package/dist/ui/Panel.js +37 -0
- package/dist/ui/ScrollView.js +95 -0
- package/dist/ui/Slider.js +54 -0
- package/dist/ui/Stack.js +27 -0
- package/dist/ui/Toggle.js +36 -0
- package/dist/ui/UiHost.js +8 -0
- package/dist/ui/UiPointerGate.js +24 -0
- package/dist/ui/UiRoot.js +92 -0
- package/dist/ui/Widget.js +89 -0
- package/dist/ui/dom/DomOverlay.js +58 -0
- package/dist/ui/dom/DomWorldAnchors.js +58 -0
- package/dist/ui/dom/InputShield.js +26 -0
- package/dist/ui/dom/createStore.js +41 -0
- package/dist/ui/dom/shieldDecision.js +35 -0
- package/dist/ui/dom/worldToScreen.js +10 -0
- package/dist/ui/layout/anchor.js +19 -0
- package/dist/ui/layout/barDrain.js +24 -0
- package/dist/ui/layout/fitToViewport.js +16 -0
- package/dist/ui/layout/focusNav.js +41 -0
- package/dist/ui/layout/geometry.js +20 -0
- package/dist/ui/layout/listWidth.js +9 -0
- package/dist/ui/layout/placeTooltip.js +27 -0
- package/dist/ui/layout/scroll.js +23 -0
- package/dist/ui/layout/slider.js +19 -0
- package/dist/ui/layout/stack.js +26 -0
- package/dist/ui/layout/wrapRow.js +12 -0
- package/dist/ui/rich/RichText.js +87 -0
- package/dist/ui/rich/richFonts.js +105 -0
- package/dist/ui/rich/richLayout.js +132 -0
- package/dist/ui/rich/richMarkup.js +67 -0
- package/dist/ui.js +95 -0
- package/package.json +112 -4
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One component type's storage: a sparse set. `sparse[index]` is where the entity's value sits in the dense arrays
|
|
3
|
+
* (or -1), and `entities`/`values` are packed with no holes, so walking a component is a walk over two flat arrays
|
|
4
|
+
* and finding one is two array reads. Removing swaps the last entry into the hole.
|
|
5
|
+
*
|
|
6
|
+
* Indexed by the entity's slot index (`entityIndex`), not the whole id: the generation is checked by the world.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SparseSet<T> {
|
|
9
|
+
private sparse;
|
|
10
|
+
/** Packed entity ids, in the same order as `values`. */
|
|
11
|
+
readonly entities: number[];
|
|
12
|
+
readonly values: T[];
|
|
13
|
+
/** Bumped whenever an entity joins or leaves the set (not when a value changes): query caches key on it. */
|
|
14
|
+
version: number;
|
|
15
|
+
get size(): number;
|
|
16
|
+
has(index: number): boolean;
|
|
17
|
+
/** The value at slot `index`, or undefined. */
|
|
18
|
+
get(index: number): T | undefined;
|
|
19
|
+
set(index: number, entity: number, value: T): void;
|
|
20
|
+
/** Removes slot `index`; true if it was there. */
|
|
21
|
+
delete(index: number, indexOf: (entity: number) => number): boolean;
|
|
22
|
+
clear(): void;
|
|
23
|
+
private grow;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=SparseSet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparseSet.d.ts","sourceRoot":"","sources":["../../../src/ecs/SparseSet.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qBAAa,SAAS,CAAC,CAAC;IACtB,OAAO,CAAC,MAAM,CAA2C;IACzD,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAM;IACjC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,CAAM;IAC1B,4GAA4G;IAC5G,OAAO,SAAK;IAEZ,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAI3B,+CAA+C;IAC/C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAMjC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAclD,kDAAkD;IAClD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO;IAkBnE,KAAK,IAAI,IAAI;IAOb,OAAO,CAAC,IAAI;CAQb"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type Columns, type FieldSpec, type FieldValues, type FieldsType } from './fields.js';
|
|
2
|
+
/**
|
|
3
|
+
* An entity–component–system store. Entities are numbers; components are data kept in one sparse set per component
|
|
4
|
+
* type; systems are functions run in the order they were added, each in a phase:
|
|
5
|
+
*
|
|
6
|
+
* - `fixed` runs once per simulation step (`FixedLoop`), for movement and rules;
|
|
7
|
+
* - `frame` runs once per rendered frame, for drawing and anything purely visual.
|
|
8
|
+
*
|
|
9
|
+
* Storage is a sparse set per component (packed arrays, O(1) lookups), the layout fast ECS libraries use. For hot
|
|
10
|
+
* loops prefer `each` (a callback, no allocation per entity) over `query` (an iterator yielding a fresh row).
|
|
11
|
+
*
|
|
12
|
+
* Entity ids are recycled: an id carries its slot index and a generation, so an id kept after its entity was
|
|
13
|
+
* destroyed never matches the entity that later reuses the slot.
|
|
14
|
+
*
|
|
15
|
+
* Changing structure while walking: adding components is always safe (new entries are not visited this walk).
|
|
16
|
+
* Removing a component or destroying an entity while a `query`, an `each` or a system run is in progress is deferred
|
|
17
|
+
* until it ends, so nothing is skipped or visited twice.
|
|
18
|
+
*/
|
|
19
|
+
export type Entity = number;
|
|
20
|
+
/** A component type: a typed key. Make one per kind of data with `defineComponent`. */
|
|
21
|
+
export interface ComponentType<T> {
|
|
22
|
+
readonly id: number;
|
|
23
|
+
readonly name: string;
|
|
24
|
+
/** Phantom field carrying `T`; never set. */
|
|
25
|
+
readonly __type?: T;
|
|
26
|
+
}
|
|
27
|
+
export declare function defineComponent<T>(name: string): ComponentType<T>;
|
|
28
|
+
/** A component of numeric fields kept in typed-array columns (`fields.ts`): the fast form for data every body has. */
|
|
29
|
+
export declare function defineFields<const S extends FieldSpec>(name: string, fields: S): FieldsType<S>;
|
|
30
|
+
export type SystemPhase = 'fixed' | 'frame';
|
|
31
|
+
export interface SystemContext {
|
|
32
|
+
world: World;
|
|
33
|
+
/** Seconds this run covers: one step in `fixed`, the frame's length in `frame`. */
|
|
34
|
+
dt: number;
|
|
35
|
+
/** `performance.now()` of the frame. */
|
|
36
|
+
now: number;
|
|
37
|
+
/** In `frame`: the share of a step since the last fixed step (0–1), for interpolation. 0 in `fixed`. */
|
|
38
|
+
alpha: number;
|
|
39
|
+
}
|
|
40
|
+
export interface System {
|
|
41
|
+
readonly name: string;
|
|
42
|
+
readonly phase: SystemPhase;
|
|
43
|
+
run(ctx: SystemContext): void;
|
|
44
|
+
/** Called when the system is taken out of its world (or the world is cleared). */
|
|
45
|
+
dispose?(): void;
|
|
46
|
+
}
|
|
47
|
+
/** A system from a function. */
|
|
48
|
+
export declare function system(name: string, phase: SystemPhase, run: (ctx: SystemContext) => void): System;
|
|
49
|
+
export type ComponentValues<T extends readonly ComponentType<unknown>[]> = {
|
|
50
|
+
[K in keyof T]: T[K] extends ComponentType<infer V> ? V : never;
|
|
51
|
+
};
|
|
52
|
+
/** The slot an entity id sits in. */
|
|
53
|
+
export declare const entityIndex: (e: Entity) => number;
|
|
54
|
+
export declare class World {
|
|
55
|
+
/** Current generation per slot; an id is alive when its generation matches and the slot is in use. */
|
|
56
|
+
private generations;
|
|
57
|
+
private readonly inUse;
|
|
58
|
+
private readonly free;
|
|
59
|
+
private live;
|
|
60
|
+
private readonly stores;
|
|
61
|
+
/** Typed-array columns of the field components, by component id. */
|
|
62
|
+
private readonly cols;
|
|
63
|
+
private readonly systems;
|
|
64
|
+
private readonly pending;
|
|
65
|
+
/** `slots` results by the component ids asked for, rebuilt only when one of those sets changed membership. */
|
|
66
|
+
private readonly slotCache;
|
|
67
|
+
/** Walks (`query`, `each`, system runs) in progress: structure changes wait until it is 0. */
|
|
68
|
+
private walking;
|
|
69
|
+
/** A new entity with no components. */
|
|
70
|
+
create(): Entity;
|
|
71
|
+
/** A new entity with these components. */
|
|
72
|
+
spawn(...components: [ComponentType<unknown>, unknown][]): Entity;
|
|
73
|
+
isAlive(e: Entity): boolean;
|
|
74
|
+
/** Every live entity, for tools (a debugger, a save); allocates, so not for a per-frame path. */
|
|
75
|
+
entities(): Entity[];
|
|
76
|
+
/** The component types `e` holds, for tools; allocates. */
|
|
77
|
+
componentsOf(e: Entity): ComponentType<unknown>[];
|
|
78
|
+
/** Live entities. */
|
|
79
|
+
get size(): number;
|
|
80
|
+
/** Removes an entity and every component it had (deferred while a walk is in progress). */
|
|
81
|
+
destroy(e: Entity): void;
|
|
82
|
+
/** Gives an entity a field component; fields left out start at 0. Returns the slot index into its columns. */
|
|
83
|
+
add<S extends FieldSpec>(e: Entity, type: FieldsType<S>, values?: FieldValues<S>): number;
|
|
84
|
+
add<T>(e: Entity, type: ComponentType<T>, value: T): T;
|
|
85
|
+
/**
|
|
86
|
+
* The typed-array columns of a field component, indexed by slot. Fetch them per system run: adding entities may
|
|
87
|
+
* grow them into new arrays.
|
|
88
|
+
*/
|
|
89
|
+
columns<S extends FieldSpec>(type: FieldsType<S>): Columns<S>;
|
|
90
|
+
get<T>(e: Entity, type: ComponentType<T>): T | undefined;
|
|
91
|
+
/** The component, or an error naming what is missing: for code that knows the entity has it. */
|
|
92
|
+
require<T>(e: Entity, type: ComponentType<T>): T;
|
|
93
|
+
has(e: Entity, type: ComponentType<unknown>): boolean;
|
|
94
|
+
/** Takes one component off an entity (deferred while a walk is in progress). */
|
|
95
|
+
remove(e: Entity, type: ComponentType<unknown>): void;
|
|
96
|
+
/** How many entities hold `type`. */
|
|
97
|
+
count(type: ComponentType<unknown>): number;
|
|
98
|
+
/**
|
|
99
|
+
* Calls `fn(entity, ...components)` for every live entity holding all of `types`. Allocates nothing per entity:
|
|
100
|
+
* the form for systems that walk thousands of bodies every step.
|
|
101
|
+
*/
|
|
102
|
+
each<const T extends readonly ComponentType<unknown>[]>(...args: [...types: T, fn: (e: Entity, ...values: ComponentValues<T>) => void]): void;
|
|
103
|
+
/**
|
|
104
|
+
* The slot index of every entity holding all of `types`, as a typed array: the fastest walk there is, made for
|
|
105
|
+
* field components (`defineFields`), whose columns are indexed by slot.
|
|
106
|
+
*
|
|
107
|
+
* ```ts
|
|
108
|
+
* const p = world.columns(Position), v = world.columns(Velocity);
|
|
109
|
+
* const slots = world.slots(Position, Velocity);
|
|
110
|
+
* for (let k = 0; k < slots.length; k++) { const i = slots[k]!; p.x[i]! += v.x[i]! * dt; }
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* The result is cached and rebuilt only when an entity joins or leaves one of those components, so asking every
|
|
114
|
+
* step is cheap. It is a view the world owns: read it, don't keep it past the step, and fetch it again after
|
|
115
|
+
* adding or removing components.
|
|
116
|
+
*/
|
|
117
|
+
slots(...types: ComponentType<unknown>[]): Int32Array;
|
|
118
|
+
/**
|
|
119
|
+
* Every live entity holding all of `types`, with those components in the same order. Yields a fresh row per
|
|
120
|
+
* entity: convenient, but `each` is the form for hot loops.
|
|
121
|
+
*/
|
|
122
|
+
query<const T extends readonly ComponentType<unknown>[]>(...types: T): IterableIterator<[Entity, ...ComponentValues<T>]>;
|
|
123
|
+
/** The first entity matching the query, or undefined: for singletons (the player, the camera target). */
|
|
124
|
+
first<const T extends readonly ComponentType<unknown>[]>(...types: T): [Entity, ...ComponentValues<T>] | undefined;
|
|
125
|
+
addSystem(s: System): this;
|
|
126
|
+
removeSystem(name: string): void;
|
|
127
|
+
/** Runs every system of `phase` in the order added. A system that throws is reported and the rest still run. */
|
|
128
|
+
run(phase: SystemPhase, ctx: Omit<SystemContext, 'world'>, onError?: (system: System, err: unknown) => void): void;
|
|
129
|
+
/** Every entity, component and system gone. */
|
|
130
|
+
clear(): void;
|
|
131
|
+
private columnsOf;
|
|
132
|
+
private store;
|
|
133
|
+
/** The stores for `types`, or null when one has never been used (so nothing can match). */
|
|
134
|
+
private setsFor;
|
|
135
|
+
private endWalk;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=World.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"World.d.ts","sourceRoot":"","sources":["../../../src/ecs/World.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ComponentType } from './World.js';
|
|
2
|
+
/**
|
|
3
|
+
* Numeric components stored as columns of typed arrays instead of one object per entity: `Position.x` and
|
|
4
|
+
* `Position.y` are two `Float32Array`s indexed by the entity's slot. A system walking thousands of bodies then reads
|
|
5
|
+
* memory in order and makes no garbage, which is several times faster than objects at scale (see `bench/`).
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const Position = defineFields('Position', { x: 'f32', y: 'f32' });
|
|
9
|
+
* world.add(e, Position, { x: 10, y: 20 });
|
|
10
|
+
* const p = world.columns(Position); // fetch per run: columns grow (and are replaced) as entities are added
|
|
11
|
+
* world.each(Position, (e, i) => { p.x[i] += 1; });
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* In `each`/`query` a field component's value is the entity's slot index `i`, the index into every column.
|
|
15
|
+
*/
|
|
16
|
+
export type FieldKind = 'f32' | 'f64' | 'i8' | 'i16' | 'i32' | 'u8' | 'u16' | 'u32';
|
|
17
|
+
export type FieldSpec = Record<string, FieldKind>;
|
|
18
|
+
export type ArrayOf<K extends FieldKind> = K extends 'f32' ? Float32Array : K extends 'f64' ? Float64Array : K extends 'i8' ? Int8Array : K extends 'i16' ? Int16Array : K extends 'i32' ? Int32Array : K extends 'u8' ? Uint8Array : K extends 'u16' ? Uint16Array : Uint32Array;
|
|
19
|
+
/** One typed array per field, indexed by slot. */
|
|
20
|
+
export type Columns<S extends FieldSpec> = {
|
|
21
|
+
[K in keyof S]: ArrayOf<S[K]>;
|
|
22
|
+
};
|
|
23
|
+
/** What `add` takes for a field component: any subset of its fields (the rest start at 0). */
|
|
24
|
+
export type FieldValues<S extends FieldSpec> = {
|
|
25
|
+
[K in keyof S]?: number;
|
|
26
|
+
};
|
|
27
|
+
/** A component of numeric fields. Its value in `each`/`query` is the slot index. */
|
|
28
|
+
export interface FieldsType<S extends FieldSpec> extends ComponentType<number> {
|
|
29
|
+
readonly fields: S;
|
|
30
|
+
}
|
|
31
|
+
export declare function isFields(type: ComponentType<unknown>): type is FieldsType<FieldSpec>;
|
|
32
|
+
/** Fresh columns of at least `n` slots, keeping what `old` held. */
|
|
33
|
+
export declare function growColumns(spec: FieldSpec, n: number, old?: Record<string, ArrayLike<number>>): Record<string, ArrayLike<number>>;
|
|
34
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/ecs/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;AAEpF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAElD,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,SAAS,KAAK,GACtD,YAAY,GACZ,CAAC,SAAS,KAAK,GACb,YAAY,GACZ,CAAC,SAAS,IAAI,GACZ,SAAS,GACT,CAAC,SAAS,KAAK,GACb,UAAU,GACV,CAAC,SAAS,KAAK,GACb,UAAU,GACV,CAAC,SAAS,IAAI,GACZ,UAAU,GACV,CAAC,SAAS,KAAK,GACb,WAAW,GACX,WAAW,CAAC;AAE5B,kDAAkD;AAClD,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,SAAS,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE7E,8FAA8F;AAC9F,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,SAAS,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM;CAAE,CAAC;AAE3E,oFAAoF;AACpF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,aAAa,CAAC,MAAM,CAAC;IAC5E,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;CACpB;AAaD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,UAAU,CAAC,SAAS,CAAC,CAEpF;AAED,oEAAoE;AACpE,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CASlI"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Application } from 'pixi.js';
|
|
2
|
+
import { Stage } from '../core/Stage.js';
|
|
3
|
+
import { TextureRegistry } from '../core/TextureRegistry.js';
|
|
4
|
+
import { EventBus } from '../events/EventBus.js';
|
|
5
|
+
import { FixedLoop } from './FixedLoop.js';
|
|
6
|
+
import { SceneManager } from './SceneManager.js';
|
|
7
|
+
import type { Scene } from './Scene.js';
|
|
8
|
+
export interface EngineOptions {
|
|
9
|
+
/** Where the canvas goes. */
|
|
10
|
+
parent: HTMLElement;
|
|
11
|
+
/** A fixed canvas size in CSS pixels. Leave both out to fill `parent` and follow its size. */
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
/** CSS colour behind the world (default black). */
|
|
15
|
+
background?: string;
|
|
16
|
+
/** World pixels are drawn this many screen pixels wide (default 1). Whole numbers keep pixel art crisp. */
|
|
17
|
+
zoom?: number;
|
|
18
|
+
/** Simulation steps per second (default 60). */
|
|
19
|
+
hz?: number;
|
|
20
|
+
/** Textures shared by the stage; a fresh registry by default. */
|
|
21
|
+
textures?: TextureRegistry;
|
|
22
|
+
/**
|
|
23
|
+
* Pixel art: nearest-neighbour textures, no antialiasing, one backing pixel per CSS pixel, and a camera that lands
|
|
24
|
+
* on whole pixels (default false: smooth textures drawn at the screen's own density, for any other art style).
|
|
25
|
+
*/
|
|
26
|
+
pixelPerfect?: boolean;
|
|
27
|
+
/** Backing pixels per CSS pixel when not `pixelPerfect` (default `devicePixelRatio`, at most 2). */
|
|
28
|
+
resolution?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Renderer preference (default 'webgl'). WebGL 2 runs everywhere the engine is tested. 'webgpu' is experimental:
|
|
31
|
+
* Pixi falls back to WebGL where WebGPU is missing, but the engine's own paths (pooled `PixelLayer` buffers, the
|
|
32
|
+
* `erase` blend `Darkness` cuts lights with, the fill filters) have only been profiled on WebGL.
|
|
33
|
+
*/
|
|
34
|
+
preference?: 'webgl' | 'webgpu';
|
|
35
|
+
/**
|
|
36
|
+
* Pause simulating and drawing while the page is hidden (another tab, the phone's home screen) and resume when it
|
|
37
|
+
* is shown, with no catch-up burst of steps (default false). A pause the game made itself is left alone.
|
|
38
|
+
*/
|
|
39
|
+
pauseWhenHidden?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Mirror the system's "reduce motion" setting into `engineSettings.reducedFx`, now and on every change (default
|
|
42
|
+
* false). Leave it off when the game has its own reduced-effects toggle and mirrors that instead.
|
|
43
|
+
*/
|
|
44
|
+
followReducedMotion?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface EngineEvents {
|
|
47
|
+
/** Something a guarded step or a system threw; the frame carried on. */
|
|
48
|
+
error: {
|
|
49
|
+
where: string;
|
|
50
|
+
error: unknown;
|
|
51
|
+
};
|
|
52
|
+
/** After every rendered frame's update, before Pixi renders. */
|
|
53
|
+
frame: {
|
|
54
|
+
now: number;
|
|
55
|
+
dt: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The top of the engine: a Pixi application, the `Stage` (world and screen layers, camera, tweens, timers,
|
|
60
|
+
* pointer), a fixed-step simulation loop and a stack of scenes.
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* const engine = await Engine.create({ parent: document.body, zoom: 3 });
|
|
64
|
+
* await engine.scenes.replace(new MyLevel());
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare class Engine {
|
|
68
|
+
readonly app: Application;
|
|
69
|
+
readonly stage: Stage;
|
|
70
|
+
readonly loop: FixedLoop;
|
|
71
|
+
readonly scenes: SceneManager;
|
|
72
|
+
readonly events: EventBus<EngineEvents>;
|
|
73
|
+
private running;
|
|
74
|
+
private destroyed;
|
|
75
|
+
/** Pauses through the loop's own switch, so a hidden tab never counts as the game's own pause (`forget`). */
|
|
76
|
+
private readonly hiddenPause;
|
|
77
|
+
private readonly unwatch;
|
|
78
|
+
private readonly onTick;
|
|
79
|
+
private constructor();
|
|
80
|
+
static create(options: EngineOptions): Promise<Engine>;
|
|
81
|
+
/** The scene that updates now, if any. */
|
|
82
|
+
get scene(): Scene | undefined;
|
|
83
|
+
/** Stops simulating and drawing; the canvas keeps its last frame. */
|
|
84
|
+
pause(): void;
|
|
85
|
+
resume(): void;
|
|
86
|
+
private makeHiddenPause;
|
|
87
|
+
private pauseLoop;
|
|
88
|
+
private resumeLoop;
|
|
89
|
+
get paused(): boolean;
|
|
90
|
+
/** Reports a fault to `events.error` (and the console when nobody listens). */
|
|
91
|
+
reportError(where: string, error: unknown): void;
|
|
92
|
+
/** Leaves every scene, removes the canvas and frees the renderer. */
|
|
93
|
+
destroy(): Promise<void>;
|
|
94
|
+
private tick;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=Engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Engine.d.ts","sourceRoot":"","sources":["../../../src/engine/Engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,6BAA6B;IAC7B,MAAM,EAAE,WAAW,CAAC;IACpB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2GAA2G;IAC3G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iEAAiE;IACjE,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oGAAoG;IACpG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAChC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACzC,gEAAgE;IAChE,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAiBD;;;;;;;;GAQG;AACH,qBAAa,MAAM;IAaf,QAAQ,CAAC,GAAG,EAAE,WAAW;IAZ3B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,yBAAgC;IAC/C,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,SAAS,CAAS;IAC1B,6GAA6G;IAC7G,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0B;IACtD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2D;IAElF,OAAO;WAmBM,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB5D,0CAA0C;IAC1C,IAAI,KAAK,IAAI,KAAK,GAAG,SAAS,CAE7B;IAED,qEAAqE;IACrE,KAAK,IAAI,IAAI;IAKb,MAAM,IAAI,IAAI;IAKd,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;IASlB,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,+EAA+E;IAC/E,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAKhD,qEAAqE;IAC/D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAY9B,OAAO,CAAC,IAAI;CAeb"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A fixed-timestep accumulator: frames arrive whenever the display wants them, the simulation advances in equal
|
|
3
|
+
* steps. Movement and anything a server replays must run here, so every machine takes the same steps whatever its
|
|
4
|
+
* frame rate.
|
|
5
|
+
*
|
|
6
|
+
* A frame that comes very late (a tab in the background, a debugger) would owe hundreds of steps; at most
|
|
7
|
+
* `maxStepsPerFrame` are run and the rest of the debt is dropped, so the game slows down instead of freezing while it
|
|
8
|
+
* catches up (the "spiral of death").
|
|
9
|
+
*/
|
|
10
|
+
export interface FixedLoopOptions {
|
|
11
|
+
/** Steps per second (default 60). */
|
|
12
|
+
hz?: number;
|
|
13
|
+
/** The most steps one frame may run before the debt is dropped (default 8). */
|
|
14
|
+
maxStepsPerFrame?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class FixedLoop {
|
|
17
|
+
readonly stepMs: number;
|
|
18
|
+
readonly stepSeconds: number;
|
|
19
|
+
private readonly maxSteps;
|
|
20
|
+
private carry;
|
|
21
|
+
/** Steps taken since the loop started. */
|
|
22
|
+
tick: number;
|
|
23
|
+
constructor(options?: FixedLoopOptions);
|
|
24
|
+
/**
|
|
25
|
+
* Feeds one frame of `deltaMs` and runs `step` as many times as it owes. Returns the share of a step left over
|
|
26
|
+
* (0–1), for interpolating what is drawn between the last two steps.
|
|
27
|
+
*/
|
|
28
|
+
advance(deltaMs: number, step: (tick: number) => void): number;
|
|
29
|
+
/** Forgets any debt, e.g. after a scene change or a long load. */
|
|
30
|
+
reset(): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=FixedLoop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixedLoop.d.ts","sourceRoot":"","sources":["../../../src/engine/FixedLoop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,SAAS;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,KAAK,CAAK;IAClB,0CAA0C;IAC1C,IAAI,SAAK;gBAEG,OAAO,GAAE,gBAAqB;IAQ1C;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM;IAe9D,kEAAkE;IAClE,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pauses a loop while the page is hidden and resumes it when it comes back — but only if it was the one that paused
|
|
3
|
+
* it: a game paused by its own menu stays paused when the tab returns. Pure (the page's visibility comes in through
|
|
4
|
+
* `hidden`/`shown`), so the rule is tested under node; `watchVisibility` wires it to the document.
|
|
5
|
+
*/
|
|
6
|
+
export interface Pausable {
|
|
7
|
+
readonly paused: boolean;
|
|
8
|
+
pause(): void;
|
|
9
|
+
resume(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class HiddenPause {
|
|
12
|
+
private readonly target;
|
|
13
|
+
private pausedByUs;
|
|
14
|
+
constructor(target: Pausable);
|
|
15
|
+
hidden(): void;
|
|
16
|
+
shown(): void;
|
|
17
|
+
/** The game paused or resumed it itself: whatever happens next is its choice, not ours to undo. */
|
|
18
|
+
forget(): void;
|
|
19
|
+
/** Listens to `visibilitychange` on `doc`; returns the unsubscribe. A no-op without a document. */
|
|
20
|
+
watch(doc?: Pick<Document, 'visibilityState' | 'addEventListener' | 'removeEventListener'> | null): () => void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=HiddenPause.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HiddenPause.d.ts","sourceRoot":"","sources":["../../../src/engine/HiddenPause.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,qBAAa,WAAW;IAGV,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,UAAU,CAAS;gBAEE,MAAM,EAAE,QAAQ;IAE7C,MAAM,IAAI,IAAI;IAMd,KAAK,IAAI,IAAI;IAOb,mGAAmG;IACnG,MAAM,IAAI,IAAI;IAId,mGAAmG;IACnG,KAAK,CAAC,GAAG,GAAE,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,qBAAqB,CAAC,GAAG,IAAwD,GAAG,MAAM,IAAI;CAOlK"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Container } from 'pixi.js';
|
|
2
|
+
import { World } from '../ecs/World.js';
|
|
3
|
+
import type { Engine } from './Engine.js';
|
|
4
|
+
/** Input a scene can be told to forget its pending presses on (an `Actions`). */
|
|
5
|
+
export interface FlushableInput {
|
|
6
|
+
flush(): void;
|
|
7
|
+
}
|
|
8
|
+
/** A timer `Scene.delay` started; `remove` cancels it. */
|
|
9
|
+
export interface SceneTimer {
|
|
10
|
+
remove(): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One screen of the game: a title, a level, a pause menu. A scene owns a `World` of entities and systems and a
|
|
14
|
+
* `root` container in the engine's world layer; both are cleared when it leaves, so nothing it made outlives it.
|
|
15
|
+
*
|
|
16
|
+
* Override the hooks you need. `fixedUpdate` runs once per simulation step, `update` once per rendered frame, both
|
|
17
|
+
* after the world's own systems of that phase.
|
|
18
|
+
*
|
|
19
|
+
* Two things a scene should hand the engine so they end with it: timers (`delay`, not `stage.time.delayedCall`, whose
|
|
20
|
+
* timers belong to the stage and fire after the scene has gone) and its input (`useInput`, flushed when a scene pushed
|
|
21
|
+
* over this one pops, so presses made in a pause menu are not read again by the level under it).
|
|
22
|
+
*
|
|
23
|
+
* Names taken: `world`, `root` and `hud` are the scene's own fields, so a subclass cannot declare a field of those
|
|
24
|
+
* names for something else (a HUD class of the game's is best kept as `display`, `overlay`, …).
|
|
25
|
+
*/
|
|
26
|
+
export declare abstract class Scene {
|
|
27
|
+
readonly world: World;
|
|
28
|
+
/** Everything the scene draws in the world goes under this (the camera moves it). */
|
|
29
|
+
readonly root: Container<import("pixi.js").ContainerChild>;
|
|
30
|
+
/** Everything the scene draws on the screen (HUD) goes under this. */
|
|
31
|
+
readonly hud: Container<import("pixi.js").ContainerChild>;
|
|
32
|
+
private bound;
|
|
33
|
+
private readonly timers;
|
|
34
|
+
private readonly inputs;
|
|
35
|
+
/** The engine running this scene; only valid between `enter` and `exit`. */
|
|
36
|
+
get engine(): Engine;
|
|
37
|
+
/** Called once when the scene becomes active. May be async: the scene starts updating when it resolves. */
|
|
38
|
+
onEnter(): void | Promise<void>;
|
|
39
|
+
/** Called when the scene is removed. The world and containers are cleared after it returns. */
|
|
40
|
+
onExit(): void;
|
|
41
|
+
/** Called when another scene is pushed over this one. */
|
|
42
|
+
onPause(): void;
|
|
43
|
+
/** Called when the scene over this one is popped. */
|
|
44
|
+
onResume(): void;
|
|
45
|
+
/** Once per simulation step, `dt` in seconds. */
|
|
46
|
+
fixedUpdate(_dt: number): void;
|
|
47
|
+
/** Once per rendered frame, `dt` in seconds; `alpha` is the share of a step since the last one (0–1). */
|
|
48
|
+
update(_dt: number, _alpha: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Calls `fn` after `ms` on the stage's clock, unless the scene has left by then: its timers are cancelled when it
|
|
51
|
+
* exits. Only valid while the scene is running (between `enter` and `exit`).
|
|
52
|
+
*/
|
|
53
|
+
delay(ms: number, fn: () => void): SceneTimer;
|
|
54
|
+
/**
|
|
55
|
+
* Registers input the scene reads (an `Actions`) and returns it, so a field can be written in one line:
|
|
56
|
+
* `private readonly input = this.useInput(new Actions(keyboard, bindings));`. When a scene pushed over this one
|
|
57
|
+
* pops, every registered input is flushed before `onResume`, so a key pressed in the menu is not a press here.
|
|
58
|
+
*/
|
|
59
|
+
useInput<T extends FlushableInput>(input: T): T;
|
|
60
|
+
/** @internal Called by the scene manager before `onResume`. */
|
|
61
|
+
flushInput(): void;
|
|
62
|
+
/** @internal Engine-side wiring; games call `engine.scenes`. */
|
|
63
|
+
attach(engine: Engine): void;
|
|
64
|
+
/** @internal Clears what the scene made but keeps its containers, so the same scene may be entered again. */
|
|
65
|
+
detach(): void;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=Scene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scene.d.ts","sourceRoot":"","sources":["../../../src/engine/Scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,iFAAiF;AACjF,MAAM,WAAW,cAAc;IAC7B,KAAK,IAAI,IAAI,CAAC;CACf;AAED,0DAA0D;AAC1D,MAAM,WAAW,UAAU;IACzB,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,8BAAsB,KAAK;IACzB,QAAQ,CAAC,KAAK,QAAe;IAC7B,qFAAqF;IACrF,QAAQ,CAAC,IAAI,8CAA6C;IAC1D,sEAAsE;IACtE,QAAQ,CAAC,GAAG,8CAAmB;IAC/B,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAE/C,4EAA4E;IAC5E,IAAI,MAAM,IAAI,MAAM,CAGnB;IAED,2GAA2G;IAC3G,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC/B,+FAA+F;IAC/F,MAAM,IAAI,IAAI;IACd,yDAAyD;IACzD,OAAO,IAAI,IAAI;IACf,qDAAqD;IACrD,QAAQ,IAAI,IAAI;IAChB,iDAAiD;IACjD,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAC9B,yGAAyG;IACzG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAEzC;;;OAGG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,UAAU;IAe7C;;;;OAIG;IACH,QAAQ,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC;IAK/C,+DAA+D;IAC/D,UAAU,IAAI,IAAI;IAIlB,gEAAgE;IAChE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAM5B,6GAA6G;IAC7G,MAAM,IAAI,IAAI;CASf"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Engine } from './Engine.js';
|
|
2
|
+
import type { Scene } from './Scene.js';
|
|
3
|
+
/**
|
|
4
|
+
* A stack of scenes. Only the top one updates; the ones under it are paused but still drawn (a pause menu over the
|
|
5
|
+
* level). Changes are queued and applied one at a time, so a scene that replaces itself from inside its own update,
|
|
6
|
+
* or an async `onEnter` still loading, never leaves two scenes half entered.
|
|
7
|
+
*
|
|
8
|
+
* The camera is the engine's, not a scene's: `replace` resets it (`Camera.reset`: no target, no bounds, the default
|
|
9
|
+
* zoom) after the old scenes leave and before the new one enters, so a level's follow and bounds never hold over a
|
|
10
|
+
* title screen. `push` and `pop` leave it as it is: the scene under a pause menu keeps its view. `pop` flushes the
|
|
11
|
+
* resumed scene's input (`Scene.useInput`) before its `onResume`.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SceneManager {
|
|
14
|
+
private readonly engine;
|
|
15
|
+
private readonly stack;
|
|
16
|
+
private queue;
|
|
17
|
+
/** True while an async `onEnter` is running: nothing updates until it is done. */
|
|
18
|
+
private entering;
|
|
19
|
+
constructor(engine: Engine);
|
|
20
|
+
/** The scene that updates, if any. */
|
|
21
|
+
get current(): Scene | undefined;
|
|
22
|
+
/** Every scene on the stack, bottom first. */
|
|
23
|
+
get all(): readonly Scene[];
|
|
24
|
+
/** Removes every scene and enters `scene`. */
|
|
25
|
+
replace(scene: Scene): Promise<void>;
|
|
26
|
+
/** Pauses the current scene and enters `scene` over it. */
|
|
27
|
+
push(scene: Scene): Promise<void>;
|
|
28
|
+
/** Leaves the current scene and resumes the one under it. */
|
|
29
|
+
pop(): Promise<void>;
|
|
30
|
+
/** Leaves every scene (the engine is shutting down). */
|
|
31
|
+
clear(): Promise<void>;
|
|
32
|
+
private enter;
|
|
33
|
+
private exitTop;
|
|
34
|
+
private enqueue;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=SceneManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneManager.d.ts","sourceRoot":"","sources":["../../../src/engine/SceneManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC;;;;;;;;;GASG;AACH,qBAAa,YAAY;IAMX,OAAO,CAAC,QAAQ,CAAC,MAAM;IALnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,KAAK,CAAoC;IACjD,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAS;gBAEI,MAAM,EAAE,MAAM;IAE3C,sCAAsC;IACtC,IAAI,OAAO,IAAI,KAAK,GAAG,SAAS,CAE/B;IAED,8CAA8C;IAC9C,IAAI,GAAG,IAAI,SAAS,KAAK,EAAE,CAE1B;IAED,8CAA8C;IAC9C,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpC,2DAA2D;IAC3D,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjC,6DAA6D;IAC7D,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAWpB,wDAAwD;IACxD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAMR,KAAK;IAanB,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,OAAO;CAMhB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed observer: listeners subscribe per event name and run in subscription order.
|
|
3
|
+
* `Events` maps each event name to its payload, e.g. `EventBus<{ enemyKilled: { id: number } }>`.
|
|
4
|
+
*
|
|
5
|
+
* A listener that throws does not stop the ones after it; the error is handed to `onError` (the console by default).
|
|
6
|
+
*/
|
|
7
|
+
export declare class EventBus<Events extends object> {
|
|
8
|
+
private readonly onError;
|
|
9
|
+
private readonly listeners;
|
|
10
|
+
constructor(onError?: (type: keyof Events, err: unknown) => void);
|
|
11
|
+
/** Subscribes to `type`; returns the unsubscribe function. */
|
|
12
|
+
on<K extends keyof Events>(type: K, fn: (payload: Events[K]) => void): () => void;
|
|
13
|
+
/** Subscribes for the next `type` only. */
|
|
14
|
+
once<K extends keyof Events>(type: K, fn: (payload: Events[K]) => void): () => void;
|
|
15
|
+
off<K extends keyof Events>(type: K, fn: (payload: Events[K]) => void): void;
|
|
16
|
+
emit<K extends keyof Events>(type: K, payload: Events[K]): void;
|
|
17
|
+
listenerCount(type: keyof Events): number;
|
|
18
|
+
clear(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=EventBus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventBus.d.ts","sourceRoot":"","sources":["../../../src/events/EventBus.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,QAAQ,CAAC,MAAM,SAAS,MAAM;IAG7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyD;gBAEtD,OAAO,GAAE,CAAC,IAAI,EAAE,MAAM,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK,IAAoF;IAEhK,8DAA8D;IAC9D,EAAE,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAKjF,2CAA2C;IAC3C,IAAI,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAQnF,GAAG,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,IAAI;IAQ5E,IAAI,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;IAW/D,aAAa,CAAC,IAAI,EAAE,MAAM,MAAM,GAAG,MAAM;IAIzC,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { BLEND_MODES } from 'pixi.js';
|
|
2
|
+
import type { Image } from '../core/Image.js';
|
|
3
|
+
import type { Stage } from '../core/Stage.js';
|
|
4
|
+
export interface AfterimagesOptions {
|
|
5
|
+
/** Colours the copies wear, cycled one per copy (default white): a trail shimmering from white to blue, say. */
|
|
6
|
+
tints?: readonly number[];
|
|
7
|
+
/** Opacity a copy starts at (default 0.6). */
|
|
8
|
+
alpha?: number;
|
|
9
|
+
/** How long a copy takes to fade out, ms (default 260). */
|
|
10
|
+
durationMs?: number;
|
|
11
|
+
/** The least time between two copies, ms (default 22: a copy every frame or so at 60 fps without doubling up). */
|
|
12
|
+
spacingMs?: number;
|
|
13
|
+
/** The scale a copy shrinks to as it fades, a share of the body's (default 0.85; 1 keeps it). */
|
|
14
|
+
endScale?: number;
|
|
15
|
+
/** How copies blend (default `'add'`: light; `'normal'` for painted shadows). */
|
|
16
|
+
blend?: BLEND_MODES;
|
|
17
|
+
/**
|
|
18
|
+
* Copies of a live body (one repainted every frame) are kept in a ring of this many textures, reused, and spent
|
|
19
|
+
* copies are pooled up to this many (default 16: at 22 ms apart and 260 ms each, never all in use at once).
|
|
20
|
+
*/
|
|
21
|
+
slots?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Afterimages of a moving body — a dash, a blink, a quick step: copies of its current frame left behind as flat
|
|
25
|
+
* silhouettes in a tint, fading out. A copy is its frame's cached solid silhouette (`solidSilhouette`) tinted, not a
|
|
26
|
+
* fill filter, so a trail costs no render pass per copy; copies are pooled rather than made every few ms, and a live
|
|
27
|
+
* body's frames are snapshotted into a fixed ring of textures instead of a new canvas each time.
|
|
28
|
+
*/
|
|
29
|
+
export declare class Afterimages {
|
|
30
|
+
private readonly stage;
|
|
31
|
+
private readonly tints;
|
|
32
|
+
private readonly alpha;
|
|
33
|
+
private readonly durationMs;
|
|
34
|
+
private readonly spacingMs;
|
|
35
|
+
private readonly endScale;
|
|
36
|
+
private readonly blend;
|
|
37
|
+
private readonly slots;
|
|
38
|
+
private readonly prefix;
|
|
39
|
+
/** The copy wearing each ring slot's texture: it goes before its texture is painted over. */
|
|
40
|
+
private readonly slotUsers;
|
|
41
|
+
private slot;
|
|
42
|
+
private readonly fading;
|
|
43
|
+
private readonly free;
|
|
44
|
+
private lastAt;
|
|
45
|
+
private count;
|
|
46
|
+
constructor(stage: Stage, options?: AfterimagesOptions);
|
|
47
|
+
/**
|
|
48
|
+
* Leaves a copy of `body` as drawn now, standing at world (x, y) with draw order `depth` (default just behind a
|
|
49
|
+
* body sorted by `y`), unless one was left less than `spacingMs` before `now`. Answers the copy, or null when none
|
|
50
|
+
* was laid (too soon, or the frame could not be read): a caller drawing its own speed streaks between copies
|
|
51
|
+
* follows that.
|
|
52
|
+
*/
|
|
53
|
+
trail(body: Image, x: number, y: number, now: number, depth?: number): Image | null;
|
|
54
|
+
/** Copies still fading. */
|
|
55
|
+
get active(): number;
|
|
56
|
+
private copyOf;
|
|
57
|
+
/** A faded copy: hidden and kept for the next one (a ring slot's copy stays with its slot). */
|
|
58
|
+
private spend;
|
|
59
|
+
/** Takes every copy off the stage and frees the ring's textures. */
|
|
60
|
+
destroy(): void;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=Afterimages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Afterimages.d.ts","sourceRoot":"","sources":["../../../src/fx/Afterimages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,gHAAgH;IAChH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kHAAkH;IAClH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iGAAiG;IACjG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID;;;;;GAKG;AACH,qBAAa,WAAW;IAkBpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAjBxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAC1D,6FAA6F;IAC7F,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAClD,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,KAAK,CAAK;gBAGC,KAAK,EAAE,KAAK,EAC7B,OAAO,GAAE,kBAAuB;IAWlC;;;;;OAKG;IACH,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,SAAQ,GAAG,KAAK,GAAG,IAAI;IA2BlF,2BAA2B;IAC3B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,OAAO,CAAC,MAAM;IA6Bd,+FAA+F;IAC/F,OAAO,CAAC,KAAK;IASb,oEAAoE;IACpE,OAAO,IAAI,IAAI;CAYhB"}
|