excalibur 0.33.0-alpha.99 → 1.1.0-alpha.310
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/.nvmrc +1 -1
- package/CHANGELOG.md +206 -5
- package/build/esm/excalibur.development.js +37363 -35202
- package/build/esm/excalibur.js +37363 -35202
- package/build/esm/excalibur.min.development.js +18360 -23963
- package/build/esm/excalibur.min.js +18360 -23963
- package/build/{dist → esm/src/engine}/actions/action/move-by.d.ts +1 -4
- package/build/{dist → esm/src/engine}/actions/action/move-to.d.ts +1 -4
- package/build/{dist → esm/src/engine}/actions/action/repeat-forever.d.ts +8 -0
- package/build/{dist → esm/src/engine}/actions/action/rotate-by.d.ts +9 -3
- package/build/{dist → esm/src/engine}/actions/action-context.d.ts +9 -43
- package/build/{dist → esm/src/engine}/actions/actions-component.d.ts +3 -41
- package/build/{dist → esm/src/engine}/actions/actions-system.d.ts +2 -3
- package/build/{dist → esm/src/engine}/actions/index.d.ts +0 -2
- package/build/{dist → esm/src/engine}/actor.d.ts +19 -30
- package/build/{dist → esm/src/engine}/camera.d.ts +13 -10
- package/build/{dist → esm/src/engine}/collision/body-component.d.ts +11 -20
- package/build/{dist → esm/src/engine}/collision/bounding-box.d.ts +3 -10
- package/build/{dist → esm/src/engine}/collision/collider-component.d.ts +17 -2
- package/build/{dist → esm/src/engine}/collision/colliders/circle-collider.d.ts +8 -0
- package/build/{dist → esm/src/engine}/collision/colliders/closest-line-jump-table.d.ts +1 -1
- package/build/{dist → esm/src/engine}/collision/colliders/collider.d.ts +7 -1
- package/build/{dist/collision/colliders/shape.d.ts → esm/src/engine/collision/colliders/colliders.d.ts} +50 -0
- package/build/{dist → esm/src/engine}/collision/colliders/collision-jump-table.d.ts +2 -1
- package/build/{dist → esm/src/engine}/collision/colliders/edge-collider.d.ts +25 -1
- package/build/{dist → esm/src/engine}/collision/colliders/polygon-collider.d.ts +23 -0
- package/build/esm/src/engine/collision/colliders/sat-shape.d.ts +27 -0
- package/build/{dist → esm/src/engine}/collision/colliders/separating-axis.d.ts +11 -6
- package/build/{dist → esm/src/engine}/collision/collision-system.d.ts +9 -5
- package/build/{dist → esm/src/engine}/collision/detection/collision-contact.d.ts +6 -0
- package/build/{dist → esm/src/engine}/collision/detection/dynamic-tree.d.ts +9 -11
- package/build/{dist → esm/src/engine}/collision/detection/pair.d.ts +9 -0
- package/build/{dist → esm/src/engine}/collision/detection/quad-tree.d.ts +2 -2
- package/build/{dist → esm/src/engine}/collision/detection/sparse-hash-grid-collision-processor.d.ts +7 -2
- package/build/{dist → esm/src/engine}/collision/detection/sparse-hash-grid.d.ts +11 -3
- package/build/{dist → esm/src/engine}/collision/group/collision-group-manager.d.ts +1 -1
- package/build/{dist → esm/src/engine}/collision/index.d.ts +2 -1
- package/build/{dist → esm/src/engine}/collision/motion-system.d.ts +2 -3
- package/build/{dist → esm/src/engine}/collision/physics-config.d.ts +7 -0
- package/build/{dist → esm/src/engine}/collision/physics-world.d.ts +34 -33
- package/build/esm/src/engine/collision/solver/realistic-solver.d.ts +50 -0
- package/build/{dist → esm/src/engine}/collision/solver/solver.d.ts +4 -2
- package/build/{dist → esm/src/engine}/debug/debug-config.d.ts +16 -0
- package/build/{dist → esm/src/engine}/debug/debug-system.d.ts +3 -3
- package/build/esm/src/engine/deprecated.d.ts +1 -0
- package/build/{dist → esm/src/engine}/director/director.d.ts +13 -8
- package/build/{dist → esm/src/engine}/director/slide.d.ts +2 -2
- package/build/{dist → esm/src/engine}/director/transition.d.ts +1 -4
- package/build/{dist → esm/src/engine}/engine.d.ts +58 -8
- package/build/{dist → esm/src/engine}/entity-component-system/component.d.ts +1 -1
- package/build/{dist → esm/src/engine}/entity-component-system/components/motion-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/entity-component-system/components/pause-component.d.ts +2 -0
- package/build/{dist → esm/src/engine}/entity-component-system/components/tags-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/entity-component-system/components/transform-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/entity-component-system/entity.d.ts +0 -10
- package/build/{dist → esm/src/engine}/entity-component-system/index.d.ts +0 -1
- package/build/{dist → esm/src/engine}/entity-component-system/query.d.ts +1 -1
- package/build/{dist → esm/src/engine}/entity-component-system/system.d.ts +11 -4
- package/build/{dist → esm/src/engine}/entity-component-system/world.d.ts +1 -5
- package/build/{dist → esm/src/engine}/events/media-events.d.ts +3 -3
- package/build/{dist → esm/src/engine}/events.d.ts +4 -4
- package/build/{dist → esm/src/engine}/graphics/animation.d.ts +15 -5
- package/build/{dist → esm/src/engine}/graphics/context/circle-renderer/circle-renderer.d.ts +5 -0
- package/build/{dist → esm/src/engine}/graphics/context/debug-text.d.ts +13 -1
- package/build/{dist → esm/src/engine}/graphics/context/excalibur-graphics-context-2d-canvas.d.ts +13 -3
- package/build/{dist → esm/src/engine}/graphics/context/excalibur-graphics-context-webgl.d.ts +43 -6
- package/build/{dist → esm/src/engine}/graphics/context/excalibur-graphics-context.d.ts +108 -4
- package/build/esm/src/engine/graphics/context/framebuffer.d.ts +154 -0
- package/build/esm/src/engine/graphics/context/glsl.d.ts +47 -0
- package/build/{dist → esm/src/engine}/graphics/context/material-renderer/material-renderer.d.ts +1 -0
- package/build/esm/src/engine/graphics/context/material.d.ts +208 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/effects/bloom-effect.d.ts +80 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/effects/blur-passes.d.ts +75 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/effects/glow-passes.d.ts +93 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/shader-pass.d.ts +138 -0
- package/build/esm/src/engine/graphics/context/shader-pipeline/shader-pipeline.d.ts +91 -0
- package/build/{dist → esm/src/engine}/graphics/context/shader.d.ts +43 -6
- package/build/{dist → esm/src/engine}/graphics/context/texture-loader.d.ts +1 -1
- package/build/{dist → esm/src/engine}/graphics/context/webgl-util.d.ts +2 -2
- package/build/{dist → esm/src/engine}/graphics/debug-graphics-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/graphics/filtering.d.ts +1 -1
- package/build/{dist → esm/src/engine}/graphics/font-common.d.ts +2 -2
- package/build/{dist → esm/src/engine}/graphics/font-text-instance.d.ts +5 -5
- package/build/{dist → esm/src/engine}/graphics/font.d.ts +3 -3
- package/build/{dist → esm/src/engine}/graphics/graphics-component.d.ts +28 -15
- package/build/{dist → esm/src/engine}/graphics/graphics-group.d.ts +6 -0
- package/build/{dist → esm/src/engine}/graphics/graphics-system.d.ts +3 -3
- package/build/{dist → esm/src/engine}/graphics/image-source.d.ts +1 -1
- package/build/{dist → esm/src/engine}/graphics/index.d.ts +8 -0
- package/build/{dist → esm/src/engine}/graphics/offscreen-system.d.ts +2 -2
- package/build/{dist → esm/src/engine}/graphics/parallax-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/graphics/post-processor/color-blindness-post-processor.d.ts +3 -5
- package/build/esm/src/engine/graphics/post-processor/post-processor.d.ts +66 -0
- package/build/esm/src/engine/graphics/post-processor/shader-pipeline-post-processor.d.ts +45 -0
- package/build/{dist → esm/src/engine}/graphics/sprite-font.d.ts +3 -3
- package/build/{dist → esm/src/engine}/index.d.ts +5 -5
- package/build/{dist → esm/src/engine}/input/gamepad.d.ts +4 -7
- package/build/{dist → esm/src/engine}/input/keyboard.d.ts +3 -3
- package/build/{dist → esm/src/engine}/input/pointer-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/input/pointer-event-receiver.d.ts +13 -0
- package/build/{dist → esm/src/engine}/input/pointer-system.d.ts +3 -3
- package/build/{dist → esm/src/engine}/interfaces/index.d.ts +0 -2
- package/build/{dist → esm/src/engine}/label.d.ts +2 -2
- package/build/esm/src/engine/lighting/cone-light-component.d.ts +47 -0
- package/build/esm/src/engine/lighting/darkness-component.d.ts +34 -0
- package/build/esm/src/engine/lighting/flicker-options.d.ts +17 -0
- package/build/esm/src/engine/lighting/flicker-system.d.ts +19 -0
- package/build/esm/src/engine/lighting/index.d.ts +8 -0
- package/build/esm/src/engine/lighting/light-occluder-component.d.ts +66 -0
- package/build/esm/src/engine/lighting/lighting-config.d.ts +47 -0
- package/build/esm/src/engine/lighting/lighting-system.d.ts +153 -0
- package/build/esm/src/engine/lighting/point-light-component.d.ts +46 -0
- package/build/{dist → esm/src/engine}/math/affine-matrix.d.ts +8 -1
- package/build/esm/src/engine/math/coord-plane.d.ts +52 -0
- package/build/{dist → esm/src/engine}/math/graph.d.ts +2 -3
- package/build/{dist → esm/src/engine}/math/index.d.ts +2 -0
- package/build/{dist → esm/src/engine}/math/line-segment.d.ts +1 -1
- package/build/{dist → esm/src/engine}/math/matrix.d.ts +25 -0
- package/build/{dist → esm/src/engine}/math/ray.d.ts +1 -1
- package/build/{dist → esm/src/engine}/math/transform.d.ts +9 -0
- package/build/{dist → esm/src/engine}/math/vector.d.ts +16 -13
- package/build/esm/src/engine/math/vector3.d.ts +163 -0
- package/build/esm/src/engine/math/vector4.d.ts +157 -0
- package/build/{dist → esm/src/engine}/particles/gpu-particle-emitter.d.ts +2 -2
- package/build/{dist → esm/src/engine}/particles/particle-emitter.d.ts +2 -2
- package/build/{dist → esm/src/engine}/particles/particles.d.ts +6 -1
- package/build/esm/src/engine/plugin.d.ts +253 -0
- package/build/{dist → esm/src/engine}/resources/resource.d.ts +8 -0
- package/build/{dist → esm/src/engine}/resources/sound/index.d.ts +1 -1
- package/build/esm/src/engine/resources/sound/sound-manager.d.ts +378 -0
- package/build/esm/src/engine/resources/sound/sound-track.d.ts +176 -0
- package/build/esm/src/engine/resources/sound/sound.d.ts +351 -0
- package/build/{dist → esm/src/engine}/scene.d.ts +13 -7
- package/build/{dist → esm/src/engine}/screen-element.d.ts +2 -2
- package/build/{dist → esm/src/engine}/screen.d.ts +97 -29
- package/build/{dist → esm/src/engine}/tile-map/isometric-entity-component.d.ts +1 -0
- package/build/{dist → esm/src/engine}/tile-map/isometric-entity-system.d.ts +2 -3
- package/build/{dist → esm/src/engine}/tile-map/isometric-map.d.ts +0 -10
- package/build/{dist → esm/src/engine}/tile-map/tile-map.d.ts +2 -0
- package/build/{dist → esm/src/engine}/timer.d.ts +5 -8
- package/build/{dist/util/pool.d.ts → esm/src/engine/util/arena-pool.d.ts} +15 -4
- package/build/{dist → esm/src/engine}/util/browser.d.ts +8 -0
- package/build/{dist → esm/src/engine}/util/detector.d.ts +1 -1
- package/build/{dist → esm/src/engine}/util/draw-util.d.ts +2 -2
- package/build/{dist → esm/src/engine}/util/index.d.ts +0 -1
- package/build/{dist → esm/src/engine}/util/pause-system.d.ts +7 -1
- package/build/{dist → esm/src/engine}/util/rental-pool.d.ts +1 -0
- package/build/{dist → esm/src/engine}/util/serializer.d.ts +1 -1
- package/build/{dist → esm/src/engine}/util/state-machine.d.ts +1 -1
- package/package.json +38 -44
- package/tsconfig.json +38 -1
- package/.devcontainer/devcontainer.json +0 -26
- package/.git-blame-ignore-revs +0 -3
- package/.gitattributes +0 -70
- package/.gitmodules +0 -0
- package/.husky/pre-commit +0 -1
- package/.prettierrc +0 -8
- package/build/dist/collision/solver/realistic-solver.d.ts +0 -28
- package/build/dist/deprecated.d.ts +0 -0
- package/build/dist/entity-component-system/tag-query.d.ts +0 -28
- package/build/dist/excalibur.development.js +0 -35408
- package/build/dist/excalibur.js +0 -35408
- package/build/dist/excalibur.min.development.js +0 -931
- package/build/dist/excalibur.min.js +0 -931
- package/build/dist/graphics/context/material.d.ts +0 -102
- package/build/dist/graphics/context/render-source.d.ts +0 -7
- package/build/dist/graphics/context/render-target.d.ts +0 -60
- package/build/dist/graphics/post-processor/post-processor.d.ts +0 -36
- package/build/dist/interfaces/audio-implementation.d.ts +0 -25
- package/build/dist/interfaces/audio.d.ts +0 -55
- package/build/dist/math/coord-plane.d.ts +0 -15
- package/build/dist/resources/sound/sound-manager.d.ts +0 -102
- package/build/dist/resources/sound/sound.d.ts +0 -215
- package/build/dist/resources/sound/web-audio-instance.d.ts +0 -49
- package/build/dist/util/decorators.d.ts +0 -15
- package/build/dist/util/easing-functions.d.ts +0 -89
- package/build/dist/util/sound.d.ts +0 -5
- package/deno.json +0 -10
- package/eslint.config.mjs +0 -210
- package/playground/README.md +0 -71
- package/playground/index.html +0 -75
- package/playground/package-lock.json +0 -1976
- package/playground/package.json +0 -27
- package/playground/public/favicon.ico +0 -0
- package/playground/public/icon.png +0 -0
- package/playground/public/logo-white@2x.png +0 -0
- package/playground/public/logo@2x.png +0 -0
- package/playground/public/player-run.png +0 -0
- package/playground/public/rpg-audio/License.txt +0 -21
- package/playground/public/rpg-audio/audio/handleCoins.ogg +0 -0
- package/playground/public/social.jpg +0 -0
- package/playground/public/social.png +0 -0
- package/playground/public/tiny-town/License.txt +0 -22
- package/playground/public/tiny-town/tilemap/tilemap.png +0 -0
- package/playground/tsconfig.json +0 -26
- package/playground/tsdown.config.ts +0 -13
- package/playground/vite.config.ts +0 -5
- package/vite.config.common.js +0 -27
- package/vite.config.ts +0 -78
- package/vitest.config.ts +0 -41
- /package/build/{dist → esm/src/engine}/actions/action/action-sequence.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/blink.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/call-method.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/curve-by.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/curve-to.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/delay.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/die.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/ease-by.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/ease-to.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/fade.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/flash.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/follow.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/meet.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/parallel-actions.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/repeat.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/rotate-to.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/scale-by.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action/scale-to.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action-queue.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/action.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/actions/actionable.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/colliders/composite-collider.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/collision-type.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/collision-processor.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/dynamic-tree-collision-processor.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/ray-cast-hit.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/ray-cast-options.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/detection/spatial-partition-strategy.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/group/collision-group.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/integrator.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/island.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/side.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/solver/arcade-solver.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/solver/contact-bias.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/solver/contact-constraint-point.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/collision/solver-strategy.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/color.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/context.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/debug/debug-flags.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/debug/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/cross-fade.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/default-loader.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/fade-in-out.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/director/loader.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/entity-manager.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/priority.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/query-manager.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/system-manager.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/entity-component-system/types.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/event-emitter.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/events/ex-event.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/events/pointer-events.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/excalibur.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/flags.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/garbage-collector.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/canvas.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/circle.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/debug-circle-renderer/debug-circle-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/debug-line-renderer/debug-line-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/debug-point-renderer/debug-point-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/draw-call.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/image-renderer/image-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/image-renderer-v2/image-renderer-v2.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/particle-renderer/particle-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/quad-index-buffer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/rectangle-renderer/rectangle-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/screen-pass-painter/screen-pass-painter.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/state-stack.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/transform-stack.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/uniform-buffer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/vertex-buffer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/context/vertex-layout.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/debug.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/font-cache.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/graphic.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/graphics-diagnostics.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/line.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/nine-slice.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/polygon.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/post-processor/color-blindness-mode.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/post-processor/screen-shader.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/raster.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/rectangle.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/sprite-sheet.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/sprite.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/text.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/tiled-animation.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/tiled-sprite.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/transform-interpolation.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/graphics/wrapping.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/id.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/capture-pointer-config.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/input-host.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/input-mapper.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/native-pointer-button.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-abstraction.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-button.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-event.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-events-to-object-dispatcher.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-scope.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/pointer-type.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/wheel-delta-mode.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/input/wheel-event.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/clonable.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/evented.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/lifecycle-events.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/loadable.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/interfaces/pointer-event-handlers.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/bezier-curve.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/easings.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/global-coordinates.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/lerp.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/projection.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/random.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/rotation-type.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/util.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/vector-view.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/math/watch-vector.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/particles/emitter-type.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/particles/gpu-particle-renderer.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/particles/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/polyfill.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/resources/font.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/resources/gif.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/resources/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/resources/sound/audio-context.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/tile-map/index.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/trigger.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/assert.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/clock.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/coroutine.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/fps.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/future.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/iframe.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/log.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/observable.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/required.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/semaphore.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/string.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/toaster.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/util.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/watch.d.ts +0 -0
- /package/build/{dist → esm/src/engine}/util/web-audio.d.ts +0 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type { Engine, EngineOptions } from './engine';
|
|
2
|
+
import type { ExcaliburGraphicsContext, ExcaliburGraphicsContextOptions } from './graphics';
|
|
3
|
+
import type { Scene } from './scene';
|
|
4
|
+
/**
|
|
5
|
+
* An Excalibur Plugin packages up engine modifications into a convenient bundle.
|
|
6
|
+
*
|
|
7
|
+
* Plugins are inspired by the [Bevy Plugin System](https://bevy.org/learn/quick-start/getting-started/plugins/)
|
|
8
|
+
* and allow third-party libraries to configure multiple aspects of Excalibur through a single install,
|
|
9
|
+
* rather than requiring users to manually wire up loaders, renderers, post-processors, systems, etc.
|
|
10
|
+
*
|
|
11
|
+
* Plugins participate in the engine, graphics, and scene lifecycles through a series of optional
|
|
12
|
+
* hook methods. Each hook is called at a specific point in the initialization flow, giving plugins
|
|
13
|
+
* the opportunity to register custom renderers, post-processors, ECS systems, resources, or modify
|
|
14
|
+
* engine configuration.
|
|
15
|
+
*
|
|
16
|
+
* ## Lifecycle Order
|
|
17
|
+
*
|
|
18
|
+
* 1. **Engine construction** — `onEnginePreConfig` → (flags frozen) → `onEnginePostConfig`
|
|
19
|
+
* 2. **Engine start** — `onLoad` → (resources loaded) → `onLoadComplete`
|
|
20
|
+
* 3. **Engine initialize** — `onEnginePreInitialize` → `onEnginePostInitialize`
|
|
21
|
+
* 4. **Graphics context construction** — `onGraphicsPreConfig` → `onGraphicsPostConfig`
|
|
22
|
+
* 5. **Graphics context init** — `onGraphicsPreInitialize` → `onGraphicsPostInitialize`
|
|
23
|
+
* 6. **Scene initialize** — `onScenePreInitialize` → `onScenePostInitialize`
|
|
24
|
+
* 7. **Scene activate** — `onScenePreActivate` → `onScenePostActivate`
|
|
25
|
+
* 8. **Scene deactivate** — `onScenePreDeactivate` → `onScenePostDeactivate`
|
|
26
|
+
* 9. **Graphics context lost/restored** — `onGraphicsContextLost` → `onGraphicsContextRestored`
|
|
27
|
+
* 10. **Engine dispose** — `dispose`
|
|
28
|
+
*
|
|
29
|
+
* ## Example: SDF Text Plugin
|
|
30
|
+
*
|
|
31
|
+
* ```typescript
|
|
32
|
+
* class SDFPlugin extends Plugin {
|
|
33
|
+
* name = 'ex.sdf-text';
|
|
34
|
+
* priority = 0;
|
|
35
|
+
*
|
|
36
|
+
* onGraphicsPostInitialize(context: ExcaliburGraphicsContext) {
|
|
37
|
+
* context.lazyRegister('ex.sdf-text-renderer', () => new SDFTextRenderer());
|
|
38
|
+
* }
|
|
39
|
+
*
|
|
40
|
+
* dispose() {
|
|
41
|
+
* // clean up any plugin-owned resources
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* const game = new Engine({
|
|
46
|
+
* plugins: [new SDFPlugin()]
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* Plugins can also be added after construction via {@apilink Engine.addPlugin}.
|
|
51
|
+
*/
|
|
52
|
+
export declare abstract class Plugin {
|
|
53
|
+
readonly name: string;
|
|
54
|
+
/**
|
|
55
|
+
* Unique name of the plugin, pick something unique (official excalibur plugins use the reserved prefix "ex.").
|
|
56
|
+
* Used for deduplication — attempting to add a plugin
|
|
57
|
+
* with a name that is already installed will produce a warning and be skipped.
|
|
58
|
+
* @param name
|
|
59
|
+
*/
|
|
60
|
+
constructor(name: string);
|
|
61
|
+
/**
|
|
62
|
+
* Plugin priority determines the order hooks are run across all installed plugins.
|
|
63
|
+
*
|
|
64
|
+
* Lower numbers run first, higher numbers run last. Default is `0`.
|
|
65
|
+
* Plugins that need to configure things before others (e.g. registering a base
|
|
66
|
+
* renderer that other plugins extend) should use a lower priority.
|
|
67
|
+
*/
|
|
68
|
+
priority: number;
|
|
69
|
+
/**
|
|
70
|
+
* Perform any async loading the plugin needs before the engine starts.
|
|
71
|
+
*
|
|
72
|
+
* Called during {@apilink Engine.start} before the loader runs. Use this to
|
|
73
|
+
* fetch configuration, preload data, or set up async resources.
|
|
74
|
+
*
|
|
75
|
+
* @returns A promise that resolves when loading is complete
|
|
76
|
+
*/
|
|
77
|
+
onLoad?(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Called after all loader resources have finished loading but before the engine
|
|
80
|
+
* initializes. Use this to finalize any setup that depended on loaded data.
|
|
81
|
+
*
|
|
82
|
+
* @returns A promise that resolves when complete
|
|
83
|
+
*/
|
|
84
|
+
onLoadComplete?(): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Intercept and mutate the @[apilink EngineOptions} passed into the Engine, and/or modify
|
|
87
|
+
* the engine before any other configuration happens.
|
|
88
|
+
*
|
|
89
|
+
* This is the first hook called during engine construction. Feature flags can still
|
|
90
|
+
* be modified at this point (before {@apilink Flags.freeze}).
|
|
91
|
+
*
|
|
92
|
+
* @param engine The engine being constructed
|
|
93
|
+
* @param options The user-provided engine options (mutable)
|
|
94
|
+
*/
|
|
95
|
+
onEnginePreConfig?(engine: Engine, options: EngineOptions): void;
|
|
96
|
+
/**
|
|
97
|
+
* Intercept and mutate the engine after core configuration is done but before the
|
|
98
|
+
* engine is fully constructed.
|
|
99
|
+
*
|
|
100
|
+
* Called near the end of the Engine constructor, after inputs and visibility handlers
|
|
101
|
+
* are wired up. Feature flags are frozen at this point.
|
|
102
|
+
*
|
|
103
|
+
* @param engine The engine being constructed
|
|
104
|
+
* @param options The user-provided engine options
|
|
105
|
+
*/
|
|
106
|
+
onEnginePostConfig?(engine: Engine, options: EngineOptions): void;
|
|
107
|
+
/**
|
|
108
|
+
* Intercept the engine and modify it before initialization.
|
|
109
|
+
*
|
|
110
|
+
* Called during {@apilink Engine.start} after loading completes but before
|
|
111
|
+
* {@apilink Engine.onInitialize} and the director initialization.
|
|
112
|
+
*
|
|
113
|
+
* @param engine The engine about to be initialized
|
|
114
|
+
*/
|
|
115
|
+
onEnginePreInitialize?(engine: Engine): void;
|
|
116
|
+
/**
|
|
117
|
+
* Intercept the engine and modify it after initialization.
|
|
118
|
+
*
|
|
119
|
+
* Called after {@apilink Engine.onInitialize} and the director initialization,
|
|
120
|
+
* and after the `'initialize'` event is emitted.
|
|
121
|
+
*
|
|
122
|
+
* @param engine The initialized engine
|
|
123
|
+
*/
|
|
124
|
+
onEnginePostInitialize?(engine: Engine): void;
|
|
125
|
+
/**
|
|
126
|
+
* Intercept the graphics context before it is configured and modify either the
|
|
127
|
+
* context or the options.
|
|
128
|
+
*
|
|
129
|
+
* This is the very first graphics hook, called at the start of the
|
|
130
|
+
* {@apilink ExcaliburGraphicsContextWebGL} constructor before the WebGL context
|
|
131
|
+
* is created. Use this to modify graphics options before they are applied.
|
|
132
|
+
*
|
|
133
|
+
* @param context The graphics context being constructed
|
|
134
|
+
* @param options The graphics context options (mutable)
|
|
135
|
+
*/
|
|
136
|
+
onGraphicsPreConfig?(context: ExcaliburGraphicsContext, options: ExcaliburGraphicsContextOptions): void;
|
|
137
|
+
/**
|
|
138
|
+
* Intercept the graphics context after it is configured but before initialization.
|
|
139
|
+
*
|
|
140
|
+
* Called after the WebGL context is created and all configuration properties are set,
|
|
141
|
+
* but before built-in renderers and render targets are initialized.
|
|
142
|
+
*
|
|
143
|
+
* @param context The graphics context being constructed
|
|
144
|
+
* @param options The graphics context options
|
|
145
|
+
*/
|
|
146
|
+
onGraphicsPostConfig?(context: ExcaliburGraphicsContext, options: ExcaliburGraphicsContextOptions): void;
|
|
147
|
+
/**
|
|
148
|
+
* Intercept the graphics context and modify it before initialization.
|
|
149
|
+
*
|
|
150
|
+
* Called at the start of the graphics context's `_init()` method, before the
|
|
151
|
+
* orthographic projection, viewport, built-in renderers, and render targets are set up.
|
|
152
|
+
*
|
|
153
|
+
* @param context The graphics context being initialized
|
|
154
|
+
*/
|
|
155
|
+
onGraphicsPreInitialize?(context: ExcaliburGraphicsContext): void;
|
|
156
|
+
/**
|
|
157
|
+
* Intercept the graphics context and modify it after initialization.
|
|
158
|
+
*
|
|
159
|
+
* This is the recommended hook for registering custom {@apilink RendererPlugin}s via
|
|
160
|
+
* {@apilink ExcaliburGraphicsContext.register} or
|
|
161
|
+
* {@apilink ExcaliburGraphicsContext.lazyRegister}, and for adding
|
|
162
|
+
* {@apilink PostProcessor}s via {@apilink ExcaliburGraphicsContext.addPostProcessor}.
|
|
163
|
+
*
|
|
164
|
+
* Called after all built-in renderers and render targets are initialized.
|
|
165
|
+
*
|
|
166
|
+
* @param context The initialized graphics context
|
|
167
|
+
*/
|
|
168
|
+
onGraphicsPostInitialize?(context: ExcaliburGraphicsContext): void;
|
|
169
|
+
/**
|
|
170
|
+
* Intercept a scene and modify it before initialization.
|
|
171
|
+
*
|
|
172
|
+
* Called after the scene's ECS systems are initialized but before the user's
|
|
173
|
+
* {@apilink Scene.onInitialize} runs. Use this to add default ECS systems,
|
|
174
|
+
* components, or resources to every scene.
|
|
175
|
+
*
|
|
176
|
+
* @param scene The scene being initialized
|
|
177
|
+
*/
|
|
178
|
+
onScenePreInitialize?(scene: Scene): void;
|
|
179
|
+
/**
|
|
180
|
+
* Intercept a scene and modify it after initialization.
|
|
181
|
+
*
|
|
182
|
+
* Called after the user's {@apilink Scene.onInitialize} and child initialization
|
|
183
|
+
* are complete, but before the scene's `'initialize'` event is emitted.
|
|
184
|
+
*
|
|
185
|
+
* @param scene The initialized scene
|
|
186
|
+
*/
|
|
187
|
+
onScenePostInitialize?(scene: Scene): void;
|
|
188
|
+
/**
|
|
189
|
+
* Intercept a scene before it is activated.
|
|
190
|
+
*
|
|
191
|
+
* Called when a scene becomes the current scene, before the user's
|
|
192
|
+
* {@apilink Scene.onActivate} runs.
|
|
193
|
+
*
|
|
194
|
+
* @param scene The scene being activated
|
|
195
|
+
*/
|
|
196
|
+
onScenePreActivate?(scene: Scene): void;
|
|
197
|
+
/**
|
|
198
|
+
* Intercept a scene after it is activated.
|
|
199
|
+
*
|
|
200
|
+
* Called after the user's {@apilink Scene.onActivate} completes.
|
|
201
|
+
*
|
|
202
|
+
* @param scene The activated scene
|
|
203
|
+
*/
|
|
204
|
+
onScenePostActivate?(scene: Scene): void;
|
|
205
|
+
/**
|
|
206
|
+
* Intercept a scene before it is deactivated.
|
|
207
|
+
*
|
|
208
|
+
* Called when a scene is about to stop being the current scene, before the user's
|
|
209
|
+
* {@apilink Scene.onDeactivate} runs.
|
|
210
|
+
*
|
|
211
|
+
* @param scene The scene being deactivated
|
|
212
|
+
*/
|
|
213
|
+
onScenePreDeactivate?(scene: Scene): void;
|
|
214
|
+
/**
|
|
215
|
+
* Intercept a scene after it is deactivated.
|
|
216
|
+
*
|
|
217
|
+
* Called after the user's {@apilink Scene.onDeactivate} completes.
|
|
218
|
+
*
|
|
219
|
+
* @param scene The deactivated scene
|
|
220
|
+
*/
|
|
221
|
+
onScenePostDeactivate?(scene: Scene): void;
|
|
222
|
+
/**
|
|
223
|
+
* Called when the WebGL graphics context is lost (e.g. GPU driver crash).
|
|
224
|
+
*
|
|
225
|
+
* Plugins that manage WebGL resources (shaders, buffers, textures) should
|
|
226
|
+
* implement this to mark their resources as invalid. The context will be
|
|
227
|
+
* restored and {@apilink onGraphicsContextRestored} will be called, after which
|
|
228
|
+
* {@apilink onGraphicsPreInitialize} and {@apilink onGraphicsPostInitialize}
|
|
229
|
+
* will re-run so resources can be rebuilt.
|
|
230
|
+
*
|
|
231
|
+
* @param context The graphics context that was lost
|
|
232
|
+
*/
|
|
233
|
+
onGraphicsContextLost?(context: ExcaliburGraphicsContext): void;
|
|
234
|
+
/**
|
|
235
|
+
* Called when the WebGL graphics context is restored after being lost.
|
|
236
|
+
*
|
|
237
|
+
* After this hook, the graphics context's `_init()` method re-runs, which will
|
|
238
|
+
* call {@apilink onGraphicsPreInitialize} and {@apilink onGraphicsPostInitialize}
|
|
239
|
+
* again so plugins can rebuild their WebGL resources.
|
|
240
|
+
*
|
|
241
|
+
* @param context The graphics context that was restored
|
|
242
|
+
*/
|
|
243
|
+
onGraphicsContextRestored?(context: ExcaliburGraphicsContext): void;
|
|
244
|
+
/**
|
|
245
|
+
* Perform any cleanup necessary when the engine is disposed.
|
|
246
|
+
*
|
|
247
|
+
* Called during {@apilink Engine.dispose} after the engine is stopped and
|
|
248
|
+
* inputs are disabled, but before the canvas is removed and the graphics context
|
|
249
|
+
* is disposed. Use this to free plugin-owned resources, remove event listeners,
|
|
250
|
+
* or dispose of custom renderers.
|
|
251
|
+
*/
|
|
252
|
+
dispose?(): void;
|
|
253
|
+
}
|
|
@@ -15,6 +15,14 @@ export declare const ResourceEvents: {
|
|
|
15
15
|
Progress: string;
|
|
16
16
|
Error: string;
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Error thrown when a resource fails to load due to network issues,
|
|
20
|
+
* CORS problems, or the resource being unreachable.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ResourceLoadingError extends Error {
|
|
23
|
+
path: string;
|
|
24
|
+
constructor(path: string, message: string);
|
|
25
|
+
}
|
|
18
26
|
/**
|
|
19
27
|
* The {@apilink Resource} type allows games built in Excalibur to load generic resources.
|
|
20
28
|
* For any type of remote resource it is recommended to use {@apilink Resource} for preloading.
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import type { Loadable } from '../../interfaces/loadable';
|
|
2
|
+
import type { Engine } from '../../engine';
|
|
3
|
+
import { Sound, type PlayOptions } from './sound';
|
|
4
|
+
import type { SoundTrack } from './sound-track';
|
|
5
|
+
export type AnyString = {} & string;
|
|
6
|
+
export interface SoundConfig<Channel extends string = string, SName extends string = string> {
|
|
7
|
+
sound: Sound<SName>;
|
|
8
|
+
/**
|
|
9
|
+
* Optional explicit name for this sound in the manager. If omitted, the
|
|
10
|
+
* sound's own {@apilink Sound.name} (basename-without-extension) is used.
|
|
11
|
+
*/
|
|
12
|
+
name?: SName;
|
|
13
|
+
/**
|
|
14
|
+
* Mix volume [0-1] for this sound, default 1 (full volume). Multiplies with the
|
|
15
|
+
* sound's own volume, its channel volume, and the master volume.
|
|
16
|
+
*/
|
|
17
|
+
volume?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The {@apilink SoundChannel} this sound is routed through, for example 'music' or 'sfx'.
|
|
20
|
+
* Channel volume, mute and effects apply to every sound in the channel. Sounds without a
|
|
21
|
+
* channel route straight to the manager's master output.
|
|
22
|
+
*/
|
|
23
|
+
channel?: Channel;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Context for {@apilink AudioBusBuilder} useful for custom effects
|
|
27
|
+
*/
|
|
28
|
+
export interface AudioBusContext {
|
|
29
|
+
/**
|
|
30
|
+
* Browser Web Audio API context
|
|
31
|
+
*/
|
|
32
|
+
readonly audioContext: AudioContext;
|
|
33
|
+
/**
|
|
34
|
+
* Gain the bus sources
|
|
35
|
+
*/
|
|
36
|
+
readonly input: GainNode;
|
|
37
|
+
/**
|
|
38
|
+
* Carries the bus volume and mute, out to speakers
|
|
39
|
+
*/
|
|
40
|
+
readonly output: GainNode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Lifecycle hook that wires a bus ({@apilink SoundChannel} or the {@apilink SoundManager} master)
|
|
44
|
+
* when it is created, replacing the default `input → output` edge. Use it to insert effects that
|
|
45
|
+
* apply to every sound on the bus:
|
|
46
|
+
*
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const manager = new ex.SoundManager({
|
|
49
|
+
* channels: [
|
|
50
|
+
* 'sfx',
|
|
51
|
+
* {
|
|
52
|
+
* name: 'music',
|
|
53
|
+
* onConnect: ({ audioContext, input, output }) => {
|
|
54
|
+
* const muffle = audioContext.createBiquadFilter();
|
|
55
|
+
* muffle.type = 'lowpass';
|
|
56
|
+
* input.connect(muffle).connect(output);
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
* ],
|
|
60
|
+
* onConnect: ({ audioContext, input, output }) => {
|
|
61
|
+
* input.connect(audioContext.createDynamicsCompressor()).connect(output);
|
|
62
|
+
* },
|
|
63
|
+
* sounds: [...]
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export type AudioBusBuilder = (ctx: AudioBusContext) => void;
|
|
68
|
+
export interface SoundChannelOptions<Channel extends string = string> {
|
|
69
|
+
name: Channel;
|
|
70
|
+
/**
|
|
71
|
+
* Channel volume [0-1], default 1
|
|
72
|
+
*/
|
|
73
|
+
volume?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Maximum number of simultaneously playing tracks in this channel, default unbounded.
|
|
76
|
+
* See {@apilink SoundManagerOptions.voiceStealing} for what happens at the cap.
|
|
77
|
+
*/
|
|
78
|
+
maxConcurrentTracks?: number;
|
|
79
|
+
/**
|
|
80
|
+
* What happens when a `maxConcurrentTracks` cap
|
|
81
|
+
* *`false` (default) drops the new play
|
|
82
|
+
* *`true` stops the oldest playing track in that scope to make room for it.
|
|
83
|
+
*/
|
|
84
|
+
voiceStealing?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Wire the channel's `input` to its `output` through effects, see {@apilink AudioBusBuilder}
|
|
87
|
+
*/
|
|
88
|
+
onConnect?: AudioBusBuilder;
|
|
89
|
+
}
|
|
90
|
+
export interface SoundManagerOptions<Channel extends string = string, SoundName extends string = string> {
|
|
91
|
+
/**
|
|
92
|
+
* Optionally specify the possible channels to avoid typo's, as names or {@apilink SoundChannelOptions}
|
|
93
|
+
*/
|
|
94
|
+
channels?: readonly (Channel | SoundChannelOptions<Channel>)[];
|
|
95
|
+
/**
|
|
96
|
+
* The sounds to manage, each optionally with a mix `volume` and a `channel`.
|
|
97
|
+
*/
|
|
98
|
+
sounds: readonly (SoundConfig<NoInfer<Channel>, SoundName> | Sound<SoundName>)[];
|
|
99
|
+
/**
|
|
100
|
+
* Master volume [0-1] for every sound in this manager
|
|
101
|
+
*
|
|
102
|
+
* Default is 1 (100%)
|
|
103
|
+
*/
|
|
104
|
+
volume?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Maximum number of simultaneously playing tracks allowed across ALL sounds
|
|
107
|
+
* managed by this {@apilink SoundManager}. Default is unbounded (`Infinity`).
|
|
108
|
+
* Channels can set their own cap with {@apilink SoundChannelOptions.maxConcurrentTracks}.
|
|
109
|
+
*/
|
|
110
|
+
maxConcurrentTracks?: number;
|
|
111
|
+
/**
|
|
112
|
+
* What happens when a `maxConcurrentTracks` cap
|
|
113
|
+
* *`false` (default) drops the new play
|
|
114
|
+
* *`true` stops the oldest playing track in that scope to make room for it.
|
|
115
|
+
*/
|
|
116
|
+
voiceStealing?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Wire the master `input` to `output` through effects (e.g. a compressor), see {@apilink AudioBusBuilder}
|
|
119
|
+
*/
|
|
120
|
+
onConnect?: AudioBusBuilder;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A group of sounds with a shared gain stage: `input → output → SoundManager.output`.
|
|
124
|
+
*
|
|
125
|
+
* Every sound in the channel is mixed into {@apilink SoundChannel.input}; {@apilink SoundChannel.output}
|
|
126
|
+
* carries the channel volume and mute. Insert Web Audio effects between the two to process the
|
|
127
|
+
* whole channel at once:
|
|
128
|
+
*
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const music = manager.getChannel('music');
|
|
131
|
+
* const muffle = music.audioContext.createBiquadFilter();
|
|
132
|
+
* muffle.type = 'lowpass';
|
|
133
|
+
* music.input.disconnect();
|
|
134
|
+
* music.input.connect(muffle).connect(music.output);
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export declare class SoundChannel {
|
|
138
|
+
readonly name: string;
|
|
139
|
+
readonly audioContext: AudioContext;
|
|
140
|
+
/**
|
|
141
|
+
* Gain node every sound in the channel connects to
|
|
142
|
+
*/
|
|
143
|
+
readonly input: GainNode;
|
|
144
|
+
/**
|
|
145
|
+
* Output gain node that carries the channel volume and mute, connected to the manager's master input
|
|
146
|
+
*/
|
|
147
|
+
readonly output: GainNode;
|
|
148
|
+
/**
|
|
149
|
+
* Maximum number of simultaneously playing tracks in this channel, default Infinity
|
|
150
|
+
*/
|
|
151
|
+
maxConcurrentTracks: number;
|
|
152
|
+
/**
|
|
153
|
+
* What happens when a `maxConcurrentTracks` cap
|
|
154
|
+
* *`false` (default) drops the new play
|
|
155
|
+
* *`true` stops the oldest playing track in that scope to make room for it.
|
|
156
|
+
*/
|
|
157
|
+
voiceStealing: boolean;
|
|
158
|
+
private _sounds;
|
|
159
|
+
private _volume;
|
|
160
|
+
private _muted;
|
|
161
|
+
constructor(name: string, audioContext: AudioContext, master: AudioNode, options?: Omit<SoundChannelOptions, 'name'>);
|
|
162
|
+
/**
|
|
163
|
+
* Sounds currently routed through this channel
|
|
164
|
+
*/
|
|
165
|
+
get sounds(): readonly Sound[];
|
|
166
|
+
/**
|
|
167
|
+
* Number of currently-playing tracks across the channel's sounds
|
|
168
|
+
*/
|
|
169
|
+
playingCount(): number;
|
|
170
|
+
/**
|
|
171
|
+
* Channel volume [0-1], default 1
|
|
172
|
+
*/
|
|
173
|
+
get volume(): number;
|
|
174
|
+
set volume(volume: number);
|
|
175
|
+
get muted(): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Global mute, mutes all sounds managed by the SoundManager by muting the master output node
|
|
178
|
+
*/
|
|
179
|
+
mute(): void;
|
|
180
|
+
/**
|
|
181
|
+
*
|
|
182
|
+
* Global unmute, unmutes all sounds managed by the SoundManager by setting the gain on the master output node to SoundManager.volume.
|
|
183
|
+
* **Warning** Does not unmute specifically muted channels
|
|
184
|
+
*/
|
|
185
|
+
unmute(): void;
|
|
186
|
+
toggle(): void;
|
|
187
|
+
private _apply;
|
|
188
|
+
/**
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
_add(sound: Sound): void;
|
|
192
|
+
/**
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
_remove(sound: Sound): void;
|
|
196
|
+
}
|
|
197
|
+
export interface SoundManagerApi {
|
|
198
|
+
setVolume(name: string, volume?: number): void;
|
|
199
|
+
play(name: string, options?: number | PlayOptions): Promise<boolean>;
|
|
200
|
+
stop(name?: string): void;
|
|
201
|
+
mute(name?: string): void;
|
|
202
|
+
unmute(name?: string): void;
|
|
203
|
+
toggle(name?: string): void;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Operations on {@apilink SoundChannel}s by name, see {@apilink SoundManager.channel}
|
|
207
|
+
*/
|
|
208
|
+
export declare class ChannelCollection<Channel extends string> implements SoundManagerApi {
|
|
209
|
+
soundManager: SoundManager<Channel, string>;
|
|
210
|
+
constructor(soundManager: SoundManager<Channel, string>);
|
|
211
|
+
/**
|
|
212
|
+
* Get the {@apilink SoundChannel} for direct access to its volume, mute and audio nodes
|
|
213
|
+
*/
|
|
214
|
+
get(name: Channel): SoundChannel;
|
|
215
|
+
/**
|
|
216
|
+
* Stop every sound in the channel
|
|
217
|
+
*/
|
|
218
|
+
stop(name: Channel): void;
|
|
219
|
+
/**
|
|
220
|
+
* Set the channel volume [0-1]
|
|
221
|
+
*/
|
|
222
|
+
setVolume(name: Channel, volume?: number): void;
|
|
223
|
+
getVolume(name: Channel): number;
|
|
224
|
+
/**
|
|
225
|
+
* Play every sound in the channel, resolves to true if every sound played, false if any was
|
|
226
|
+
* dropped by a concurrency cap.
|
|
227
|
+
*/
|
|
228
|
+
play(name: Channel, options?: number | PlayOptions): Promise<boolean>;
|
|
229
|
+
mute(name: Channel): void;
|
|
230
|
+
unmute(name: Channel): void;
|
|
231
|
+
toggle(name: Channel): void;
|
|
232
|
+
isMuted(name: Channel): boolean;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Manages a set of sounds through a Web Audio mixer graph:
|
|
236
|
+
*
|
|
237
|
+
* `Sound.output → mix gain → SoundChannel (input → output) → SoundManager.output → speakers`
|
|
238
|
+
*
|
|
239
|
+
* Master, channel and per-sound mix volumes and mutes compose in the graph, so muting is silent
|
|
240
|
+
* playback rather than a pause and none of it touches {@apilink Sound.volume}. A SoundManager is
|
|
241
|
+
* {@apilink Loadable}, add it to a {@apilink Loader} to load every sound it manages.
|
|
242
|
+
*/
|
|
243
|
+
export declare class SoundManager<const Channel extends string, const SoundName extends string> implements SoundManagerApi, Loadable<AudioBuffer[]> {
|
|
244
|
+
private _audioContext;
|
|
245
|
+
/**
|
|
246
|
+
* Master bus input every channel (and channel-less sound) is mixed into
|
|
247
|
+
*/
|
|
248
|
+
readonly input: GainNode;
|
|
249
|
+
/**
|
|
250
|
+
* Master gain carrying the master volume and mute, connected to the audio context destination
|
|
251
|
+
*/
|
|
252
|
+
readonly output: GainNode;
|
|
253
|
+
/**
|
|
254
|
+
* Stop the oldest playing track to make room when a cap is reached instead of dropping the new play
|
|
255
|
+
*/
|
|
256
|
+
voiceStealing: boolean;
|
|
257
|
+
private _sounds;
|
|
258
|
+
private _names;
|
|
259
|
+
private _mix;
|
|
260
|
+
private _soundChannel;
|
|
261
|
+
private _channels;
|
|
262
|
+
private _engine?;
|
|
263
|
+
private _logger;
|
|
264
|
+
private _volume;
|
|
265
|
+
private _muted;
|
|
266
|
+
/**
|
|
267
|
+
* Maximum number of simultaneously playing tracks across ALL managed sounds.
|
|
268
|
+
* Default is `Infinity` (unbounded). When the cap is reached, new `play()`
|
|
269
|
+
* calls are dropped.
|
|
270
|
+
*/
|
|
271
|
+
maxConcurrentTracks: number;
|
|
272
|
+
channel: ChannelCollection<Channel>;
|
|
273
|
+
/**
|
|
274
|
+
* Decoded audio of every managed sound once loaded, see {@apilink Loadable}
|
|
275
|
+
*/
|
|
276
|
+
data: AudioBuffer[];
|
|
277
|
+
constructor(options: SoundManagerOptions<Channel, SoundName>);
|
|
278
|
+
/**
|
|
279
|
+
* Master volume [0-1], default 1
|
|
280
|
+
*/
|
|
281
|
+
get volume(): number;
|
|
282
|
+
set volume(volume: number);
|
|
283
|
+
/**
|
|
284
|
+
* Whether the master output is muted
|
|
285
|
+
*/
|
|
286
|
+
get muted(): boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Load every managed sound
|
|
289
|
+
*/
|
|
290
|
+
load(): Promise<AudioBuffer[]>;
|
|
291
|
+
isLoaded(): boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Wire every managed sound (including ones tracked later) to the engine so
|
|
294
|
+
* they pause when hidden and stop with it. Called by the {@apilink Loader}.
|
|
295
|
+
*/
|
|
296
|
+
wireEngine(engine: Engine): void;
|
|
297
|
+
/**
|
|
298
|
+
* Total number of currently-playing tracks across all managed sounds
|
|
299
|
+
*/
|
|
300
|
+
playingCount(): number;
|
|
301
|
+
getSounds(): readonly Sound[];
|
|
302
|
+
/**
|
|
303
|
+
* Get a {@apilink SoundChannel}, creating it on first use
|
|
304
|
+
*/
|
|
305
|
+
getChannel(name: Channel): SoundChannel;
|
|
306
|
+
getChannels(): readonly SoundChannel[];
|
|
307
|
+
getSoundsForChannel(channel: Channel | AnyString): readonly Sound[];
|
|
308
|
+
/**
|
|
309
|
+
* Route a tracked sound through a channel, or `null` for straight to the master output
|
|
310
|
+
*/
|
|
311
|
+
setChannel(name: SoundName, channel: Channel | null): void;
|
|
312
|
+
setChannel(sound: Sound, channel: Channel | null): void;
|
|
313
|
+
/**
|
|
314
|
+
* Whether a sound is silenced by its own mute, its channel's mute, or the master mute
|
|
315
|
+
*/
|
|
316
|
+
isMuted(name: SoundName): boolean;
|
|
317
|
+
isMuted(sound: Sound): boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Resolve a registered name or a bare {@apilink Sound} to the sound. A bare
|
|
320
|
+
* Sound resolves by identity (not by its own name) so aliases registered via
|
|
321
|
+
* `track('gold', coin)` work, and an untracked Sound resolves to itself.
|
|
322
|
+
*/
|
|
323
|
+
private _resolve;
|
|
324
|
+
/**
|
|
325
|
+
* Play a sound with optional one-off {@apilink PlayOptions}. Resolves to false if the sound
|
|
326
|
+
* is unknown or dropped by a concurrency cap. Muted sounds still play (silently) so they are
|
|
327
|
+
* audible mid-clip when unmuted.
|
|
328
|
+
*/
|
|
329
|
+
play(name: SoundName, options?: number | PlayOptions): Promise<boolean>;
|
|
330
|
+
play(sound: Sound, options?: number | PlayOptions): Promise<boolean>;
|
|
331
|
+
/**
|
|
332
|
+
* Like {@apilink SoundManager.play} but returns the {@apilink SoundTrack} synchronously, or
|
|
333
|
+
* `null` if the play was dropped.
|
|
334
|
+
*/
|
|
335
|
+
start(name: SoundName, options?: PlayOptions): SoundTrack | null;
|
|
336
|
+
start(sound: Sound, options?: PlayOptions): SoundTrack | null;
|
|
337
|
+
/**
|
|
338
|
+
* Returns whether a new track fits under `max`, stopping the oldest playing track among
|
|
339
|
+
* `sounds` first when voiceStealing is on
|
|
340
|
+
*/
|
|
341
|
+
private _makeRoom;
|
|
342
|
+
getSound(name: SoundName | AnyString): Sound | null;
|
|
343
|
+
getSound(sound: Sound): Sound;
|
|
344
|
+
/**
|
|
345
|
+
* Set the mix volume [0-1] of a tracked sound (or {@apilink Sound.volume} for an untracked one)
|
|
346
|
+
*/
|
|
347
|
+
setVolume(name: SoundName, volume?: number): void;
|
|
348
|
+
setVolume(sound: Sound, volume?: number): void;
|
|
349
|
+
/**
|
|
350
|
+
* Get the mix volume of a tracked sound (or {@apilink Sound.volume} for an untracked one)
|
|
351
|
+
*/
|
|
352
|
+
getVolume(name: SoundName): number;
|
|
353
|
+
getVolume(sound: Sound): number;
|
|
354
|
+
private _applyMix;
|
|
355
|
+
/**
|
|
356
|
+
* Start managing a sound, registered under `name`, the config's `name`, or the sound's own name.
|
|
357
|
+
* Its output is re-routed through the manager's mixer graph.
|
|
358
|
+
*/
|
|
359
|
+
track(sound: Sound | SoundConfig): void;
|
|
360
|
+
track(name: SoundName | AnyString, soundOrConfig: Sound | SoundConfig): void;
|
|
361
|
+
/**
|
|
362
|
+
* Stop managing a sound, restoring its output straight to the speakers
|
|
363
|
+
*/
|
|
364
|
+
untrack(name: SoundName): void;
|
|
365
|
+
untrack(sound: Sound): void;
|
|
366
|
+
stop(name?: SoundName): void;
|
|
367
|
+
stop(sound: Sound): void;
|
|
368
|
+
/**
|
|
369
|
+
* Mute a tracked sound, or the master output when no sound is given. Playback continues silently.
|
|
370
|
+
*/
|
|
371
|
+
mute(name?: SoundName): void;
|
|
372
|
+
mute(sound: Sound): void;
|
|
373
|
+
unmute(name?: SoundName): void;
|
|
374
|
+
unmute(sound: Sound): void;
|
|
375
|
+
toggle(name?: SoundName): void;
|
|
376
|
+
toggle(sound: Sound): void;
|
|
377
|
+
private _setMuted;
|
|
378
|
+
}
|