1681-engine 0.0.0-stage → 0.5.8
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 +304 -0
- package/LICENSE +21 -0
- package/README.md +164 -2
- package/dist/1681-engine.js +417 -0
- package/dist/1681-engine.js.map +1 -0
- package/dist/ambient/ColorGrade.js +41 -0
- package/dist/ambient/ColorGrade.js.map +1 -0
- package/dist/ambient/DayClock.js +57 -0
- package/dist/ambient/DayClock.js.map +1 -0
- package/dist/ambient/WeatherLayer.js +91 -0
- package/dist/ambient/WeatherLayer.js.map +1 -0
- package/dist/ambient/grade.js +13 -0
- package/dist/ambient/grade.js.map +1 -0
- package/dist/ambient/weather.js +52 -0
- package/dist/ambient/weather.js.map +1 -0
- package/dist/anim/AnimStateMachine.js +164 -0
- package/dist/anim/AnimStateMachine.js.map +1 -0
- package/dist/anim/Animator.js +67 -0
- package/dist/anim/Animator.js.map +1 -0
- package/dist/anim/animStateCompile.js +113 -0
- package/dist/anim/animStateCompile.js.map +1 -0
- package/dist/anim/animStateSystem.js +17 -0
- package/dist/anim/animStateSystem.js.map +1 -0
- package/dist/anim/animationSystem.js +15 -0
- package/dist/anim/animationSystem.js.map +1 -0
- package/dist/anim/asepriteSlices.js +22 -0
- package/dist/anim/asepriteSlices.js.map +1 -0
- package/dist/anim/asepriteTags.js +35 -0
- package/dist/anim/asepriteTags.js.map +1 -0
- package/dist/anim/parseAseprite.js +83 -0
- package/dist/anim/parseAseprite.js.map +1 -0
- package/dist/assets/AssetLoader.js +104 -0
- package/dist/assets/AssetLoader.js.map +1 -0
- package/dist/assets/loadAseprite.js +50 -0
- package/dist/assets/loadAseprite.js.map +1 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +31 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js.map +1 -0
- package/dist/audio/Footsteps.js +26 -0
- package/dist/audio/Footsteps.js.map +1 -0
- package/dist/audio/MusicPlayer.js +78 -0
- package/dist/audio/MusicPlayer.js.map +1 -0
- package/dist/audio/SoundEngine.js +119 -0
- package/dist/audio/SoundEngine.js.map +1 -0
- package/dist/audio/cleanTake.js +30 -0
- package/dist/audio/cleanTake.js.map +1 -0
- package/dist/audio/music/ElementVoice.js +35 -0
- package/dist/audio/music/ElementVoice.js.map +1 -0
- package/dist/audio/music/GraphVoice.js +39 -0
- package/dist/audio/music/GraphVoice.js.map +1 -0
- package/dist/audio/music/MusicChannel.js +58 -0
- package/dist/audio/music/MusicChannel.js.map +1 -0
- package/dist/audio/music/musicVoice.js +13 -0
- package/dist/audio/music/musicVoice.js.map +1 -0
- package/dist/audio/sampleBank.js +82 -0
- package/dist/audio/sampleBank.js.map +1 -0
- package/dist/audio/soundTable.js +9 -0
- package/dist/audio/soundTable.js.map +1 -0
- package/dist/audio/synth.js +36 -0
- package/dist/audio/synth.js.map +1 -0
- package/dist/core/BitmapLabel.js +49 -0
- package/dist/core/BitmapLabel.js.map +1 -0
- package/dist/core/Camera.js +150 -0
- package/dist/core/Camera.js.map +1 -0
- package/dist/core/Clock.js +30 -0
- package/dist/core/Clock.js.map +1 -0
- package/dist/core/Graphics.js +69 -0
- package/dist/core/Graphics.js.map +1 -0
- package/dist/core/Group.js +29 -0
- package/dist/core/Group.js.map +1 -0
- package/dist/core/Image.js +51 -0
- package/dist/core/Image.js.map +1 -0
- package/dist/core/ObjectFactory.js +55 -0
- package/dist/core/ObjectFactory.js.map +1 -0
- package/dist/core/Pointer.js +58 -0
- package/dist/core/Pointer.js.map +1 -0
- package/dist/core/Rectangle.js +51 -0
- package/dist/core/Rectangle.js.map +1 -0
- package/dist/core/Stage.js +86 -0
- package/dist/core/Stage.js.map +1 -0
- package/dist/core/Text.js +22 -0
- package/dist/core/Text.js.map +1 -0
- package/dist/core/TextureRegistry.js +111 -0
- package/dist/core/TextureRegistry.js.map +1 -0
- package/dist/core/Timeline.js +211 -0
- package/dist/core/Timeline.js.map +1 -0
- package/dist/core/TimelineBuilder.js +73 -0
- package/dist/core/TimelineBuilder.js.map +1 -0
- package/dist/core/TimelineChild.js +84 -0
- package/dist/core/TimelineChild.js.map +1 -0
- package/dist/core/Tweener.js +136 -0
- package/dist/core/Tweener.js.map +1 -0
- package/dist/core/atlas.js +38 -0
- package/dist/core/atlas.js.map +1 -0
- package/dist/core/atlasPlan.js +22 -0
- package/dist/core/atlasPlan.js.map +1 -0
- package/dist/core/eases.js +21 -0
- package/dist/core/eases.js.map +1 -0
- package/dist/core/gameObject.js +115 -0
- package/dist/core/gameObject.js.map +1 -0
- package/dist/core/pixiPatches.js +18 -0
- package/dist/core/pixiPatches.js.map +1 -0
- package/dist/core/timelinePlace.js +24 -0
- package/dist/core/timelinePlace.js.map +1 -0
- package/dist/core/tweenProps.js +12 -0
- package/dist/core/tweenProps.js.map +1 -0
- package/dist/debug/DebugOverlay.js +94 -0
- package/dist/debug/DebugOverlay.js.map +1 -0
- package/dist/debug/DrawCallCounter.js +41 -0
- package/dist/debug/DrawCallCounter.js.map +1 -0
- package/dist/debug/ErrorLog.js +22 -0
- package/dist/debug/ErrorLog.js.map +1 -0
- package/dist/debug/FrameStats.js +42 -0
- package/dist/debug/FrameStats.js.map +1 -0
- package/dist/debug/inspectWorld.js +29 -0
- package/dist/debug/inspectWorld.js.map +1 -0
- package/dist/diagnostics/ErrorDeduper.js +27 -0
- package/dist/diagnostics/ErrorDeduper.js.map +1 -0
- package/dist/diagnostics/FrameSampler.js +42 -0
- package/dist/diagnostics/FrameSampler.js.map +1 -0
- package/dist/diagnostics/bootWatch.js +21 -0
- package/dist/diagnostics/bootWatch.js.map +1 -0
- package/dist/diagnostics/captureErrors.js +27 -0
- package/dist/diagnostics/captureErrors.js.map +1 -0
- package/dist/diagnostics/contextLoss.js +25 -0
- package/dist/diagnostics/contextLoss.js.map +1 -0
- package/dist/diagnostics/frameStats.js +31 -0
- package/dist/diagnostics/frameStats.js.map +1 -0
- package/dist/diagnostics/gpuInfo.js +22 -0
- package/dist/diagnostics/gpuInfo.js.map +1 -0
- package/dist/diagnostics/renderGuard.js +24 -0
- package/dist/diagnostics/renderGuard.js.map +1 -0
- package/dist/ecs/SparseSet.js +55 -0
- package/dist/ecs/SparseSet.js.map +1 -0
- package/dist/ecs/World.js +307 -0
- package/dist/ecs/World.js.map +1 -0
- package/dist/ecs/fields.js +26 -0
- package/dist/ecs/fields.js.map +1 -0
- package/dist/engine/Engine.js +82 -0
- package/dist/engine/Engine.js.map +1 -0
- package/dist/engine/FixedLoop.js +37 -0
- package/dist/engine/FixedLoop.js.map +1 -0
- package/dist/engine/Scene.js +79 -0
- package/dist/engine/Scene.js.map +1 -0
- package/dist/engine/SceneManager.js +73 -0
- package/dist/engine/SceneManager.js.map +1 -0
- package/dist/events/EventBus.js +42 -0
- package/dist/events/EventBus.js.map +1 -0
- package/dist/fx/FloatingText.js +72 -0
- package/dist/fx/FloatingText.js.map +1 -0
- package/dist/fx/hitStop.js +28 -0
- package/dist/fx/hitStop.js.map +1 -0
- package/dist/fx/viewCull.js +10 -0
- package/dist/fx/viewCull.js.map +1 -0
- package/dist/i18n/Translator.js +72 -0
- package/dist/i18n/Translator.js.map +1 -0
- package/dist/i18n/extractStrings.js +58 -0
- package/dist/i18n/extractStrings.js.map +1 -0
- package/dist/i18n/formatMessage.js +19 -0
- package/dist/i18n/formatMessage.js.map +1 -0
- package/dist/input/Actions.js +131 -0
- package/dist/input/Actions.js.map +1 -0
- package/dist/input/AimGesture.js +75 -0
- package/dist/input/AimGesture.js.map +1 -0
- package/dist/input/Keyboard.js +54 -0
- package/dist/input/Keyboard.js.map +1 -0
- package/dist/input/Keymap.js +171 -0
- package/dist/input/Keymap.js.map +1 -0
- package/dist/input/TargetLock.js +73 -0
- package/dist/input/TargetLock.js.map +1 -0
- package/dist/input/aimAxis.js +8 -0
- package/dist/input/aimAxis.js.map +1 -0
- package/dist/input/keyChord.js +29 -0
- package/dist/input/keyChord.js.map +1 -0
- package/dist/input/longPress.js +32 -0
- package/dist/input/longPress.js.map +1 -0
- package/dist/input/stickAxis.js +23 -0
- package/dist/input/stickAxis.js.map +1 -0
- package/dist/input/touchDetect.js +7 -0
- package/dist/input/touchDetect.js.map +1 -0
- package/dist/light/LightLayer.js +84 -0
- package/dist/light/LightLayer.js.map +1 -0
- package/dist/nav/MinHeap.js +39 -0
- package/dist/nav/MinHeap.js.map +1 -0
- package/dist/nav/findPath.js +78 -0
- package/dist/nav/findPath.js.map +1 -0
- package/dist/nav/navGrid.js +36 -0
- package/dist/nav/navGrid.js.map +1 -0
- package/dist/nav/nearestOpen.js +19 -0
- package/dist/nav/nearestOpen.js.map +1 -0
- package/dist/nav/straightenPath.js +51 -0
- package/dist/nav/straightenPath.js.map +1 -0
- package/dist/net/Connection.js +84 -0
- package/dist/net/Connection.js.map +1 -0
- package/dist/net/InterpolationBuffer.js +57 -0
- package/dist/net/InterpolationBuffer.js.map +1 -0
- package/dist/net/PredictedMover.js +61 -0
- package/dist/net/PredictedMover.js.map +1 -0
- package/dist/net/Room.js +92 -0
- package/dist/net/Room.js.map +1 -0
- package/dist/net/RoomHost.js +101 -0
- package/dist/net/RoomHost.js.map +1 -0
- package/dist/net/cadence.js +22 -0
- package/dist/net/cadence.js.map +1 -0
- package/dist/net/constants.js +11 -0
- package/dist/net/constants.js.map +1 -0
- package/dist/net/lobby/LobbyClient.js +124 -0
- package/dist/net/lobby/LobbyClient.js.map +1 -0
- package/dist/net/lobby/LobbyHost.js +366 -0
- package/dist/net/lobby/LobbyHost.js.map +1 -0
- package/dist/net/lobby/LobbyRooms.js +66 -0
- package/dist/net/lobby/LobbyRooms.js.map +1 -0
- package/dist/net/lobby/Matchmaker.js +106 -0
- package/dist/net/lobby/Matchmaker.js.map +1 -0
- package/dist/net/movement.js +83 -0
- package/dist/net/movement.js.map +1 -0
- package/dist/net/protocol.js +11 -0
- package/dist/net/protocol.js.map +1 -0
- package/dist/net/serverClock.js +22 -0
- package/dist/net/serverClock.js.map +1 -0
- package/dist/net/snapshotCodec.js +92 -0
- package/dist/net/snapshotCodec.js.map +1 -0
- package/dist/parallax/Parallax.js +32 -0
- package/dist/parallax/Parallax.js.map +1 -0
- package/dist/parallax/ParallaxLayer.js +70 -0
- package/dist/parallax/ParallaxLayer.js.map +1 -0
- package/dist/parallax/parallaxMath.js +27 -0
- package/dist/parallax/parallaxMath.js.map +1 -0
- package/dist/particles/Emitter.js +108 -0
- package/dist/particles/Emitter.js.map +1 -0
- package/dist/particles/ParticleBudget.js +32 -0
- package/dist/particles/ParticleBudget.js.map +1 -0
- package/dist/particles/ParticleSim.js +60 -0
- package/dist/particles/ParticleSim.js.map +1 -0
- package/dist/particles/particleCurves.js +48 -0
- package/dist/particles/particleCurves.js.map +1 -0
- package/dist/particles/particleSampling.js +30 -0
- package/dist/particles/particleSampling.js.map +1 -0
- package/dist/physics/Body.js +202 -0
- package/dist/physics/Body.js.map +1 -0
- package/dist/physics/BroadPhase.js +56 -0
- package/dist/physics/BroadPhase.js.map +1 -0
- package/dist/physics/Contact.js +76 -0
- package/dist/physics/Contact.js.map +1 -0
- package/dist/physics/ContactSolver.js +70 -0
- package/dist/physics/ContactSolver.js.map +1 -0
- package/dist/physics/PhysicsWorld.js +221 -0
- package/dist/physics/PhysicsWorld.js.map +1 -0
- package/dist/physics/SpatialHash.js +39 -0
- package/dist/physics/SpatialHash.js.map +1 -0
- package/dist/physics/collide.js +76 -0
- package/dist/physics/collide.js.map +1 -0
- package/dist/physics/collidePolygon.js +94 -0
- package/dist/physics/collidePolygon.js.map +1 -0
- package/dist/physics/contactReport.js +14 -0
- package/dist/physics/contactReport.js.map +1 -0
- package/dist/physics/drawColliders.js +31 -0
- package/dist/physics/drawColliders.js.map +1 -0
- package/dist/physics/physicsSystem.js +8 -0
- package/dist/physics/physicsSystem.js.map +1 -0
- package/dist/physics/polygon.js +80 -0
- package/dist/physics/polygon.js.map +1 -0
- package/dist/physics/raycast.js +62 -0
- package/dist/physics/raycast.js.map +1 -0
- package/dist/physics/syncToBody.js +19 -0
- package/dist/physics/syncToBody.js.map +1 -0
- package/dist/physics/tileBodies.js +59 -0
- package/dist/physics/tileBodies.js.map +1 -0
- package/dist/physics/types.js +8 -0
- package/dist/physics/types.js.map +1 -0
- package/dist/pixel/Darkness.js +166 -0
- package/dist/pixel/Darkness.js.map +1 -0
- package/dist/pixel/DitherVignette.js +57 -0
- package/dist/pixel/DitherVignette.js.map +1 -0
- package/dist/pixel/Evaporation.js +85 -0
- package/dist/pixel/Evaporation.js.map +1 -0
- package/dist/pixel/NightShade.js +34 -0
- package/dist/pixel/NightShade.js.map +1 -0
- package/dist/pixel/PixelLayer.js +211 -0
- package/dist/pixel/PixelLayer.js.map +1 -0
- package/dist/pixel/SwayProp.js +75 -0
- package/dist/pixel/SwayProp.js.map +1 -0
- package/dist/pixel/lights.js +44 -0
- package/dist/pixel/lights.js.map +1 -0
- package/dist/pixel/nineSlice.js +62 -0
- package/dist/pixel/nineSlice.js.map +1 -0
- package/dist/pixel/paintLayer.js +36 -0
- package/dist/pixel/paintLayer.js.map +1 -0
- package/dist/pixel/palette.js +57 -0
- package/dist/pixel/palette.js.map +1 -0
- package/dist/pixel/pixel.js +278 -0
- package/dist/pixel/pixel.js.map +1 -0
- package/dist/pixel/pixelPaint.js +194 -0
- package/dist/pixel/pixelPaint.js.map +1 -0
- package/dist/pixel/pixelTone.js +164 -0
- package/dist/pixel/pixelTone.js.map +1 -0
- package/dist/pixel/propKit.js +41 -0
- package/dist/pixel/propKit.js.map +1 -0
- package/dist/pixel/ramp.js +102 -0
- package/dist/pixel/ramp.js.map +1 -0
- package/dist/pixel/selout.js +35 -0
- package/dist/pixel/selout.js.map +1 -0
- package/dist/pixel/spritePixels.js +59 -0
- package/dist/pixel/spritePixels.js.map +1 -0
- package/dist/pixel/swayRig.js +87 -0
- package/dist/pixel/swayRig.js.map +1 -0
- package/dist/pixel/vignetteMask.js +24 -0
- package/dist/pixel/vignetteMask.js.map +1 -0
- package/dist/pixel/weatherArt.js +61 -0
- package/dist/pixel/weatherArt.js.map +1 -0
- package/dist/pixel.js +90 -0
- package/dist/pixel.js.map +1 -0
- package/dist/platform/touch.js +33 -0
- package/dist/platform/touch.js.map +1 -0
- package/dist/postfx/BloomFilter.js +65 -0
- package/dist/postfx/BloomFilter.js.map +1 -0
- package/dist/postfx/ChromaticAberrationFilter.js +25 -0
- package/dist/postfx/ChromaticAberrationFilter.js.map +1 -0
- package/dist/postfx/ColorAdjustFilter.js +76 -0
- package/dist/postfx/ColorAdjustFilter.js.map +1 -0
- package/dist/postfx/CrtFilter.js +42 -0
- package/dist/postfx/CrtFilter.js.map +1 -0
- package/dist/postfx/PixelateFilter.js +27 -0
- package/dist/postfx/PixelateFilter.js.map +1 -0
- package/dist/postfx/PostFx.js +123 -0
- package/dist/postfx/PostFx.js.map +1 -0
- package/dist/postfx/ShockwaveFilter.js +49 -0
- package/dist/postfx/ShockwaveFilter.js.map +1 -0
- package/dist/postfx/VignetteFilter.js +37 -0
- package/dist/postfx/VignetteFilter.js.map +1 -0
- package/dist/postfx/fxAnimator.js +38 -0
- package/dist/postfx/fxAnimator.js.map +1 -0
- package/dist/postfx/fxShader.js +128 -0
- package/dist/postfx/fxShader.js.map +1 -0
- package/dist/postfx.js +26 -0
- package/dist/postfx.js.map +1 -0
- package/dist/react/ChoiceDialog.js +51 -0
- package/dist/react/ChoiceDialog.js.map +1 -0
- package/dist/react/ConfirmDialog.js +53 -0
- package/dist/react/ConfirmDialog.js.map +1 -0
- package/dist/react/Glyph.js +63 -0
- package/dist/react/Glyph.js.map +1 -0
- package/dist/react/Modal.js +38 -0
- package/dist/react/Modal.js.map +1 -0
- package/dist/react/Panel.js +24 -0
- package/dist/react/Panel.js.map +1 -0
- package/dist/react/PixelImage.js +24 -0
- package/dist/react/PixelImage.js.map +1 -0
- package/dist/react/Select.js +99 -0
- package/dist/react/Select.js.map +1 -0
- package/dist/react/Slider.js +62 -0
- package/dist/react/Slider.js.map +1 -0
- package/dist/react/SplitPane.js +24 -0
- package/dist/react/SplitPane.js.map +1 -0
- package/dist/react/TabStrip.js +32 -0
- package/dist/react/TabStrip.js.map +1 -0
- package/dist/react/TitleTips.js +42 -0
- package/dist/react/TitleTips.js.map +1 -0
- package/dist/react/Tooltip.js +28 -0
- package/dist/react/Tooltip.js.map +1 -0
- package/dist/react/UiProvider.js +50 -0
- package/dist/react/UiProvider.js.map +1 -0
- package/dist/react/baseCss.js +222 -0
- package/dist/react/baseCss.js.map +1 -0
- package/dist/react/choiceStore.js +23 -0
- package/dist/react/choiceStore.js.map +1 -0
- package/dist/react/classNames.js +19 -0
- package/dist/react/classNames.js.map +1 -0
- package/dist/react/confirmStore.js +30 -0
- package/dist/react/confirmStore.js.map +1 -0
- package/dist/react/labels.js +18 -0
- package/dist/react/labels.js.map +1 -0
- package/dist/react/placement.js +49 -0
- package/dist/react/placement.js.map +1 -0
- package/dist/react/useFillSheet.js +23 -0
- package/dist/react/useFillSheet.js.map +1 -0
- package/dist/react/useFitToViewport.js +29 -0
- package/dist/react/useFitToViewport.js.map +1 -0
- package/dist/react/usePicked.js +13 -0
- package/dist/react/usePicked.js.map +1 -0
- package/dist/react/useStore.js +9 -0
- package/dist/react/useStore.js.map +1 -0
- package/dist/react/useViewport.js +17 -0
- package/dist/react/useViewport.js.map +1 -0
- package/dist/react.js +78 -0
- package/dist/react.js.map +1 -0
- package/dist/rig/PosePlayer.js +92 -0
- package/dist/rig/PosePlayer.js.map +1 -0
- package/dist/rig/RigView.js +125 -0
- package/dist/rig/RigView.js.map +1 -0
- package/dist/rig/Skeleton.js +31 -0
- package/dist/rig/Skeleton.js.map +1 -0
- package/dist/rig/humanoid.js +6 -0
- package/dist/rig/humanoid.js.map +1 -0
- package/dist/rig/humanoid.json.js +30 -0
- package/dist/rig/humanoid.json.js.map +1 -0
- package/dist/rig/humanoidPoses.js +30 -0
- package/dist/rig/humanoidPoses.js.map +1 -0
- package/dist/rig/poseMath.js +54 -0
- package/dist/rig/poseMath.js.map +1 -0
- package/dist/rig/poses.json.js +150 -0
- package/dist/rig/poses.json.js.map +1 -0
- package/dist/save/Autosaver.js +54 -0
- package/dist/save/Autosaver.js.map +1 -0
- package/dist/save/MemoryBackend.js +19 -0
- package/dist/save/MemoryBackend.js.map +1 -0
- package/dist/save/SaveStore.js +103 -0
- package/dist/save/SaveStore.js.map +1 -0
- package/dist/save/WebStorageBackend.js +27 -0
- package/dist/save/WebStorageBackend.js.map +1 -0
- package/dist/save/checksum.js +10 -0
- package/dist/save/checksum.js.map +1 -0
- package/dist/save/migrateSave.js +27 -0
- package/dist/save/migrateSave.js.map +1 -0
- package/dist/settings.js +27 -0
- package/dist/settings.js.map +1 -0
- package/dist/tilemap/TilemapView.js +69 -0
- package/dist/tilemap/TilemapView.js.map +1 -0
- package/dist/tilemap/collision.js +25 -0
- package/dist/tilemap/collision.js.map +1 -0
- package/dist/tilemap/tiled.js +138 -0
- package/dist/tilemap/tiled.js.map +1 -0
- package/dist/transitions/CrossfadeTransition.js +24 -0
- package/dist/transitions/CrossfadeTransition.js.map +1 -0
- package/dist/transitions/DitherWipeTransition.js +70 -0
- package/dist/transitions/DitherWipeTransition.js.map +1 -0
- package/dist/transitions/FadeTransition.js +34 -0
- package/dist/transitions/FadeTransition.js.map +1 -0
- package/dist/transitions/Letterbox.js +42 -0
- package/dist/transitions/Letterbox.js.map +1 -0
- package/dist/transitions/ditherMask.js +15 -0
- package/dist/transitions/ditherMask.js.map +1 -0
- package/dist/transitions/transitionTo.js +28 -0
- package/dist/transitions/transitionTo.js.map +1 -0
- package/dist/transitions/tweenDone.js +15 -0
- package/dist/transitions/tweenDone.js.map +1 -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 +85 -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/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 +42 -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 +11 -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 +27 -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 +51 -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/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/pixiPatches.d.ts +9 -0
- package/dist/types/core/pixiPatches.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 +80 -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/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/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 +149 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/input/Actions.d.ts +94 -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/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 +66 -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 +24 -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/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 +78 -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/SwayProp.d.ts +52 -0
- package/dist/types/pixel/SwayProp.d.ts.map +1 -0
- package/dist/types/pixel/index.d.ts +31 -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 +43 -0
- package/dist/types/pixel/pixelPaint.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/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 +38 -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/ui/Bar.js +54 -0
- package/dist/ui/Bar.js.map +1 -0
- package/dist/ui/Button.js +58 -0
- package/dist/ui/Button.js.map +1 -0
- package/dist/ui/Dialog.js +56 -0
- package/dist/ui/Dialog.js.map +1 -0
- package/dist/ui/FocusManager.js +97 -0
- package/dist/ui/FocusManager.js.map +1 -0
- package/dist/ui/Label.js +36 -0
- package/dist/ui/Label.js.map +1 -0
- package/dist/ui/List.js +45 -0
- package/dist/ui/List.js.map +1 -0
- package/dist/ui/Panel.js +38 -0
- package/dist/ui/Panel.js.map +1 -0
- package/dist/ui/ScrollView.js +96 -0
- package/dist/ui/ScrollView.js.map +1 -0
- package/dist/ui/Slider.js +55 -0
- package/dist/ui/Slider.js.map +1 -0
- package/dist/ui/Stack.js +28 -0
- package/dist/ui/Stack.js.map +1 -0
- package/dist/ui/Toggle.js +37 -0
- package/dist/ui/Toggle.js.map +1 -0
- package/dist/ui/UiHost.js +9 -0
- package/dist/ui/UiHost.js.map +1 -0
- package/dist/ui/UiPointerGate.js +25 -0
- package/dist/ui/UiPointerGate.js.map +1 -0
- package/dist/ui/UiRoot.js +93 -0
- package/dist/ui/UiRoot.js.map +1 -0
- package/dist/ui/Widget.js +90 -0
- package/dist/ui/Widget.js.map +1 -0
- package/dist/ui/dom/DomOverlay.js +59 -0
- package/dist/ui/dom/DomOverlay.js.map +1 -0
- package/dist/ui/dom/DomWorldAnchors.js +59 -0
- package/dist/ui/dom/DomWorldAnchors.js.map +1 -0
- package/dist/ui/dom/InputShield.js +27 -0
- package/dist/ui/dom/InputShield.js.map +1 -0
- package/dist/ui/dom/createStore.js +42 -0
- package/dist/ui/dom/createStore.js.map +1 -0
- package/dist/ui/dom/shieldDecision.js +36 -0
- package/dist/ui/dom/shieldDecision.js.map +1 -0
- package/dist/ui/dom/worldToScreen.js +11 -0
- package/dist/ui/dom/worldToScreen.js.map +1 -0
- package/dist/ui/layout/anchor.js +20 -0
- package/dist/ui/layout/anchor.js.map +1 -0
- package/dist/ui/layout/barDrain.js +25 -0
- package/dist/ui/layout/barDrain.js.map +1 -0
- package/dist/ui/layout/fitToViewport.js +17 -0
- package/dist/ui/layout/fitToViewport.js.map +1 -0
- package/dist/ui/layout/focusNav.js +42 -0
- package/dist/ui/layout/focusNav.js.map +1 -0
- package/dist/ui/layout/geometry.js +21 -0
- package/dist/ui/layout/geometry.js.map +1 -0
- package/dist/ui/layout/listWidth.js +10 -0
- package/dist/ui/layout/listWidth.js.map +1 -0
- package/dist/ui/layout/placeTooltip.js +28 -0
- package/dist/ui/layout/placeTooltip.js.map +1 -0
- package/dist/ui/layout/scroll.js +24 -0
- package/dist/ui/layout/scroll.js.map +1 -0
- package/dist/ui/layout/slider.js +20 -0
- package/dist/ui/layout/slider.js.map +1 -0
- package/dist/ui/layout/stack.js +27 -0
- package/dist/ui/layout/stack.js.map +1 -0
- package/dist/ui/layout/wrapRow.js +13 -0
- package/dist/ui/layout/wrapRow.js.map +1 -0
- package/dist/ui.js +85 -0
- package/dist/ui.js.map +1 -0
- package/package.json +115 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwayProp.js","sources":["../../src/pixel/SwayProp.ts"],"sourcesContent":["import { Rectangle, Sprite, Texture, type TextureSource } from 'pixi.js';\nimport type { Image } from '../core/Image';\nimport { buildRig, gustAt, swayOffset, type Rect, type SwayDef, type SwayRig } from './swayRig';\n\n/** Sub-textures, one per (frame, rect), shared by every prop cut from the same source. */\nconst SLICES = new WeakMap<TextureSource, Map<string, Texture>>();\n\nfunction slice(frame: Texture, r: Rect): Texture {\n let cache = SLICES.get(frame.source);\n if (!cache) SLICES.set(frame.source, (cache = new Map()));\n const f = frame.frame;\n const k = `${f.x + r.x},${f.y + r.y},${r.w},${r.h}`;\n let t = cache.get(k);\n if (!t) cache.set(k, (t = new Texture({ source: frame.source, frame: new Rectangle(f.x + r.x, f.y + r.y, r.w, r.h) })));\n return t;\n}\n\n/**\n * The opaque width of each row of a frame, read once off its canvas (a `crown` finds its trunk in them); undefined\n * when the source is not a 2D canvas. The atlas pages are canvases kept on the CPU, so this costs no GPU read-back.\n */\nexport function opaqueRowWidths(frame: Texture): number[] | undefined {\n const canvas = frame.source.resource as HTMLCanvasElement | undefined;\n const ctx = canvas?.getContext?.('2d');\n if (!ctx) return undefined;\n const { x, y, width: w, height: h } = frame.frame;\n const data = ctx.getImageData(x, y, w, h).data;\n const out: number[] = [];\n for (let row = 0; row < h; row++) {\n let l = -1;\n let r = -1;\n for (let col = 0; col < w; col++)\n if (data[(row * w + col) * 4 + 3]! > 0) {\n if (l < 0) l = col;\n r = col;\n }\n out.push(l < 0 ? 0 : r - l + 1);\n }\n return out;\n}\n\nexport interface SwayPropOptions {\n /** Which `tufts` list to read (default 0). */\n variant?: number;\n /** This prop's place in the cycle, 0..1 (`tileHash` of its tile keeps it from one visit to the next). */\n phase?: number;\n /** Its pace against the def's `speed` (default 1): a little apart per prop, so a wood never sways in step. */\n pace?: number;\n /** Row widths for a `crown` (default: read off the frame with `opaqueRowWidths`). */\n rowWidths?: readonly number[];\n /** A rig already built for this frame (props of one frame share one). */\n rig?: SwayRig;\n}\n\nexport interface SwayWind {\n /** 0 still … 1 a full wind. */\n wind: number;\n /** A gust's period (s) and wavelength across the world (px); see `gustAt`. */\n gustSeconds: number;\n gustPx: number;\n /** The least reach while any wind blows (`swayOffset`). */\n minReach?: number;\n}\n\n/**\n * One sprite swaying in the wind, in whole world pixels. The placed image becomes the rig's first (largest) still\n * piece — so whatever culls, fades or sorts it keeps working — and the other pieces and the strips are sprites beside\n * it in the same parent, at its depth, following its visibility and alpha. A strip's sprite is moved only when its\n * whole-pixel offset changes.\n */\nexport class SwayProp {\n private readonly parts: Sprite[] = [];\n private readonly strips: { sprite: Sprite; homeX: number; weight: number; lag: number; offset: number }[] = [];\n private readonly phase: number;\n private readonly speed: number;\n private shown: boolean;\n private alpha: number;\n /** False when the frame is too small or the rig has nothing to move: `update` then does nothing. */\n readonly active: boolean;\n\n constructor(\n private readonly img: Image,\n private readonly def: SwayDef,\n options: SwayPropOptions = {},\n ) {\n this.phase = options.phase ?? 0;\n this.speed = def.speed * (options.pace ?? 1);\n this.shown = img.visible;\n this.alpha = img.alpha;\n const frame = img.texture;\n const w = frame.frame.width;\n const h = frame.frame.height;\n const parent = img.parent;\n const rig =\n options.rig ?? (w >= 2 && h >= 2 ? buildRig(def, w, h, def.mode === 'crown' ? (options.rowWidths ?? opaqueRowWidths(frame)) : undefined, options.variant ?? 0) : null);\n this.active = !!rig && !!parent && rig.pieces.length > 0 && rig.strips.length > 0;\n if (!this.active || !rig || !parent) return;\n const ax = img.anchor.x * w;\n const ay = img.anchor.y * h;\n const left = Math.round(img.x - ax);\n const top = Math.round(img.y - ay);\n const [first, ...rest] = rig.pieces;\n img.texture = slice(frame, first!);\n img.anchor.set((ax - first!.x) / first!.w, (ay - first!.y) / first!.h);\n const add = (r: Rect): Sprite => {\n const s = new Sprite(slice(frame, r));\n s.position.set(left + r.x, top + r.y);\n s.zIndex = img.zIndex;\n s.visible = img.visible;\n s.alpha = img.alpha;\n parent.addChild(s);\n this.parts.push(s);\n return s;\n };\n for (const r of rest) add(r);\n for (const st of rig.strips) this.strips.push({ sprite: add(st.rect), homeX: left + st.rect.x, weight: st.weight, lag: st.lag, offset: 0 });\n }\n\n /** `tSec` seconds of any steady clock; `enabled` false stands everything still (an ambient-effects setting). */\n update(tSec: number, air: SwayWind, enabled = true): void {\n if (!this.active) return;\n const shown = this.img.visible;\n if (shown !== this.shown) {\n this.shown = shown;\n for (const p of this.parts) p.visible = shown;\n }\n if (!shown) return;\n if (this.img.alpha !== this.alpha) {\n this.alpha = this.img.alpha;\n for (const p of this.parts) p.alpha = this.alpha;\n }\n const still = !enabled || air.wind <= 0;\n const gust = still ? 0 : gustAt(tSec, this.img.x, air.gustSeconds, air.gustPx);\n for (const st of this.strips) {\n const off = still ? 0 : swayOffset(tSec, this.speed, this.phase, st.lag, this.def.amp, air.wind, gust, st.weight, air.minReach ?? 0);\n if (off === st.offset) continue;\n st.offset = off;\n st.sprite.x = st.homeX + off;\n }\n }\n\n destroy(): void {\n for (const p of this.parts) p.destroy();\n this.parts.length = 0;\n this.strips.length = 0;\n }\n}\n"],"names":["SLICES","slice","frame","r","cache","f","k","t","Texture","Rectangle","opaqueRowWidths","ctx","x","y","w","h","data","out","row","l","col","SwayProp","img","def","options","parent","rig","buildRig","ax","ay","left","top","first","rest","add","s","Sprite","st","tSec","air","enabled","shown","p","still","gust","gustAt","off","swayOffset"],"mappings":";;AAKA,MAAMA,wBAAa,QAAA;AAEnB,SAASC,EAAMC,GAAgBC,GAAkB;AAC/C,MAAIC,IAAQJ,EAAO,IAAIE,EAAM,MAAM;AACnC,EAAKE,KAAOJ,EAAO,IAAIE,EAAM,QAASE,IAAQ,oBAAI,KAAM;AACxD,QAAMC,IAAIH,EAAM,OACVI,IAAI,GAAGD,EAAE,IAAIF,EAAE,CAAC,IAAIE,EAAE,IAAIF,EAAE,CAAC,IAAIA,EAAE,CAAC,IAAIA,EAAE,CAAC;AACjD,MAAII,IAAIH,EAAM,IAAIE,CAAC;AACnB,SAAKC,KAAGH,EAAM,IAAIE,GAAIC,IAAI,IAAIC,EAAQ,EAAE,QAAQN,EAAM,QAAQ,OAAO,IAAIO,EAAUJ,EAAE,IAAIF,EAAE,GAAGE,EAAE,IAAIF,EAAE,GAAGA,EAAE,GAAGA,EAAE,CAAC,EAAA,CAAG,CAAE,GAC/GI;AACT;AAMO,SAASG,EAAgBR,GAAsC;AAEpE,QAAMS,IADST,EAAM,OAAO,UACR,aAAa,IAAI;AACrC,MAAI,CAACS,EAAK;AACV,QAAM,EAAE,GAAAC,GAAG,GAAAC,GAAG,OAAOC,GAAG,QAAQC,MAAMb,EAAM,OACtCc,IAAOL,EAAI,aAAaC,GAAGC,GAAGC,GAAGC,CAAC,EAAE,MACpCE,IAAgB,CAAA;AACtB,WAASC,IAAM,GAAGA,IAAMH,GAAGG,KAAO;AAChC,QAAIC,IAAI,IACJhB,IAAI;AACR,aAASiB,IAAM,GAAGA,IAAMN,GAAGM;AACzB,MAAIJ,GAAME,IAAMJ,IAAIM,KAAO,IAAI,CAAC,IAAK,MAC/BD,IAAI,MAAGA,IAAIC,IACfjB,IAAIiB;AAER,IAAAH,EAAI,KAAKE,IAAI,IAAI,IAAIhB,IAAIgB,IAAI,CAAC;AAAA,EAChC;AACA,SAAOF;AACT;A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ACnI,MAAIO,MAAQT,EAAG,WACfA,EAAG,SAASS,GACZT,EAAG,OAAO,IAAIA,EAAG,QAAQS;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,UAAgB;AACd,eAAWJ,KAAK,KAAK,MAAO,CAAAA,EAAE,QAAA;AAC9B,SAAK,MAAM,SAAS,GACpB,KAAK,OAAO,SAAS;AAAA,EACvB;AACF;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { engineSettings as l } from "../settings.js";
|
|
2
|
+
const s = 16773320, i = [], c = 48;
|
|
3
|
+
function g(n, o, t, e, f = s, r = performance.now()) {
|
|
4
|
+
i.length >= c && i.shift(), i.push({ x: n, y: o, r: t, born: r, until: r + e, fades: !0, color: f });
|
|
5
|
+
}
|
|
6
|
+
const u = 2e4;
|
|
7
|
+
function p(n, o, t = s, e = performance.now()) {
|
|
8
|
+
const f = n(), r = { x: f.x, y: f.y, r: o, born: e, until: e + u, follow: n, fades: !1, color: t };
|
|
9
|
+
return i.length >= c && i.shift(), i.push(r), { end: () => r.until = 0 };
|
|
10
|
+
}
|
|
11
|
+
const h = [];
|
|
12
|
+
function d(n) {
|
|
13
|
+
for (let t = i.length - 1; t >= 0; t--) i[t].until <= n && i.splice(t, 1);
|
|
14
|
+
const o = l.getState();
|
|
15
|
+
if (o.combatLights === !1 || o.batterySaver) return h;
|
|
16
|
+
for (const t of i) {
|
|
17
|
+
if (!t.follow) continue;
|
|
18
|
+
let e;
|
|
19
|
+
try {
|
|
20
|
+
e = t.follow();
|
|
21
|
+
} catch {
|
|
22
|
+
t.until = 0, t.follow = void 0;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
t.x = e.x, t.y = e.y;
|
|
26
|
+
}
|
|
27
|
+
return i;
|
|
28
|
+
}
|
|
29
|
+
function m(n, o) {
|
|
30
|
+
if (!n.fades) return n.r;
|
|
31
|
+
const t = Math.min(1, (o - n.born) / Math.max(1, n.until - n.born));
|
|
32
|
+
return n.r * Math.sqrt(1 - t);
|
|
33
|
+
}
|
|
34
|
+
function L() {
|
|
35
|
+
i.length = 0;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
p as carriedLight,
|
|
39
|
+
L as clearLights,
|
|
40
|
+
g as flashLight,
|
|
41
|
+
m as lightRadius,
|
|
42
|
+
d as liveLights
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=lights.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lights.js","sources":["../../src/pixel/lights.ts"],"sourcesContent":["/*\n * Short-lived light: what a fight throws into the dark — a fireball or a bolt in flight, a blast,\n * a blow landing. The map's own darkness (`Darkness`: the underground, a cave, the outdoor night) cuts each\n * one out of its sheet like a lamp, so a spell lights the corridor it flies down. Looks only, client-only; one list\n * for the whole client, since only one map is ever drawn. `engineSettings.combatLights` turns them off, and so does\n * `engineSettings.batterySaver`: the list still keeps time, but nothing reads it, so the dark stays as the map's lamps leave it.\n */\n\nimport { engineSettings } from '../settings';\n\nexport interface TransientLight {\n x: number;\n y: number;\n /** Radius at its brightest, world px. */\n r: number;\n born: number;\n /** When it is gone; a carried light's is pushed to `CARRIED_MAX_MS` and brought in by its `end()`. */\n until: number;\n /** A light riding a moving thing reads its place every frame. */\n follow?: () => { x: number; y: number };\n /** A flash shrinks as it goes out; a carried light keeps its size. */\n fades: boolean;\n /** The colour it lays on what it lights: a fireball's orange, a spell's violet, a blade's white. */\n color: number;\n}\n\n/** A light nobody named a colour for: the pale gold of a spark. */\nconst SPARK = 0xfff0c8;\n\nconst LIGHTS: TransientLight[] = [];\n/** More than this at once adds nothing a player can see, and each is a sprite in the night's redraw. */\nconst MAX_LIGHTS = 48;\n\n/** A flash at (x, y) in `color`: `r` px at once, shrinking to nothing over `ms`. */\nexport function flashLight(x: number, y: number, r: number, ms: number, color = SPARK, now = performance.now()): void {\n if (LIGHTS.length >= MAX_LIGHTS) LIGHTS.shift();\n LIGHTS.push({ x, y, r, born: now, until: now + ms, fades: true, color });\n}\n\n/** The longest a carried light burns when nothing ends it: no shot flies, nor any spell is held, that long. */\nconst CARRIED_MAX_MS = 20_000;\n\n/** A light that rides `at` until `end()` is called (a shot in flight), and never past `CARRIED_MAX_MS`. */\nexport function carriedLight(at: () => { x: number; y: number }, r: number, color = SPARK, now = performance.now()): { end: () => void } {\n const p = at();\n const light: TransientLight = { x: p.x, y: p.y, r, born: now, until: now + CARRIED_MAX_MS, follow: at, fades: false, color };\n if (LIGHTS.length >= MAX_LIGHTS) LIGHTS.shift();\n LIGHTS.push(light);\n return { end: () => (light.until = 0) };\n}\n\nconst NONE: readonly TransientLight[] = [];\n\n/** The lights burning at `now`, each with its radius then; spent ones are dropped. None while combat lights are off. */\nexport function liveLights(now: number): readonly TransientLight[] {\n for (let i = LIGHTS.length - 1; i >= 0; i--) if (LIGHTS[i]!.until <= now) LIGHTS.splice(i, 1);\n const settings = engineSettings.getState();\n // the battery saver puts the transient lights out too: each one redraws the night\n if (settings.combatLights === false || settings.batterySaver) return NONE;\n for (const l of LIGHTS) {\n if (!l.follow) continue;\n // a light whose rider has gone is put out, never left to throw in every frame's night\n let p: { x: number; y: number };\n try {\n p = l.follow();\n } catch {\n l.until = 0;\n l.follow = undefined;\n continue;\n }\n l.x = p.x;\n l.y = p.y;\n }\n return LIGHTS;\n}\n\n/** The radius `l` burns at `now`: a flash eases out from its full size, a carried light holds it. */\nexport function lightRadius(l: TransientLight, now: number): number {\n if (!l.fades) return l.r;\n const t = Math.min(1, (now - l.born) / Math.max(1, l.until - l.born));\n return l.r * Math.sqrt(1 - t);\n}\n\n/** A new map: nothing of the last one's fight is left burning. */\nexport function clearLights(): void {\n LIGHTS.length = 0;\n}\n"],"names":["SPARK","LIGHTS","MAX_LIGHTS","flashLight","x","y","r","ms","color","now","CARRIED_MAX_MS","carriedLight","at","p","light","NONE","liveLights","i","settings","engineSettings","l","lightRadius","clearLights"],"mappings":";AA2BA,MAAMA,IAAQ,UAERC,IAA2B,CAAA,GAE3BC,IA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ClE,MAAI,CAACW,EAAE,MAAO,QAAOA,EAAE;AACvB,QAAM,IAAI,KAAK,IAAI,IAAIX,IAAMW,EAAE,QAAQ,KAAK,IAAI,GAAGA,EAAE,QAAQA,EAAE,IAAI,CAAC;AACpE,SAAOA,EAAE,IAAI,KAAK,KAAK,IAAI,CAAC;AAC9B;AAGO,SAASE,IAAoB;AAClC,EAAArB,EAAO,SAAS;AAClB;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CLEAR as $, channels as m, PixelGrid as p, hex as d } from "./pixel.js";
|
|
2
|
+
const v = {
|
|
3
|
+
/** A window: ink, a two-step brass rim, a gap, a lit bevel, a rivet in the corner. */
|
|
4
|
+
panel: ["..KKKKKK", ".KHHHHHH", "KHHMMMMM", "KHMKGGGG", "KHMGRSSS", "KHMGSFFF", "KHMGSFFF", "KHMGSFFF"],
|
|
5
|
+
/** A raised button: a two-step bevel, notched. Give it shadow [0, 1]; pressed, offset [0, 1] with the bevel's colours swapped. */
|
|
6
|
+
button: [".KKKK", "KHHHH", "KHMMM", "KHMFF", "KHMFF"],
|
|
7
|
+
/** A small raised button. */
|
|
8
|
+
smallButton: [".KKK", "KHHH", "KHMM", "KHMF"],
|
|
9
|
+
/** A text field: a hole in the stone, its lip in shadow top-left (D, G) and lit bottom-right (d, g). */
|
|
10
|
+
field: [".KKKK", "KDDDD", "KDGGG", "KDGFF", "KDGFF"],
|
|
11
|
+
/** A sunk well (slots, bars' tracks). */
|
|
12
|
+
well: [".KK", "KDD", "KDF"],
|
|
13
|
+
/** A list row: a flat slab lit on the top and left. */
|
|
14
|
+
row: [".KK", "KSS", "KSF"],
|
|
15
|
+
/** A thin frame: one pixel of rim (toasts, a cast bar). */
|
|
16
|
+
thin: [".KK", "KHH", "KHF"]
|
|
17
|
+
}, u = { H: "L", S: "s", M: "m", D: "d", G: "g" }, G = (t) => typeof t == "string" ? d(t) : t;
|
|
18
|
+
function x(t, K, l, s, H) {
|
|
19
|
+
const o = t.length, e = o * 2 + 1, i = s > o, r = H > o, M = i ? e - 1 - s : s, F = r ? e - 1 - H : H, w = t[Math.min(F, o - 1)][Math.min(M, o - 1)] ?? ".", h = M >= F, S = i && !h || r && h || i && r, n = l[w];
|
|
20
|
+
return S && n && K[n] !== void 0 ? n : w;
|
|
21
|
+
}
|
|
22
|
+
function y(t) {
|
|
23
|
+
const { corner: K, palette: l } = t, s = K.length;
|
|
24
|
+
if (!s || K.some((n) => n.length !== s)) throw new Error("nineSlice: the corner must be square");
|
|
25
|
+
const H = t.twins ?? u, o = s * 2 + 1, [e, i] = t.shadow ?? [0, 0], [r, M] = t.offset ?? [0, 0], [F, w] = t.pad ?? [e, i], h = new p(o + F, o + w), S = t.shadowColor ?? l.Z ?? 2348810240;
|
|
26
|
+
if (e || i) {
|
|
27
|
+
const n = G(S);
|
|
28
|
+
for (let c = 0; c < o; c++) for (let f = 0; f < o; f++) x(K, l, H, f, c) !== "." && h.px(f + e, c + i, n);
|
|
29
|
+
}
|
|
30
|
+
for (let n = 0; n < o; n++)
|
|
31
|
+
for (let c = 0; c < o; c++) {
|
|
32
|
+
const f = t.overlay?.[n]?.[c], a = f && f !== "." ? f : x(K, l, H, c, n), g = l[a];
|
|
33
|
+
a !== "." && g !== void 0 && h.px(c + r, n + M, G(g));
|
|
34
|
+
}
|
|
35
|
+
return { grid: h, insets: { top: s, left: s, right: s + F, bottom: s + w } };
|
|
36
|
+
}
|
|
37
|
+
function E(t, K = 2) {
|
|
38
|
+
const l = [];
|
|
39
|
+
for (let o = 0; o < t.h; o++) {
|
|
40
|
+
let e = 0;
|
|
41
|
+
for (; e < t.w; ) {
|
|
42
|
+
const i = t.get(e, o);
|
|
43
|
+
let r = e + 1;
|
|
44
|
+
for (; r < t.w && t.get(r, o) === i; ) r++;
|
|
45
|
+
if (i !== $ && i >>> 24 > 0) {
|
|
46
|
+
const [M, F, w, h] = m(i), S = `#${(M << 16 | F << 8 | w).toString(16).padStart(6, "0")}`, n = h < 255 ? ` fill-opacity="${+(h / 255).toFixed(3)}"` : "";
|
|
47
|
+
l.push(`<rect x="${e * K}" y="${o * K}" width="${(r - e) * K}" height="${K}" fill="${S}"${n}/>`);
|
|
48
|
+
}
|
|
49
|
+
e = r;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const s = t.w * K, H = t.h * K;
|
|
53
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${H}" viewBox="0 0 ${s} ${H}" shape-rendering="crispEdges">${l.join("")}</svg>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
v as FRAME_CORNERS,
|
|
58
|
+
u as FRAME_TWINS,
|
|
59
|
+
E as frameSvg,
|
|
60
|
+
y as nineSlice
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=nineSlice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nineSlice.js","sources":["../../src/pixel/nineSlice.ts"],"sourcesContent":["import { CLEAR, PixelGrid, channels, hex, type Color } from './pixel';\n\n/**\n * Pixel-art 9-slice frames for a UI (windows, buttons, fields, wells), built from one drawn corner so the edge is\n * whole pixels instead of CSS gradients and blurred shadows. The corner is ASCII, one letter a role; the other three\n * corners are its mirrors, and on the far side (right and bottom) each role takes its **twin** — a raised frame's lit\n * rim (H) becomes its dark rim (L), a sunk field's shadowed lip (D) its lit one (d) — so light comes from the up-left\n * without drawing four corners. A hard shadow (the frame's own silhouette, shifted) can lie under it.\n *\n * ```ts\n * const frame = nineSlice({ corner: FRAME_CORNERS.panel, palette: { K: '#0b1018', H: '#c9a869', L: '#4a3a24',\n * M: '#8b6e45', G: '#121820', S: '#3c434b', s: '#161b22', F: '#1d242e', R: '#ffe2a0' }, shadow: [2, 2] });\n * frame.grid.toCanvas(); // a canvas for a Pixi NineSliceSprite, with frame.insets\n * frameSvg(frame.grid, 2); // or an SVG for a CSS border-image, sliced at insets × 2\n * ```\n */\n\n/** Ready corners in the roles the default twins know: K ink, H/L lit/dark rim, M/m rim, G/g gap, S/s bevel, F fill, D/d lip, R rivet. */\nexport const FRAME_CORNERS = {\n /** A window: ink, a two-step brass rim, a gap, a lit bevel, a rivet in the corner. */\n panel: ['..KKKKKK', '.KHHHHHH', 'KHHMMMMM', 'KHMKGGGG', 'KHMGRSSS', 'KHMGSFFF', 'KHMGSFFF', 'KHMGSFFF'],\n /** A raised button: a two-step bevel, notched. Give it shadow [0, 1]; pressed, offset [0, 1] with the bevel's colours swapped. */\n button: ['.KKKK', 'KHHHH', 'KHMMM', 'KHMFF', 'KHMFF'],\n /** A small raised button. */\n smallButton: ['.KKK', 'KHHH', 'KHMM', 'KHMF'],\n /** A text field: a hole in the stone, its lip in shadow top-left (D, G) and lit bottom-right (d, g). */\n field: ['.KKKK', 'KDDDD', 'KDGGG', 'KDGFF', 'KDGFF'],\n /** A sunk well (slots, bars' tracks). */\n well: ['.KK', 'KDD', 'KDF'],\n /** A list row: a flat slab lit on the top and left. */\n row: ['.KK', 'KSS', 'KSF'],\n /** A thin frame: one pixel of rim (toasts, a cast bar). */\n thin: ['.KK', 'KHH', 'KHF'],\n} as const satisfies Record<string, readonly string[]>;\n\n/** The role each letter takes on the far side; a palette without the twin keeps the letter. */\nexport const FRAME_TWINS: Readonly<Record<string, string>> = { H: 'L', S: 's', M: 'm', D: 'd', G: 'g' };\n\nexport interface NineSliceSpec {\n /** The top-left corner, square, one letter a role; '.' is nothing. */\n corner: readonly string[];\n /** A colour per letter: a packed `Color` or a CSS hex (`#rgb`, `#rrggbb`, `#rrggbbaa` for see-through fills). */\n palette: Readonly<Record<string, Color | string>>;\n /** Near-side letter → far-side letter (default `FRAME_TWINS`). */\n twins?: Readonly<Record<string, string>>;\n /** The hard shadow's offset in art pixels (default none). */\n shadow?: readonly [number, number];\n /** The shadow's colour (default palette `Z`, else black at 55%). */\n shadowColor?: Color | string;\n /** Moves the frame inside its canvas (a pressed button sits one pixel lower where its shadow was). */\n offset?: readonly [number, number];\n /** Room right and below for the shadow or the offset (default: the shadow). */\n pad?: readonly [number, number];\n /** Rows painted over the frame, the frame's full size ('.' leaves it): a tick in a checkbox. */\n overlay?: readonly string[];\n}\n\n/** How far in from each side the corners reach: the frame's slice lines, in art pixels. */\nexport interface SliceInsets {\n top: number;\n right: number;\n bottom: number;\n left: number;\n}\n\nexport interface NineSlice {\n grid: PixelGrid;\n insets: SliceInsets;\n}\n\nconst toColor = (c: Color | string): Color => (typeof c === 'string' ? hex(c) : c);\n\n/** The frame's letter at (x, y) of the n×n square mirrored out of `corner`, '.' outside it. */\nfunction roleAt(corner: readonly string[], palette: NineSliceSpec['palette'], twins: Readonly<Record<string, string>>, x: number, y: number): string {\n const c = corner.length;\n const n = c * 2 + 1;\n const right = x > c;\n const bottom = y > c;\n const cx = right ? n - 1 - x : x;\n const cy = bottom ? n - 1 - y : y;\n const r = corner[Math.min(cy, c - 1)]![Math.min(cx, c - 1)] ?? '.';\n // which edge the cell belongs to in the corner's own coordinates: above the diagonal the top (or bottom) edge\n const onHorizontal = cx >= cy;\n const far = (right && !onHorizontal) || (bottom && onHorizontal) || (right && bottom);\n const twin = twins[r];\n return far && twin && palette[twin] !== undefined ? twin : r;\n}\n\n/** Builds the frame: a `(2c + 1 + pad)` square-ish grid and its slice insets. */\nexport function nineSlice(spec: NineSliceSpec): NineSlice {\n const { corner, palette } = spec;\n const c = corner.length;\n if (!c || corner.some((row) => row.length !== c)) throw new Error('nineSlice: the corner must be square');\n const twins = spec.twins ?? FRAME_TWINS;\n const n = c * 2 + 1;\n const [sx, sy] = spec.shadow ?? [0, 0];\n const [ox, oy] = spec.offset ?? [0, 0];\n const [px, py] = spec.pad ?? [sx, sy];\n const grid = new PixelGrid(n + px, n + py);\n const shade = spec.shadowColor ?? palette.Z ?? 0x8c000000;\n if (sx || sy) {\n const z = toColor(shade);\n for (let y = 0; y < n; y++) for (let x = 0; x < n; x++) if (roleAt(corner, palette, twins, x, y) !== '.') grid.px(x + sx, y + sy, z);\n }\n for (let y = 0; y < n; y++)\n for (let x = 0; x < n; x++) {\n const over = spec.overlay?.[y]?.[x];\n const r = over && over !== '.' ? over : roleAt(corner, palette, twins, x, y);\n const col = palette[r];\n if (r !== '.' && col !== undefined) grid.px(x + ox, y + oy, toColor(col));\n }\n return { grid, insets: { top: c, left: c, right: c + px, bottom: c + py } };\n}\n\n/**\n * Any pixel grid as an SVG of `scale`-sized squares (`shape-rendering=\"crispEdges\"`), runs of one colour on a row\n * merged into one rect: what a CSS `border-image` takes, sliced at the insets × `scale`.\n */\nexport function frameSvg(grid: PixelGrid, scale = 2): string {\n const rects: string[] = [];\n for (let y = 0; y < grid.h; y++) {\n let x = 0;\n while (x < grid.w) {\n const c = grid.get(x, y);\n let end = x + 1;\n while (end < grid.w && grid.get(end, y) === c) end++;\n if (c !== CLEAR && c >>> 24 > 0) {\n const [r, g, b, a] = channels(c);\n const fill = `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;\n const op = a < 255 ? ` fill-opacity=\"${+(a / 255).toFixed(3)}\"` : '';\n rects.push(`<rect x=\"${x * scale}\" y=\"${y * scale}\" width=\"${(end - x) * scale}\" height=\"${scale}\" fill=\"${fill}\"${op}/>`);\n }\n x = end;\n }\n }\n const w = grid.w * scale;\n const h = grid.h * scale;\n return `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${w}\" height=\"${h}\" viewBox=\"0 0 ${w} ${h}\" shape-rendering=\"crispEdges\">${rects.join('')}</svg>\\n`;\n}\n"],"names":["FRAME_CORNERS","FRAME_TWINS","toColor","c","hex","roleAt","corner","palette","twins","x","y","n","right","bottom","cx","cy","r","onHorizontal","far","twin","nineSlice","spec","row","sx","sy","ox","oy","px","py","grid","PixelGrid","shade","z","over","col","frameSvg","scale","rects","end","CLEAR","g","b","a","channels","fill","op","w","h"],"mappings":";AAkBO,MAAMA,IAAgB;AAAA;AAAA,EAE3B,OAAO,CAAC,YAAY,YAAY,YAAY,YAAY,YAAY,YAAY,YAAY,UAAU;AAAA;AAAA,EA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C/B,QAAID,IAAI;AACR,WAAOA,IAAIoB,EAAK,KAAG;AACjB,YAAM1B,IAAI0B,EAAK,IAAIpB,GAAGC,CAAC;AACvB,UAAI4B,IAAM7B,IAAI;AACd,aAAO6B,IAAMT,EAAK,KAAKA,EAAK,IAAIS,GAAK5B,CAAC,MAAMP,IAAG,CAAAmC;AAC/C,UAAInC,MAAMoC,KAASpC,MAAM,KAAK,GAAG;AAC/B,cAAM,CAACa,GAAGwB,GAAGC,GAAGC,CAAC,IAAIC,EAASxC,CAAC,GACzByC,IAAO,KAAM5B,KAAK,KAAOwB,KAAK,IAAKC,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,IACnEI,IAAKH,IAAI,MAAM,kBAAkB,EAAEA,IAAI,KAAK,QAAQ,CAAC,CAAC,MAAM;AAClE,QAAAL,EAAM,KAAK,YAAY5B,IAAI2B,CAAK,QAAQ1B,IAAI0B,CAAK,aAAaE,IAAM7B,KAAK2B,CAAK,aAAaA,CAAK,WAAWQ,CAAI,IAAIC,CAAE,IAAI;AAAA,MAC3H;AACA,MAAApC,IAAI6B;AAAA,IACN;AAAA,EACF;AACA,QAAMQ,IAAIjB,EAAK,IAAIO,GACbW,IAAIlB,EAAK,IAAIO;AACnB,SAAO,kDAAkDU,CAAC,aAAaC,CAAC,kBAAkBD,CAAC,IAAIC,CAAC,kCAAkCV,EAAM,KAAK,EAAE,CAAC;AAAA;AAClJ;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { inView as C } from "../fx/viewCull.js";
|
|
2
|
+
import { addPixelLayer as w } from "./PixelLayer.js";
|
|
3
|
+
import { setCoverage as M, beginBatch as R, endBatch as U } from "./pixelTone.js";
|
|
4
|
+
const _ = 64, b = 192;
|
|
5
|
+
function O(o, a) {
|
|
6
|
+
const { at: v, duration: n, paint: x, alive: f } = a, s = a.depth ?? ((t) => t + 45), h = 1e3 / (a.fps ?? 12), l = a.every ?? 1, c = Math.min(a.fadeMs ?? 260, n * 0.3), e = w(o);
|
|
7
|
+
a.onCreate?.(e);
|
|
8
|
+
const y = { elapsed: 0 };
|
|
9
|
+
let i = -1, p = b;
|
|
10
|
+
const d = o.cameras.main, u = () => {
|
|
11
|
+
if (f && !f()) {
|
|
12
|
+
e.destroy();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const t = v();
|
|
16
|
+
e.setPosition(d.snap(t.x), d.snap(t.y)).setDepth(typeof s == "number" ? s : s(t.y));
|
|
17
|
+
let r = Math.floor(y.elapsed / h);
|
|
18
|
+
if (l > 1 && (r -= r % l), r === i || i >= 0 && !C(d, t.x, t.y, _ + Math.max(p, e.reach()))) return;
|
|
19
|
+
i = r, e.clear();
|
|
20
|
+
const m = Math.min(n, r * h);
|
|
21
|
+
M(c > 0 && m > n - c ? Math.max(0, (n - m) / c) * 0.85 + 0.15 : 1), R(e);
|
|
22
|
+
try {
|
|
23
|
+
x(e, m);
|
|
24
|
+
} finally {
|
|
25
|
+
U(), M(1);
|
|
26
|
+
}
|
|
27
|
+
e.present(), p = Math.max(p, e.reach());
|
|
28
|
+
};
|
|
29
|
+
if (u(), !e.active) return e;
|
|
30
|
+
const L = o.tweens.add({ targets: y, elapsed: n, duration: n, onUpdate: u, onComplete: () => e.destroy() });
|
|
31
|
+
return e.once("destroyed", () => L.remove()), e;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
O as paintLayer
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=paintLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paintLayer.js","sources":["../../src/pixel/paintLayer.ts"],"sourcesContent":["import type { Graphics } from '../core/Graphics';\nimport type { Stage } from '../core/Stage';\nimport { inView } from '../fx/viewCull';\nimport { addPixelLayer, type PixelLayer } from './PixelLayer';\nimport type { Point } from './pixelPaint';\nimport { beginBatch, endBatch, setCoverage } from './pixelTone';\n\nexport interface PaintLayerOptions {\n /** Where the layer stands (world px), read every frame: a caster, a projectile, a fixed point. */\n at: () => Point;\n /** How long it plays (ms); its last `fadeMs` dither away instead of popping out. */\n duration: number;\n /** Paints one frame `ms` into the effect, in pixels relative to the anchor. */\n paint: (g: Graphics, ms: number) => void;\n /**\n * Its draw order from the anchor's y (`y => y + 45` puts it in front of a body standing there, a negative offset\n * behind it), or a fixed number (an effect lying on the ground under every body). Default `y + 45`.\n */\n depth?: number | ((y: number) => number);\n /** Returning false removes the layer early (its caster gone, its trap sprung). */\n alive?: () => boolean;\n /** Frames a second it is redrawn at (default 12: hand-animated, like the sprites). */\n fps?: number;\n /** Paint only every that many frames (an effect thinned out for performance). Default 1. */\n every?: number;\n /** The longest fade at the end (ms); it is never more than 30% of the effect. Default 260. */\n fadeMs?: number;\n /** Told of the layer as it is made (a game that clears its transient effects on a map change keeps it). */\n onCreate?: (g: PixelLayer) => void;\n}\n\n/** How far outside the screen a layer's anchor may stand and still be painted, beyond what it has reached so far. */\nconst CULL_MARGIN = 64;\n/**\n * The reach a layer is culled by is never less than this: an effect that grows (a ring, a blast) paints a small first\n * frame, and culled by that one it would never paint again as it swept onto the screen.\n */\nconst CULL_REACH_FLOOR = 192;\n\n/**\n * One effect as its own `PixelLayer`, redrawn at `fps` and shown as a single texture: it follows its anchor to the\n * screen pixel while the art inside stays on the world grid, thins out pixel by pixel over its last frames (ordered\n * dither, `setCoverage`), is neither painted nor uploaded while its anchor is off the screen by more than it has\n * reached, and is destroyed when it ends, when `alive` says so, or with the stage's tweens.\n */\nexport function paintLayer(stage: Stage, o: PaintLayerOptions): PixelLayer {\n const { at, duration, paint, alive } = o;\n const depth = o.depth ?? ((y: number) => y + 45);\n const frameMs = 1000 / (o.fps ?? 12);\n const every = o.every ?? 1;\n const fadeMs = Math.min(o.fadeMs ?? 260, duration * 0.3);\n const g = addPixelLayer(stage);\n o.onCreate?.(g);\n const clock = { elapsed: 0 };\n let previous = -1;\n let reached = CULL_REACH_FLOOR;\n const cam = stage.cameras.main;\n const update = () => {\n if (alive && !alive()) {\n g.destroy();\n return;\n }\n const p = at();\n g.setPosition(cam.snap(p.x), cam.snap(p.y)).setDepth(typeof depth === 'number' ? depth : depth(p.y));\n let frame = Math.floor(clock.elapsed / frameMs);\n if (every > 1) frame -= frame % every;\n if (frame === previous) return;\n if (previous >= 0 && !inView(cam, p.x, p.y, CULL_MARGIN + Math.max(reached, g.reach()))) return;\n previous = frame;\n g.clear();\n const ms = Math.min(duration, frame * frameMs);\n setCoverage(fadeMs > 0 && ms > duration - fadeMs ? Math.max(0, (duration - ms) / fadeMs) * 0.85 + 0.15 : 1);\n beginBatch(g);\n try {\n paint(g, ms);\n } finally {\n endBatch();\n setCoverage(1);\n }\n g.present();\n reached = Math.max(reached, g.reach());\n };\n update();\n if (!g.active) return g;\n const tween = stage.tweens.add({ targets: clock, elapsed: duration, duration, onUpdate: update, onComplete: () => g.destroy() });\n g.once('destroyed', () => tween.remove());\n return g;\n}\n"],"names":["CULL_MARGIN","CULL_REACH_FLOOR","paintLayer","stage","o","at","duration","paint","alive","depth","y","frameMs","every","fadeMs","g","addPixelLayer","clock","previous","reached","cam","update","p","frame","inView","ms","setCoverage","beginBatch","endBatch","tween"],"mappings":";;;AAgCA,MAAMA,IAAc,IAKdC,IAAmB;AAQlB,SAASC,EAAWC,GAAcC,GAAkC;AACzE,QAAM,EAAE,IAAAC,GAAI,UAAAC,GAAU,OAAAC,GAAO,OAAAC,MAAUJ,GACjCK,IAAQL,EAAE,UAAU,CAACM,MAAcA,IAAI,KACvCC,IAAU,OAAQP,EAAE,OAAO,KAC3BQ,IAAQR,EAAE,SAAS,GACnBS,IAAS,KAAK,IAAIT,EAAE,UAAU,KAAKE,IAAW,GAAG,GACjDQ,IAAIC,EAAcZ,CAAK;AAC7B,EAAAC,EAAE,WAAWU,CAAC;AACd,QAAME,IAAQ,EAAE,SAAS,EAAA;AACzB,MAAIC,IAAW,IACXC,IAAUjB;AACd,QAAMkB,IAAMhB,EAAM,QAAQ,MACpBiB,IAAS,MAAM;AACnB,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r = {
|
|
3
|
+
outline: a("#1a1220"),
|
|
4
|
+
outlineSoft: a("#2e2233"),
|
|
5
|
+
black: a("#0e0b12"),
|
|
6
|
+
white: a("#f4f0e8"),
|
|
7
|
+
offWhite: a("#e2dccf"),
|
|
8
|
+
skin: a("#f2c59a"),
|
|
9
|
+
skinShade: a("#d99d74"),
|
|
10
|
+
skinTan: a("#cf9468"),
|
|
11
|
+
skinTanShade: a("#a86c48"),
|
|
12
|
+
blush: a("#e88c80"),
|
|
13
|
+
hairBlack: a("#2a2230"),
|
|
14
|
+
hairBrown: a("#5b3a29"),
|
|
15
|
+
hairAuburn: a("#7a3b2a"),
|
|
16
|
+
hairWhite: a("#e8e4dc"),
|
|
17
|
+
hairGrey: a("#9a96a0"),
|
|
18
|
+
red: a("#c8373a"),
|
|
19
|
+
redDark: a("#8e2331"),
|
|
20
|
+
crimson: a("#a3243b"),
|
|
21
|
+
orange: a("#e07a36"),
|
|
22
|
+
gold: a("#f2c84b"),
|
|
23
|
+
goldDark: a("#b88a2a"),
|
|
24
|
+
yellow: a("#f5e06a"),
|
|
25
|
+
green: a("#5aa04a"),
|
|
26
|
+
greenDark: a("#2f6b3a"),
|
|
27
|
+
jade: a("#4fbf8f"),
|
|
28
|
+
jadeDark: a("#2d8466"),
|
|
29
|
+
teal: a("#3aa6a0"),
|
|
30
|
+
sky: a("#7ec4f0"),
|
|
31
|
+
azure: a("#4a8ad4"),
|
|
32
|
+
blue: a("#3560b0"),
|
|
33
|
+
navy: a("#27335e"),
|
|
34
|
+
indigo: a("#3b2f6e"),
|
|
35
|
+
purple: a("#7a4bb0"),
|
|
36
|
+
pink: a("#e89aaa"),
|
|
37
|
+
brown: a("#7a5234"),
|
|
38
|
+
brownDark: a("#4e3222"),
|
|
39
|
+
brownLight: a("#a6784a"),
|
|
40
|
+
tan: a("#c9a26e"),
|
|
41
|
+
cream: a("#efe2c0"),
|
|
42
|
+
grey: a("#8a8690"),
|
|
43
|
+
greyDark: a("#57535e"),
|
|
44
|
+
greyLight: a("#bdb9c2"),
|
|
45
|
+
steel: a("#c8d2dc"),
|
|
46
|
+
steelDark: a("#7f8a98"),
|
|
47
|
+
iron: a("#9aa0a8"),
|
|
48
|
+
wood: a("#9a6a3c"),
|
|
49
|
+
woodDark: a("#6a4426"),
|
|
50
|
+
woodLight: a("#bd8c56"),
|
|
51
|
+
straw: a("#d8b060"),
|
|
52
|
+
strawDark: a("#a8823e")
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
r as P
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","sources":["../../src/pixel/palette.ts"],"sourcesContent":["import { hex } from './pixel';\n\n/**\n * The default palette (`PALETTE` from `1681-engine/pixel`): warm fantasy tones, readable on green ground. It is a\n * starting point, not a rule: a game brings its own colours, and the helpers that use one of these (an outline, a\n * shadow) take the colour as a parameter.\n */\nexport const P = {\n outline: hex('#1a1220'),\n outlineSoft: hex('#2e2233'),\n black: hex('#0e0b12'),\n white: hex('#f4f0e8'),\n offWhite: hex('#e2dccf'),\n\n skin: hex('#f2c59a'),\n skinShade: hex('#d99d74'),\n skinTan: hex('#cf9468'),\n skinTanShade: hex('#a86c48'),\n blush: hex('#e88c80'),\n\n hairBlack: hex('#2a2230'),\n hairBrown: hex('#5b3a29'),\n hairAuburn: hex('#7a3b2a'),\n hairWhite: hex('#e8e4dc'),\n hairGrey: hex('#9a96a0'),\n\n red: hex('#c8373a'),\n redDark: hex('#8e2331'),\n crimson: hex('#a3243b'),\n orange: hex('#e07a36'),\n gold: hex('#f2c84b'),\n goldDark: hex('#b88a2a'),\n yellow: hex('#f5e06a'),\n green: hex('#5aa04a'),\n greenDark: hex('#2f6b3a'),\n jade: hex('#4fbf8f'),\n jadeDark: hex('#2d8466'),\n teal: hex('#3aa6a0'),\n sky: hex('#7ec4f0'),\n azure: hex('#4a8ad4'),\n blue: hex('#3560b0'),\n navy: hex('#27335e'),\n indigo: hex('#3b2f6e'),\n purple: hex('#7a4bb0'),\n pink: hex('#e89aaa'),\n brown: hex('#7a5234'),\n brownDark: hex('#4e3222'),\n brownLight: hex('#a6784a'),\n tan: hex('#c9a26e'),\n cream: hex('#efe2c0'),\n grey: hex('#8a8690'),\n greyDark: hex('#57535e'),\n greyLight: hex('#bdb9c2'),\n steel: hex('#c8d2dc'),\n steelDark: hex('#7f8a98'),\n iron: hex('#9aa0a8'),\n wood: hex('#9a6a3c'),\n woodDark: hex('#6a4426'),\n woodLight: hex('#bd8c56'),\n straw: hex('#d8b060'),\n strawDark: hex('#a8823e'),\n} as const;\n"],"names":["P","hex"],"mappings":";AAOO,MAAMA,IAAI;AAAA,EACf,SAASC,EAAI,SAAS;AAAA,EACtB,aAAaA,EAAI,SAAS;AAAA,EAC1B,OAAOA,EAAI,SAAS;AAAA,EACpB,OAAOA,EAAI,SAAS;AAAA,EACpB,UAAUA,EAAI,SAAS;AAAA,EAEvB,MAAMA,EAAI,SAAS;AAAA,EACnB,WAAWA,EAAI,SAAS;AAAA,EACxB,SAASA,EAAI,SAAS;AAAA,EACtB,cAAcA,EAAI,SAAS;AAAA,EAC3B,OAAOA,EAAI,SAAS;AAAA,EAEpB,WAAWA,EAAI,SAAS;AAAA,EACxB,WAAWA,EAAI,SAAS;AAAA,EACxB,YAAYA,EAAI,SAAS;AAAA,EACzB,WAAWA,EAAI,SAAS;AAAA,EACxB,UAAUA,EAAI,SAAS;AAAA,EAEvB,KAAKA,EAAI,SAAS;AAAA,EAClB,SAASA,EAAI,SAAS;AAAA,EACtB,SAASA,EAAI,SAAS;AAAA,EACtB,QAAQA,EAAI,SAAS;AAAA,EACrB,MAAMA,EAAI,SAAS;AAAA,EACnB,UAAUA,EAAI,SAAS;AAAA,EACvB,QAAQA,EAAI,SAAS;AAAA,EACrB,OAAOA,EAAI,SAAS;AAAA,EACpB,WAAWA,EAAI,SAAS;AAAA,EACxB,MAAMA,EAAI,SAAS;AAAA,EACnB,UAAUA,EAAI,SAAS;AAAA,EACvB,MAAMA,EAAI,SAAS;AAAA,EACnB,KAAKA,EAAI,SAAS;AAAA,EAClB,OAAOA,EAAI,SAAS;AAAA,EACpB,MAAMA,EAAI,SAAS;AAAA,EACnB,MAAMA,EAAI,SAAS;AAAA,EACnB,QAAQA,EAAI,SAAS;AAAA,EACrB,QAAQA,EAAI,SAAS;AAAA,EACrB,MAAMA,EAAI,SAAS;AAAA,EACnB,OAAOA,EAAI,SAAS;AAAA,EACpB,WAAWA,EAAI,SAAS;AAAA,EACxB,YAAYA,EAAI,SAAS;AAAA,EACzB,KAAKA,EAAI,SAAS;AAAA,EAClB,OAAOA,EAAI,SAAS;AAAA,EACpB,MAAMA,EAAI,SAAS;AAAA,EACnB,UAAUA,EAAI,SAAS;AAAA,EACvB,WAAWA,EAAI,SAAS;AAAA,EACxB,OAAOA,EAAI,SAAS;AAAA,EACpB,WAAWA,EAAI,SAAS;AAAA,EACxB,MAAMA,EAAI,SAAS;AAAA,EACnB,MAAMA,EAAI,SAAS;AAAA,EACnB,UAAUA,EAAI,SAAS;AAAA,EACvB,WAAWA,EAAI,SAAS;AAAA,EACxB,OAAOA,EAAI,SAAS;AAAA,EACpB,WAAWA,EAAI,SAAS;AAC1B;"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
const D = 0;
|
|
2
|
+
function b(r, t, n, h = 255) {
|
|
3
|
+
const s = Math.max(0, Math.min(255, Math.round(r))), o = Math.max(0, Math.min(255, Math.round(t))), i = Math.max(0, Math.min(255, Math.round(n)));
|
|
4
|
+
return (Math.max(0, Math.min(255, Math.round(h))) << 24 | i << 16 | o << 8 | s) >>> 0;
|
|
5
|
+
}
|
|
6
|
+
function U(r) {
|
|
7
|
+
let t = r.startsWith("#") ? r.slice(1) : r;
|
|
8
|
+
t.length === 3 && (t = [...t].map((i) => i + i).join(""));
|
|
9
|
+
const n = parseInt(t.slice(0, 2), 16), h = parseInt(t.slice(2, 4), 16), s = parseInt(t.slice(4, 6), 16), o = t.length >= 8 ? parseInt(t.slice(6, 8), 16) : 255;
|
|
10
|
+
return b(n, h, s, o);
|
|
11
|
+
}
|
|
12
|
+
function m(r) {
|
|
13
|
+
return [r & 255, r >>> 8 & 255, r >>> 16 & 255, r >>> 24 & 255];
|
|
14
|
+
}
|
|
15
|
+
function B(r, t) {
|
|
16
|
+
const [n, h, s, o] = m(r);
|
|
17
|
+
if (t >= 1) {
|
|
18
|
+
const i = Math.min(1, t - 1);
|
|
19
|
+
return b(n + (255 - n) * i, h + (255 - h) * i, s + (255 - s) * i, o);
|
|
20
|
+
}
|
|
21
|
+
return b(n * t, h * t, s * t, o);
|
|
22
|
+
}
|
|
23
|
+
function L(r, t, n) {
|
|
24
|
+
const h = m(r), s = m(t);
|
|
25
|
+
return b(h[0] + (s[0] - h[0]) * n, h[1] + (s[1] - h[1]) * n, h[2] + (s[2] - h[2]) * n, h[3] + (s[3] - h[3]) * n);
|
|
26
|
+
}
|
|
27
|
+
function R(r, t) {
|
|
28
|
+
const [n, h, s] = m(r);
|
|
29
|
+
return b(n, h, s, t);
|
|
30
|
+
}
|
|
31
|
+
function $(r) {
|
|
32
|
+
const [t, n, h, s] = m(r);
|
|
33
|
+
return `rgba(${t},${n},${h},${(s / 255).toFixed(3)})`;
|
|
34
|
+
}
|
|
35
|
+
function C(r, t, n = 0) {
|
|
36
|
+
let h = r * 374761393 + t * 668265263 + n * 2147483647 | 0;
|
|
37
|
+
return h = Math.imul(h ^ h >>> 13, 1274126177), ((h ^ h >>> 16) >>> 0) / 4294967296;
|
|
38
|
+
}
|
|
39
|
+
function v(r) {
|
|
40
|
+
let t = r >>> 0;
|
|
41
|
+
return () => {
|
|
42
|
+
t = t + 1831565813 >>> 0;
|
|
43
|
+
let n = t;
|
|
44
|
+
return n = Math.imul(n ^ n >>> 15, n | 1), n ^= n + Math.imul(n ^ n >>> 7, n | 61), ((n ^ n >>> 14) >>> 0) / 4294967296;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function S(r, t, n, h) {
|
|
48
|
+
const s = r / n, o = t / n, i = Math.floor(s), e = Math.floor(o), l = s - i, c = o - e, M = l * l * (3 - 2 * l), d = c * c * (3 - 2 * c), w = C(i, e, h), a = C(i + 1, e, h), u = C(i, e + 1, h), f = C(i + 1, e + 1, h);
|
|
49
|
+
return w + (a - w) * M + (u - w) * d + (w - a - u + f) * M * d;
|
|
50
|
+
}
|
|
51
|
+
class A {
|
|
52
|
+
constructor(t, n) {
|
|
53
|
+
this.w = t, this.h = n, this.data = new Uint32Array(t * n);
|
|
54
|
+
}
|
|
55
|
+
w;
|
|
56
|
+
h;
|
|
57
|
+
data;
|
|
58
|
+
inBounds(t, n) {
|
|
59
|
+
return t >= 0 && n >= 0 && t < this.w && n < this.h;
|
|
60
|
+
}
|
|
61
|
+
px(t, n, h) {
|
|
62
|
+
t = Math.floor(t), n = Math.floor(n), t >= 0 && n >= 0 && t < this.w && n < this.h && (this.data[n * this.w + t] = h);
|
|
63
|
+
}
|
|
64
|
+
get(t, n) {
|
|
65
|
+
return t < 0 || n < 0 || t >= this.w || n >= this.h ? 0 : this.data[n * this.w + t] ?? 0;
|
|
66
|
+
}
|
|
67
|
+
alphaAt(t, n) {
|
|
68
|
+
return this.get(t, n) >>> 24;
|
|
69
|
+
}
|
|
70
|
+
rect(t, n, h, s, o) {
|
|
71
|
+
for (let i = Math.floor(n); i < n + s; i++) for (let e = Math.floor(t); e < t + h; e++) this.px(e, i, o);
|
|
72
|
+
}
|
|
73
|
+
hline(t, n, h, s) {
|
|
74
|
+
for (let o = Math.min(t, n); o <= Math.max(t, n); o++) this.px(o, h, s);
|
|
75
|
+
}
|
|
76
|
+
vline(t, n, h, s) {
|
|
77
|
+
for (let o = Math.min(n, h); o <= Math.max(n, h); o++) this.px(t, o, s);
|
|
78
|
+
}
|
|
79
|
+
/** Filled ellipse; a pixel is inside when its center lies inside the ellipse. */
|
|
80
|
+
ellipse(t, n, h, s, o) {
|
|
81
|
+
if (!(h <= 0 || s <= 0))
|
|
82
|
+
for (let i = Math.floor(n - s); i <= Math.ceil(n + s); i++)
|
|
83
|
+
for (let e = Math.floor(t - h); e <= Math.ceil(t + h); e++) {
|
|
84
|
+
const l = (e + 0.5 - t) / h, c = (i + 0.5 - n) / s;
|
|
85
|
+
l * l + c * c <= 1 && this.px(e, i, o);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
circle(t, n, h, s) {
|
|
89
|
+
this.ellipse(t, n, h, h, s);
|
|
90
|
+
}
|
|
91
|
+
ring(t, n, h, s, o) {
|
|
92
|
+
for (let i = Math.floor(n - h - 1); i <= Math.ceil(n + h + 1); i++)
|
|
93
|
+
for (let e = Math.floor(t - h - 1); e <= Math.ceil(t + h + 1); e++) {
|
|
94
|
+
const l = Math.hypot(e + 0.5 - t, i + 0.5 - n);
|
|
95
|
+
l <= h && l >= h - s && this.px(e, i, o);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
line(t, n, h, s, o, i = 1) {
|
|
99
|
+
t = Math.round(t), n = Math.round(n), h = Math.round(h), s = Math.round(s);
|
|
100
|
+
const e = Math.abs(h - t), l = -Math.abs(s - n), c = t < h ? 1 : -1, M = n < s ? 1 : -1;
|
|
101
|
+
let d = e + l;
|
|
102
|
+
for (; i <= 1 ? this.px(t, n, o) : this.rect(t - Math.floor((i - 1) / 2), n - Math.floor((i - 1) / 2), i, i, o), !(t === h && n === s); ) {
|
|
103
|
+
const w = 2 * d;
|
|
104
|
+
w >= l && (d += l, t += c), w <= e && (d += e, n += M);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/** Filled polygon (even-odd scanline on pixel centers). */
|
|
108
|
+
poly(t, n) {
|
|
109
|
+
if (t.length < 3) return;
|
|
110
|
+
const h = Math.floor(Math.min(...t.map((o) => o[1]))), s = Math.ceil(Math.max(...t.map((o) => o[1])));
|
|
111
|
+
for (let o = h; o <= s; o++) {
|
|
112
|
+
const i = o + 0.5, e = [];
|
|
113
|
+
for (let l = 0; l < t.length; l++) {
|
|
114
|
+
const c = t[l], M = t[(l + 1) % t.length];
|
|
115
|
+
(c[1] <= i && M[1] > i || M[1] <= i && c[1] > i) && e.push(c[0] + (i - c[1]) / (M[1] - c[1]) * (M[0] - c[0]));
|
|
116
|
+
}
|
|
117
|
+
e.sort((l, c) => l - c);
|
|
118
|
+
for (let l = 0; l + 1 < e.length; l += 2)
|
|
119
|
+
for (let c = Math.ceil(e[l] - 0.5); c <= Math.floor(e[l + 1] - 0.5); c++) this.px(c, o, n);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Adds `width` pixels of outline around all opaque pixels, one ring at a time — the same result as calling it
|
|
124
|
+
* `width` times, but each ring only visits the neighbours of the ring before it instead of the whole grid again.
|
|
125
|
+
* (A pixel next to ring `k` is always filled by ring `k+1`, so nothing further back can still be waiting.)
|
|
126
|
+
*/
|
|
127
|
+
outline(t, n = !1, h = 1) {
|
|
128
|
+
const s = this.w, o = this.h, i = new Uint8Array(this.data.length);
|
|
129
|
+
let e = s, l = o, c = -1, M = -1;
|
|
130
|
+
for (let a = 0; a < o; a++)
|
|
131
|
+
for (let u = 0; u < s; u++) {
|
|
132
|
+
const f = a * s + u;
|
|
133
|
+
this.data[f] >>> 24 && (i[f] = 1, u < e && (e = u), u > c && (c = u), a < l && (l = a), M = a);
|
|
134
|
+
}
|
|
135
|
+
if (c < 0) return;
|
|
136
|
+
const d = (a, u, f) => a >= 0 && u >= 0 && a < s && u < o && i[f] === 1;
|
|
137
|
+
let w = [];
|
|
138
|
+
for (let a = Math.max(0, l - 1); a <= Math.min(o - 1, M + 1); a++)
|
|
139
|
+
for (let u = Math.max(0, e - 1); u <= Math.min(s - 1, c + 1); u++) {
|
|
140
|
+
const f = a * s + u;
|
|
141
|
+
if (i[f]) continue;
|
|
142
|
+
let g = d(u - 1, a, f - 1) || d(u + 1, a, f + 1) || d(u, a - 1, f - s) || d(u, a + 1, f + s);
|
|
143
|
+
!g && n && (g = d(u - 1, a - 1, f - s - 1) || d(u + 1, a - 1, f - s + 1) || d(u - 1, a + 1, f + s - 1) || d(u + 1, a + 1, f + s + 1)), g && (this.data[f] = t, w.push(f));
|
|
144
|
+
}
|
|
145
|
+
for (const a of w) i[a] = 1;
|
|
146
|
+
for (let a = 1; a < h && w.length; a++) {
|
|
147
|
+
const u = [];
|
|
148
|
+
for (const f of w) {
|
|
149
|
+
const g = f % s, p = f / s | 0, x = (E, I, y) => {
|
|
150
|
+
E < 0 || I < 0 || E >= s || I >= o || i[y] || (i[y] = 1, this.data[y] = t, u.push(y));
|
|
151
|
+
};
|
|
152
|
+
x(g - 1, p, f - 1), x(g + 1, p, f + 1), x(g, p - 1, f - s), x(g, p + 1, f + s), n && (x(g - 1, p - 1, f - s - 1), x(g + 1, p - 1, f - s + 1), x(g - 1, p + 1, f + s - 1), x(g + 1, p + 1, f + s + 1));
|
|
153
|
+
}
|
|
154
|
+
w = u;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** Replaces every pixel whose color matches `from`. */
|
|
158
|
+
recolor(t, n) {
|
|
159
|
+
for (let h = 0; h < this.data.length; h++) this.data[h] === t && (this.data[h] = n);
|
|
160
|
+
}
|
|
161
|
+
/** Multiplies brightness of opaque pixels matching `pred`. */
|
|
162
|
+
tint(t, n) {
|
|
163
|
+
for (let h = 0; h < this.h; h++)
|
|
164
|
+
for (let s = 0; s < this.w; s++) {
|
|
165
|
+
const o = h * this.w + s, i = this.data[o] ?? 0;
|
|
166
|
+
i >>> 24 && n(s, h) && (this.data[o] = B(i, t));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
blit(t, n, h, s = !1) {
|
|
170
|
+
for (let o = 0; o < t.h; o++)
|
|
171
|
+
for (let i = 0; i < t.w; i++) {
|
|
172
|
+
const e = t.data[o * t.w + i] ?? 0;
|
|
173
|
+
e >>> 24 && this.px(n + (s ? t.w - 1 - i : i), h + o, e);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** Alpha-blends a color onto an existing pixel. */
|
|
177
|
+
blend(t, n, h) {
|
|
178
|
+
if (!this.inBounds(t, n)) return;
|
|
179
|
+
const s = n * this.w + t, o = this.data[s] ?? 0, [i, e, l, c] = m(h), M = c / 255, d = m(o);
|
|
180
|
+
this.data[s] = b(d[0] + (i - d[0]) * M, d[1] + (e - d[1]) * M, d[2] + (l - d[2]) * M, Math.max(d[3], c));
|
|
181
|
+
}
|
|
182
|
+
/** Reads a canvas back into a grid (a PNG layer of the paper doll joining the painted ones). */
|
|
183
|
+
static from(t) {
|
|
184
|
+
const n = new A(t.width, t.height), h = t.getContext("2d").getImageData(0, 0, t.width, t.height);
|
|
185
|
+
return n.data.set(new Uint32Array(h.data.buffer, h.data.byteOffset, t.width * t.height)), n;
|
|
186
|
+
}
|
|
187
|
+
/** The same picture on a grid `factor` times as fine, each pixel becoming a square block. */
|
|
188
|
+
upscaled(t) {
|
|
189
|
+
if (t === 1) return this;
|
|
190
|
+
const n = new A(this.w * t, this.h * t);
|
|
191
|
+
for (let h = 0; h < this.h; h++)
|
|
192
|
+
for (let s = 0; s < this.w; s++) {
|
|
193
|
+
const o = this.data[h * this.w + s] ?? 0;
|
|
194
|
+
o >>> 24 && n.rect(s * t, h * t, t, t, o);
|
|
195
|
+
}
|
|
196
|
+
return n;
|
|
197
|
+
}
|
|
198
|
+
/** Same size and same pixels. */
|
|
199
|
+
equals(t) {
|
|
200
|
+
if (t.w !== this.w || t.h !== this.h) return !1;
|
|
201
|
+
for (let n = 0; n < this.data.length; n++) if (this.data[n] !== t.data[n]) return !1;
|
|
202
|
+
return !0;
|
|
203
|
+
}
|
|
204
|
+
/** Cheap hash of the pixels, for grouping identical frames before comparing them. */
|
|
205
|
+
key() {
|
|
206
|
+
let t = 2166136261;
|
|
207
|
+
for (let n = 0; n < this.data.length; n++)
|
|
208
|
+
t ^= this.data[n], t = Math.imul(t, 16777619) >>> 0;
|
|
209
|
+
return t >>> 0;
|
|
210
|
+
}
|
|
211
|
+
clone() {
|
|
212
|
+
const t = new A(this.w, this.h);
|
|
213
|
+
return t.data.set(this.data), t;
|
|
214
|
+
}
|
|
215
|
+
toCanvas() {
|
|
216
|
+
const t = document.createElement("canvas");
|
|
217
|
+
t.width = this.w, t.height = this.h;
|
|
218
|
+
const n = t.getContext("2d");
|
|
219
|
+
if (!n) throw new Error("2D canvas not supported");
|
|
220
|
+
const h = new Uint8ClampedArray(this.w * this.h * 4);
|
|
221
|
+
h.set(new Uint8Array(this.data.buffer, this.data.byteOffset, this.data.byteLength));
|
|
222
|
+
const s = new ImageData(h, this.w, this.h);
|
|
223
|
+
return n.putImageData(s, 0, 0), t;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
class O extends A {
|
|
227
|
+
constructor(t, n, h, s) {
|
|
228
|
+
super(h, s), this.x0 = t, this.y0 = n;
|
|
229
|
+
}
|
|
230
|
+
x0;
|
|
231
|
+
y0;
|
|
232
|
+
inBounds(t, n) {
|
|
233
|
+
return super.inBounds(t - this.x0, n - this.y0);
|
|
234
|
+
}
|
|
235
|
+
px(t, n, h) {
|
|
236
|
+
super.px(Math.floor(t) - this.x0, Math.floor(n) - this.y0, h);
|
|
237
|
+
}
|
|
238
|
+
get(t, n) {
|
|
239
|
+
return super.get(t - this.x0, n - this.y0);
|
|
240
|
+
}
|
|
241
|
+
blend(t, n, h) {
|
|
242
|
+
const s = t - this.x0, o = n - this.y0;
|
|
243
|
+
if (!super.inBounds(s, o)) return;
|
|
244
|
+
const i = o * this.w + s, e = this.data[i] ?? 0, [l, c, M, d] = m(h), w = d / 255, a = m(e);
|
|
245
|
+
this.data[i] = b(a[0] + (l - a[0]) * w, a[1] + (c - a[1]) * w, a[2] + (M - a[2]) * w, Math.max(a[3], d));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function W(r, t = 16384) {
|
|
249
|
+
const n = r[0];
|
|
250
|
+
if (!n) throw new Error("makeSheet: no frames");
|
|
251
|
+
const h = Math.max(1, Math.min(r.length, Math.floor(t / n.w))), s = Math.ceil(r.length / h), o = new A(n.w * h, n.h * s);
|
|
252
|
+
return r.forEach((i, e) => o.blit(i, e % h * n.w, Math.floor(e / h) * n.h)), o.toCanvas();
|
|
253
|
+
}
|
|
254
|
+
function Y(r, t) {
|
|
255
|
+
const n = document.createElement("canvas");
|
|
256
|
+
n.width = r.width * t, n.height = r.height * t;
|
|
257
|
+
const h = n.getContext("2d");
|
|
258
|
+
if (!h) throw new Error("2D canvas not supported");
|
|
259
|
+
return h.imageSmoothingEnabled = !1, h.drawImage(r, 0, 0, n.width, n.height), n;
|
|
260
|
+
}
|
|
261
|
+
export {
|
|
262
|
+
D as CLEAR,
|
|
263
|
+
A as PixelGrid,
|
|
264
|
+
O as PixelWindow,
|
|
265
|
+
m as channels,
|
|
266
|
+
C as hash2,
|
|
267
|
+
U as hex,
|
|
268
|
+
W as makeSheet,
|
|
269
|
+
L as mix,
|
|
270
|
+
v as mulberry32,
|
|
271
|
+
b as rgba,
|
|
272
|
+
B as shade,
|
|
273
|
+
$ as toCss,
|
|
274
|
+
Y as upscale,
|
|
275
|
+
S as valueNoise,
|
|
276
|
+
R as withAlpha
|
|
277
|
+
};
|
|
278
|
+
//# sourceMappingURL=pixel.js.map
|