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,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context handed to an {@apilink AudioGraphBuilder} each time a {@apilink SoundTrack} starts or resumes
|
|
3
|
+
* The builder is responsible for connecting `source` to `destination` through any Web Audio nodes it likes
|
|
4
|
+
* (panners, filters, convolvers, analysers...).
|
|
5
|
+
*/
|
|
6
|
+
export interface AudioGraphContext {
|
|
7
|
+
/**
|
|
8
|
+
* The shared {@apilink AudioContext} for this engine, use it to create effect nodes.
|
|
9
|
+
*/
|
|
10
|
+
readonly audioContext: AudioContext;
|
|
11
|
+
/**
|
|
12
|
+
* The track's audio: the buffer source already routed through the track's own volume gain.
|
|
13
|
+
* Connect this (not `bufferSource`) to `destination`, or the per-play volume is bypassed.
|
|
14
|
+
* Excalibur disconnects it each time the track restarts or stops.
|
|
15
|
+
*/
|
|
16
|
+
readonly source: AudioNode;
|
|
17
|
+
/**
|
|
18
|
+
* The single-use {@apilink AudioBufferSourceNode} feeding `source`. It is fully configured
|
|
19
|
+
* (buffer, loop, playbackRate, detune) but not yet started, so you may schedule automation on
|
|
20
|
+
* its params. It is already connected to `source`; do not connect it anywhere else.
|
|
21
|
+
*/
|
|
22
|
+
readonly bufferSource: AudioBufferSourceNode;
|
|
23
|
+
/**
|
|
24
|
+
* The {@apilink Sound}'s output node (a {@apilink GainNode} that carries {@apilink Sound.volume}
|
|
25
|
+
* and is connected onwards to the speakers or a {@apilink SoundManager}). Anything you wire must
|
|
26
|
+
* eventually reach this node or the track will be silent.
|
|
27
|
+
*/
|
|
28
|
+
readonly destination: AudioNode;
|
|
29
|
+
/**
|
|
30
|
+
* The {@apilink SoundTrack} being (re)started, useful for correlation (e.g. as a `WeakMap` key
|
|
31
|
+
* for per-track effect state) and runtime reads.
|
|
32
|
+
*/
|
|
33
|
+
readonly track: SoundTrack;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Hook that wires the Web Audio graph for one playback of a {@apilink Sound}.
|
|
37
|
+
*
|
|
38
|
+
* It runs every time a track (re)starts a buffer source: on a fresh `play()`, and again when a
|
|
39
|
+
* paused or seeked track resumes, because Web Audio buffer sources are single use. Nodes you
|
|
40
|
+
* create outside the hook can be reused freely (connecting the same two nodes twice is a no-op in
|
|
41
|
+
* Web Audio), and Excalibur never disconnects nodes it did not create.
|
|
42
|
+
*
|
|
43
|
+
* If no hook is provided Excalibur wires `source → destination` directly.
|
|
44
|
+
*
|
|
45
|
+
* ```typescript
|
|
46
|
+
* // A low-pass filter shared by every playback of this sound
|
|
47
|
+
* const muffle = ex.AudioContextFactory.create().createBiquadFilter();
|
|
48
|
+
* muffle.type = 'lowpass';
|
|
49
|
+
* muffle.frequency.value = 400;
|
|
50
|
+
*
|
|
51
|
+
* const sound = new ex.Sound({
|
|
52
|
+
* paths: ['/sfx/explosion.ogg'],
|
|
53
|
+
* onPlay: ({ source, destination }) => {
|
|
54
|
+
* source.connect(muffle).connect(destination);
|
|
55
|
+
* }
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Spatial audio positioned per play
|
|
59
|
+
* sound.play({
|
|
60
|
+
* onPlay: ({ audioContext, source, destination }) => {
|
|
61
|
+
* const panner = audioContext.createPanner();
|
|
62
|
+
* panner.positionX.value = enemy.pos.x;
|
|
63
|
+
* source.connect(panner).connect(destination);
|
|
64
|
+
* }
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export type AudioGraphBuilder = (ctx: AudioGraphContext) => void;
|
|
69
|
+
/**
|
|
70
|
+
* A single playback of a {@apilink Sound}. Produced by `Sound.play()`, `Sound.start()` and
|
|
71
|
+
* `Sound.seek()`, see {@apilink Sound.instances}.
|
|
72
|
+
*
|
|
73
|
+
* Wraps a single-use Web Audio `AudioBufferSourceNode` routed through a per-track volume gain;
|
|
74
|
+
* a fresh buffer source is allocated each time the track (re)starts.
|
|
75
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API
|
|
76
|
+
*/
|
|
77
|
+
export declare class SoundTrack {
|
|
78
|
+
private _buffer;
|
|
79
|
+
private _destination;
|
|
80
|
+
private _onPlay?;
|
|
81
|
+
private static _NEXT_ID;
|
|
82
|
+
/**
|
|
83
|
+
* Monotonically increasing id, older tracks have lower ids
|
|
84
|
+
*/
|
|
85
|
+
readonly id: number;
|
|
86
|
+
private _audioContext;
|
|
87
|
+
private _gain;
|
|
88
|
+
private _source;
|
|
89
|
+
private _playingFuture;
|
|
90
|
+
private _playStarted;
|
|
91
|
+
/**
|
|
92
|
+
* Buffer offset in seconds to start from on the next (re)start
|
|
93
|
+
*/
|
|
94
|
+
private _offset;
|
|
95
|
+
/**
|
|
96
|
+
* Audio context time and buffer offset at which the current source started
|
|
97
|
+
*/
|
|
98
|
+
private _startedAt;
|
|
99
|
+
private _startOffset;
|
|
100
|
+
private _stateMachine;
|
|
101
|
+
/**
|
|
102
|
+
* @param _buffer The decoded audio to play
|
|
103
|
+
* @param _destination The node this track is wired into (the owning Sound's output)
|
|
104
|
+
* @param _onPlay Optional hook that wires `source → destination`, see {@apilink AudioGraphBuilder}
|
|
105
|
+
*/
|
|
106
|
+
constructor(_buffer: AudioBuffer, _destination: AudioNode, _onPlay?: AudioGraphBuilder | undefined);
|
|
107
|
+
/**
|
|
108
|
+
* Allocate and configure a fresh single-use buffer source and (re)wire the track into the graph
|
|
109
|
+
*/
|
|
110
|
+
private _createSource;
|
|
111
|
+
/**
|
|
112
|
+
* Stop and disconnect the current single-use source, if any
|
|
113
|
+
*/
|
|
114
|
+
private _disconnectSource;
|
|
115
|
+
private _volume;
|
|
116
|
+
/**
|
|
117
|
+
* Volume [0-1] of this track only, multiplied with {@apilink Sound.volume}. Default 1.
|
|
118
|
+
*/
|
|
119
|
+
get volume(): number;
|
|
120
|
+
set volume(value: number);
|
|
121
|
+
private _loop;
|
|
122
|
+
/**
|
|
123
|
+
* Loop infinitely, when changed the live source is updated
|
|
124
|
+
*/
|
|
125
|
+
get loop(): boolean;
|
|
126
|
+
set loop(value: boolean);
|
|
127
|
+
private _playbackRate;
|
|
128
|
+
/**
|
|
129
|
+
* Playback speed multiplier, default 1
|
|
130
|
+
*/
|
|
131
|
+
get playbackRate(): number;
|
|
132
|
+
set playbackRate(playbackRate: number);
|
|
133
|
+
private _pitch;
|
|
134
|
+
/**
|
|
135
|
+
* Pitch shift in cents (a semitone is 100 cents), default 0. Backed by
|
|
136
|
+
* {@apilink AudioBufferSourceNode.detune} and composes with {@apilink SoundTrack.playbackRate}.
|
|
137
|
+
* Note: detune also changes playback speed, this is a Web Audio limitation.
|
|
138
|
+
*/
|
|
139
|
+
get pitch(): number;
|
|
140
|
+
set pitch(pitch: number);
|
|
141
|
+
private _duration;
|
|
142
|
+
/**
|
|
143
|
+
* The duration in seconds this track plays for, or the buffer's total duration when unset.
|
|
144
|
+
*
|
|
145
|
+
* Note: the duration starts from the seeked position, seeking a 10 second clip to 5 seconds and
|
|
146
|
+
* setting a duration of 2 plays seconds 5-7.
|
|
147
|
+
*/
|
|
148
|
+
get duration(): number;
|
|
149
|
+
set duration(duration: number | undefined);
|
|
150
|
+
/**
|
|
151
|
+
* Audio context time in seconds at which the next (re)start is scheduled, 0 means immediately
|
|
152
|
+
*/
|
|
153
|
+
scheduledStartTime: number;
|
|
154
|
+
/**
|
|
155
|
+
* Resolves when the track completes or is stopped
|
|
156
|
+
*/
|
|
157
|
+
get done(): Promise<boolean>;
|
|
158
|
+
isPlaying(): boolean;
|
|
159
|
+
isPaused(): boolean;
|
|
160
|
+
isStopped(): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Start or resume playback, resolves when the track stops or completes
|
|
163
|
+
*/
|
|
164
|
+
play(playStarted?: () => any): Promise<boolean>;
|
|
165
|
+
pause(): void;
|
|
166
|
+
stop(): void;
|
|
167
|
+
/**
|
|
168
|
+
* Move to a position in seconds, the track is paused until the next play()
|
|
169
|
+
*/
|
|
170
|
+
seek(position: number): void;
|
|
171
|
+
getTotalPlaybackDuration(): number;
|
|
172
|
+
/**
|
|
173
|
+
* Current position in the buffer in seconds
|
|
174
|
+
*/
|
|
175
|
+
getPlaybackPosition(): number;
|
|
176
|
+
}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { SoundTrack, type AudioGraphBuilder } from './sound-track';
|
|
2
|
+
import { NativeSoundEvent, NativeSoundProcessedEvent } from '../../events/media-events';
|
|
3
|
+
import type { Loadable } from '../../interfaces/index';
|
|
4
|
+
import type { Engine } from '../../engine';
|
|
5
|
+
import { Logger } from '../../util/log';
|
|
6
|
+
import type { EventKey, Handler, Subscription } from '../../event-emitter';
|
|
7
|
+
import { EventEmitter } from '../../event-emitter';
|
|
8
|
+
export interface SoundEvents {
|
|
9
|
+
volumechange: NativeSoundEvent;
|
|
10
|
+
processed: NativeSoundProcessedEvent;
|
|
11
|
+
pause: NativeSoundEvent;
|
|
12
|
+
stop: NativeSoundEvent;
|
|
13
|
+
playbackend: NativeSoundEvent;
|
|
14
|
+
resume: NativeSoundEvent;
|
|
15
|
+
playbackstart: NativeSoundEvent;
|
|
16
|
+
}
|
|
17
|
+
export declare const SoundEvents: {
|
|
18
|
+
VolumeChange: string;
|
|
19
|
+
Processed: string;
|
|
20
|
+
Pause: string;
|
|
21
|
+
Stop: string;
|
|
22
|
+
PlaybackEnd: string;
|
|
23
|
+
Resume: string;
|
|
24
|
+
PlaybackStart: string;
|
|
25
|
+
};
|
|
26
|
+
export interface SoundOptions<TName extends string = string> {
|
|
27
|
+
/**
|
|
28
|
+
* Optional explicit name for this sound. Used as the default key when this
|
|
29
|
+
* Sound is registered with a {@apilink SoundManager} (otherwise the basename
|
|
30
|
+
* without extension of the selected path is used, e.g. `/sfx/coin.mp3` → `coin`).
|
|
31
|
+
*
|
|
32
|
+
* If passed as a string literal, it is inferred as the {@apilink Sound}'s
|
|
33
|
+
* name type parameter for strong typing.
|
|
34
|
+
*/
|
|
35
|
+
name?: TName;
|
|
36
|
+
/**
|
|
37
|
+
* @param paths A list of audio sources (clip.wav, clip.mp3, clip.ogg) for this audio clip. This is done for browser compatibility.
|
|
38
|
+
*/
|
|
39
|
+
paths: string[];
|
|
40
|
+
/**
|
|
41
|
+
* Optionally bust the cache on load
|
|
42
|
+
*
|
|
43
|
+
* Default is false
|
|
44
|
+
*/
|
|
45
|
+
bustCache?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* [0-1] 0% to 100%
|
|
48
|
+
*
|
|
49
|
+
* By default 1 (100%)
|
|
50
|
+
*/
|
|
51
|
+
volume?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Loop infinitely
|
|
54
|
+
*/
|
|
55
|
+
loop?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Multiplyer
|
|
58
|
+
*
|
|
59
|
+
* By default 1
|
|
60
|
+
*/
|
|
61
|
+
playbackRate?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Pitch shift in cents (semitones are 100 cents). Default 0 (no change).
|
|
64
|
+
* Backed by {@apilink AudioBufferSourceNode.detune}; composes with
|
|
65
|
+
* {@apilink Sound.playbackRate}. Note: changing pitch also affects playback
|
|
66
|
+
* speed (this is a Web Audio limitation).
|
|
67
|
+
*/
|
|
68
|
+
pitch?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Seconds?
|
|
71
|
+
*
|
|
72
|
+
* By default unset, will play the natural length of the clip
|
|
73
|
+
*/
|
|
74
|
+
duration?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Advance to a position in the audio clip
|
|
77
|
+
*/
|
|
78
|
+
position?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum number of simultaneously playing tracks allowed for this single
|
|
81
|
+
* Sound. When the cap is reached, new `play()` calls are dropped and resolve
|
|
82
|
+
* to `false`. Default unset (unbounded).
|
|
83
|
+
*/
|
|
84
|
+
maxConcurrentTracks?: number;
|
|
85
|
+
/**
|
|
86
|
+
* What happens when a `maxConcurrentTracks` cap
|
|
87
|
+
* *`false` (default) drops the new play
|
|
88
|
+
* *`true` stops the oldest playing track in that scope to make room for it.
|
|
89
|
+
*/
|
|
90
|
+
voiceStealing?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Optional hook to wire custom Web Audio nodes (spatial panners, filters,
|
|
93
|
+
* reverb, analysers...) between this sound's source and its output. Runs each
|
|
94
|
+
* time a track (re)starts. See {@apilink AudioGraphBuilder}.
|
|
95
|
+
*/
|
|
96
|
+
onPlay?: AudioGraphBuilder;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* One-off overrides for a single playback, see {@apilink Sound.play}. Unset options fall back to the
|
|
100
|
+
* {@apilink Sound}'s configuration; nothing here changes the Sound itself.
|
|
101
|
+
*/
|
|
102
|
+
export interface PlayOptions {
|
|
103
|
+
/**
|
|
104
|
+
* Volume [0-1] of this track, multiplied with {@apilink Sound.volume}. Default 1.
|
|
105
|
+
*/
|
|
106
|
+
volume?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Pitch shift in cents for this track, overrides {@apilink Sound.pitch}
|
|
109
|
+
*/
|
|
110
|
+
pitch?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Playback speed multiplier for this track, overrides {@apilink Sound.playbackRate}
|
|
113
|
+
*/
|
|
114
|
+
playbackRate?: number;
|
|
115
|
+
/**
|
|
116
|
+
* Loop this track, overrides {@apilink Sound.loop}
|
|
117
|
+
*/
|
|
118
|
+
loop?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Position in seconds to start this track from, overrides {@apilink Sound.position}
|
|
121
|
+
*/
|
|
122
|
+
position?: number;
|
|
123
|
+
/**
|
|
124
|
+
* Duration in seconds to play this track for, overrides {@apilink Sound.duration}
|
|
125
|
+
*/
|
|
126
|
+
duration?: number;
|
|
127
|
+
/**
|
|
128
|
+
* Schedule time to play in milliseconds from the audio context origin
|
|
129
|
+
*
|
|
130
|
+
* Compute using the audio context
|
|
131
|
+
*
|
|
132
|
+
* ```typescript
|
|
133
|
+
* const sound: Sound = ...;
|
|
134
|
+
* const oneThousandMillisecondsFromNow = AudioContextFactory.currentTime() + 1000;
|
|
135
|
+
*
|
|
136
|
+
* sound.play({ scheduledStartTime: oneThousandMillisecondsFromNow });
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
scheduledStartTime?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Audio graph hook for this track (and its later resumes), overrides {@apilink Sound.onPlay}.
|
|
142
|
+
* See {@apilink AudioGraphBuilder}.
|
|
143
|
+
*/
|
|
144
|
+
onPlay?: AudioGraphBuilder;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The {@apilink Sound} object allows games built in Excalibur to load audio
|
|
148
|
+
* components, from soundtracks to sound effects. {@apilink Sound} is an {@apilink Loadable}
|
|
149
|
+
* which means it can be passed to a {@apilink Loader} to pre-load before a game or level.
|
|
150
|
+
*
|
|
151
|
+
*/
|
|
152
|
+
export declare class Sound<const TName extends string = string> implements Loadable<AudioBuffer> {
|
|
153
|
+
events: EventEmitter<SoundEvents>;
|
|
154
|
+
logger: Logger;
|
|
155
|
+
data: AudioBuffer;
|
|
156
|
+
private _resource;
|
|
157
|
+
/**
|
|
158
|
+
* The registered name of this Sound. Either the explicit `name` option or
|
|
159
|
+
* the basename-without-extension of the selected path. Used as the default
|
|
160
|
+
* key when registered with a {@apilink SoundManager}.
|
|
161
|
+
*/
|
|
162
|
+
readonly name: TName;
|
|
163
|
+
/**
|
|
164
|
+
* Position in seconds new tracks start from, see {@apilink PlayOptions.position} for a one-off
|
|
165
|
+
*/
|
|
166
|
+
position: number | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Indicates whether the clip should loop when complete
|
|
169
|
+
* @param value Set the looping flag
|
|
170
|
+
*/
|
|
171
|
+
set loop(value: boolean);
|
|
172
|
+
get loop(): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Volume [0-1] applied to every track of this sound, ramped smoothly while playing
|
|
175
|
+
*/
|
|
176
|
+
set volume(value: number);
|
|
177
|
+
get volume(): number;
|
|
178
|
+
private _duration;
|
|
179
|
+
/**
|
|
180
|
+
* Get the duration that this audio should play. If unset the total natural playback duration will be used.
|
|
181
|
+
*/
|
|
182
|
+
get duration(): number | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Set the duration that this audio should play. If unset the total natural playback duration will be used.
|
|
185
|
+
*
|
|
186
|
+
* Note: if you seek to a specific point the duration will start from that point, for example
|
|
187
|
+
*
|
|
188
|
+
* If you have a 10 second clip, seek to 5 seconds, then set the duration to 2, it will play the clip from 5-7 seconds.
|
|
189
|
+
*/
|
|
190
|
+
set duration(duration: number | undefined);
|
|
191
|
+
/**
|
|
192
|
+
* Return array of Current {@apilink SoundTrack} instances playing or being paused
|
|
193
|
+
*/
|
|
194
|
+
get instances(): SoundTrack[];
|
|
195
|
+
get path(): string;
|
|
196
|
+
set path(val: string);
|
|
197
|
+
/**
|
|
198
|
+
* Should excalibur add a cache busting querystring? By default false.
|
|
199
|
+
* Must be set before loading
|
|
200
|
+
*/
|
|
201
|
+
get bustCache(): boolean;
|
|
202
|
+
set bustCache(val: boolean);
|
|
203
|
+
private _loop;
|
|
204
|
+
private _volume;
|
|
205
|
+
private _isStopped;
|
|
206
|
+
private _tracks;
|
|
207
|
+
private _engine?;
|
|
208
|
+
private _wasPlayingOnHidden;
|
|
209
|
+
private _playbackRate;
|
|
210
|
+
private _pitch;
|
|
211
|
+
maxConcurrentTracks: number;
|
|
212
|
+
voiceStealing: boolean;
|
|
213
|
+
private _audioContext;
|
|
214
|
+
/**
|
|
215
|
+
* Output gain shared by every track of this sound, created on first use
|
|
216
|
+
*/
|
|
217
|
+
private _output?;
|
|
218
|
+
/**
|
|
219
|
+
* Construct a Sound from an options object with an explicit `name`. The class
|
|
220
|
+
* generic `TName` is inferred from the `name` literal when one is provided.
|
|
221
|
+
*/
|
|
222
|
+
constructor(options: SoundOptions<TName>);
|
|
223
|
+
/**
|
|
224
|
+
* Construct a Sound from a variadic list of audio source paths. `TName` defaults to `string`
|
|
225
|
+
*/
|
|
226
|
+
constructor(...paths: string[]);
|
|
227
|
+
/**
|
|
228
|
+
* Whether or not the browser can play this file as HTML5 Audio
|
|
229
|
+
*/
|
|
230
|
+
static canPlayFile(file: string): boolean;
|
|
231
|
+
static canPlayMime(mime: string): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* Optional hook to wire custom Web Audio nodes between this sound's source
|
|
234
|
+
* and its output, runs each time a track (re)starts. See {@apilink AudioGraphBuilder}.
|
|
235
|
+
*/
|
|
236
|
+
onPlay?: AudioGraphBuilder;
|
|
237
|
+
/**
|
|
238
|
+
* Pitch shift in cents (semitones are 100 cents). Default 0 (no change).
|
|
239
|
+
* Backed by {@apilink AudioBufferSourceNode.detune}; composes with
|
|
240
|
+
* {@apilink Sound.playbackRate}. Note: changing pitch also affects playback
|
|
241
|
+
* speed (this is a Web Audio limitation).
|
|
242
|
+
*/
|
|
243
|
+
get pitch(): number;
|
|
244
|
+
set pitch(pitch: number);
|
|
245
|
+
isLoaded(): boolean;
|
|
246
|
+
load(): Promise<AudioBuffer>;
|
|
247
|
+
decodeAudio(data: ArrayBuffer): Promise<AudioBuffer>;
|
|
248
|
+
wireEngine(engine: Engine): void;
|
|
249
|
+
/**
|
|
250
|
+
* Returns how many tracks of the sound currently exist (playing or paused)
|
|
251
|
+
*/
|
|
252
|
+
instanceCount(): number;
|
|
253
|
+
/**
|
|
254
|
+
* Returns how many tracks of the sound are currently playing
|
|
255
|
+
*/
|
|
256
|
+
playingCount(): number;
|
|
257
|
+
/**
|
|
258
|
+
* Whether or not the sound is playing right now
|
|
259
|
+
*/
|
|
260
|
+
isPlaying(): boolean;
|
|
261
|
+
isPaused(): boolean;
|
|
262
|
+
isStopped(): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Play a new track of this sound, returns a promise that resolves when that track is done
|
|
265
|
+
* playing (false if the play was dropped, e.g. by {@apilink Sound.maxConcurrentTracks}).
|
|
266
|
+
*
|
|
267
|
+
* Options apply to this track only and never change the Sound's own configuration:
|
|
268
|
+
*
|
|
269
|
+
* ```typescript
|
|
270
|
+
* sound.play(); // the sound as configured
|
|
271
|
+
* sound.play({ volume: 0.3, pitch: -200 }); // quieter and lower, this time only
|
|
272
|
+
* sound.play({ position: 2, duration: 1 }); // one second starting two seconds in
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* To continue paused tracks use {@apilink Sound.resume}, to get a handle on the track
|
|
276
|
+
* use {@apilink Sound.start}.
|
|
277
|
+
*/
|
|
278
|
+
play(options?: PlayOptions): Promise<boolean>;
|
|
279
|
+
/**
|
|
280
|
+
* Play a new track at a volume [0-1] (multiplied with {@apilink Sound.volume}) for this track only
|
|
281
|
+
* @deprecated Use `play({ volume })` instead. Will be removed in v1.x
|
|
282
|
+
*/
|
|
283
|
+
play(volume: number): Promise<boolean>;
|
|
284
|
+
private _makeRoom;
|
|
285
|
+
/**
|
|
286
|
+
* Like {@apilink Sound.play} but returns the {@apilink SoundTrack} synchronously so it can be
|
|
287
|
+
* stopped, seeked or adjusted while it plays. Returns `null` if the play was dropped.
|
|
288
|
+
*
|
|
289
|
+
* ```typescript
|
|
290
|
+
* const footstep = sound.start({ volume: 0.5 });
|
|
291
|
+
* footstep?.stop();
|
|
292
|
+
* await footstep?.done;
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
start(options?: PlayOptions): SoundTrack | null;
|
|
296
|
+
/**
|
|
297
|
+
* Resume every paused (or seeked) track, resolves when they are done playing.
|
|
298
|
+
* Resolves `false` immediately if nothing was paused.
|
|
299
|
+
*/
|
|
300
|
+
resume(): Promise<boolean>;
|
|
301
|
+
/**
|
|
302
|
+
* Stop the sound, and do not rewind
|
|
303
|
+
*/
|
|
304
|
+
pause(): void;
|
|
305
|
+
/**
|
|
306
|
+
* Stop the sound if it is currently playing and rewind the track. If the sound is not playing, rewinds the track.
|
|
307
|
+
*/
|
|
308
|
+
stop(): void;
|
|
309
|
+
get playbackRate(): number;
|
|
310
|
+
set playbackRate(playbackRate: number);
|
|
311
|
+
/**
|
|
312
|
+
* Seek a track to a position in seconds, the track is paused until the next {@apilink Sound.resume}.
|
|
313
|
+
*
|
|
314
|
+
* If no track exists one is created so that `seek(); resume()` starts from the position.
|
|
315
|
+
*/
|
|
316
|
+
seek(position: number, trackId?: number): void;
|
|
317
|
+
getTotalPlaybackDuration(): number;
|
|
318
|
+
/**
|
|
319
|
+
* Return the current playback time of the playing track in seconds from the start.
|
|
320
|
+
*
|
|
321
|
+
* Optionally specify the track to query if multiple are playing at once.
|
|
322
|
+
* @param trackId
|
|
323
|
+
*/
|
|
324
|
+
getPlaybackPosition(trackId?: number): number;
|
|
325
|
+
/**
|
|
326
|
+
* Get Id of provided {@apilink SoundTrack} in current trackList
|
|
327
|
+
* @param track {@apilink SoundTrack} which Id is to be given
|
|
328
|
+
*/
|
|
329
|
+
getTrackId(track: SoundTrack): number;
|
|
330
|
+
private _removeTrack;
|
|
331
|
+
/**
|
|
332
|
+
* The {@apilink GainNode} every track of this sound is mixed into, carrying {@apilink Sound.volume}.
|
|
333
|
+
* Connected straight to the audio context destination until a {@apilink SoundManager} re-routes it
|
|
334
|
+
* through its mixer graph.
|
|
335
|
+
*/
|
|
336
|
+
get output(): GainNode;
|
|
337
|
+
/**
|
|
338
|
+
* Snapshot the sound's configuration, overlaid with per-play overrides, into a new track
|
|
339
|
+
*/
|
|
340
|
+
private _createTrack;
|
|
341
|
+
emit<TEventName extends EventKey<SoundEvents>>(eventName: TEventName, event: SoundEvents[TEventName]): void;
|
|
342
|
+
emit(eventName: string, event?: any): void;
|
|
343
|
+
on<TEventName extends EventKey<SoundEvents>>(eventName: TEventName, handler: Handler<SoundEvents[TEventName]>): Subscription;
|
|
344
|
+
on(eventName: string, handler: Handler<unknown>): Subscription;
|
|
345
|
+
once<TEventName extends EventKey<SoundEvents>>(eventName: TEventName, handler: Handler<SoundEvents[TEventName]>): Subscription;
|
|
346
|
+
once(eventName: string, handler: Handler<unknown>): Subscription;
|
|
347
|
+
off<TEventName extends EventKey<SoundEvents>>(eventName: TEventName, handler: Handler<SoundEvents[TEventName]>): void;
|
|
348
|
+
off(eventName: string, handler: Handler<unknown>): void;
|
|
349
|
+
off(eventName: string): void;
|
|
350
|
+
static fromBlob(blob: Blob): Promise<Sound<string>>;
|
|
351
|
+
}
|
|
@@ -73,8 +73,12 @@ export declare function isSceneConstructor(x: any): x is SceneConstructor;
|
|
|
73
73
|
* 5. onPostUpdate - called every update
|
|
74
74
|
* 6. onPreDraw - called every draw
|
|
75
75
|
* 7. onPostDraw - called every draw
|
|
76
|
-
* 8. onDeactivate - called
|
|
76
|
+
* 8. onDeactivate - called the first frame the scene is no longer current
|
|
77
77
|
*
|
|
78
|
+
* Each lifecycle stage also fires corresponding {@apilink Plugin} hooks:
|
|
79
|
+
* `onScenePreInitialize`/`onScenePostInitialize`,
|
|
80
|
+
* `onScenePreActivate`/`onScenePostActivate`,
|
|
81
|
+
* `onScenePreDeactivate`/`onScenePostDeactivate`.
|
|
78
82
|
*/
|
|
79
83
|
export declare class Scene<TActivationData = unknown> implements CanInitialize, CanActivate<TActivationData>, CanDeactivate, CanUpdate, CanDraw {
|
|
80
84
|
private _logger;
|
|
@@ -123,6 +127,7 @@ export declare class Scene<TActivationData = unknown> implements CanInitialize,
|
|
|
123
127
|
*/
|
|
124
128
|
input: InputHost;
|
|
125
129
|
private _isInitialized;
|
|
130
|
+
private _lastLightingEnabled;
|
|
126
131
|
private _timers;
|
|
127
132
|
get timers(): readonly Timer[];
|
|
128
133
|
private _cancelQueue;
|
|
@@ -155,7 +160,7 @@ export declare class Scene<TActivationData = unknown> implements CanInitialize,
|
|
|
155
160
|
*
|
|
156
161
|
* This can be used to configure custom transitions for a scene dynamically
|
|
157
162
|
*/
|
|
158
|
-
onTransition(direction: 'in' | 'out'): Transition |
|
|
163
|
+
onTransition(direction: 'in' | 'out'): Transition | null;
|
|
159
164
|
/**
|
|
160
165
|
* This is called before the first update of the {@apilink Scene}. Initializes scene members like the camera. This method is meant to be
|
|
161
166
|
* overridden. This is where initialization of child actors should take place.
|
|
@@ -181,7 +186,7 @@ export declare class Scene<TActivationData = unknown> implements CanInitialize,
|
|
|
181
186
|
*/
|
|
182
187
|
onPreUpdate(engine: Engine, elapsed: number): void;
|
|
183
188
|
/**
|
|
184
|
-
* Safe to override onPostUpdate lifecycle event handler. Synonymous with `.on('
|
|
189
|
+
* Safe to override onPostUpdate lifecycle event handler. Synonymous with `.on('postupdate', (evt) =>{...})`
|
|
185
190
|
*
|
|
186
191
|
* `onPostUpdate` is called directly after a scene is updated.
|
|
187
192
|
* @param engine reference to the engine
|
|
@@ -189,14 +194,14 @@ export declare class Scene<TActivationData = unknown> implements CanInitialize,
|
|
|
189
194
|
*/
|
|
190
195
|
onPostUpdate(engine: Engine, elapsed: number): void;
|
|
191
196
|
/**
|
|
192
|
-
* Safe to override onPreDraw lifecycle event handler. Synonymous with `.on('
|
|
197
|
+
* Safe to override onPreDraw lifecycle event handler. Synonymous with `.on('predraw', (evt) =>{...})`
|
|
193
198
|
*
|
|
194
199
|
* `onPreDraw` is called directly before a scene is drawn.
|
|
195
200
|
*
|
|
196
201
|
*/
|
|
197
202
|
onPreDraw(ctx: ExcaliburGraphicsContext, elapsed: number): void;
|
|
198
203
|
/**
|
|
199
|
-
* Safe to override onPostDraw lifecycle event handler. Synonymous with `.on('
|
|
204
|
+
* Safe to override onPostDraw lifecycle event handler. Synonymous with `.on('postdraw', (evt) =>{...})`
|
|
200
205
|
*
|
|
201
206
|
* `onPostDraw` is called directly after a scene is drawn.
|
|
202
207
|
*
|
|
@@ -260,6 +265,7 @@ export declare class Scene<TActivationData = unknown> implements CanInitialize,
|
|
|
260
265
|
* @internal
|
|
261
266
|
*/
|
|
262
267
|
_postdraw(ctx: ExcaliburGraphicsContext, elapsed: number): void;
|
|
268
|
+
private _checkEnableDisableSystems;
|
|
263
269
|
/**
|
|
264
270
|
* Updates all the actors and timers in the scene. Called by the {@apilink Engine}.
|
|
265
271
|
* @param engine Reference to the current Engine
|
|
@@ -408,6 +414,6 @@ export declare class Scene<TActivationData = unknown> implements CanInitialize,
|
|
|
408
414
|
isTimerActive(timer: Timer): boolean;
|
|
409
415
|
isCurrentScene(): boolean;
|
|
410
416
|
private _collectActorStats;
|
|
411
|
-
|
|
412
|
-
|
|
417
|
+
pause(): void;
|
|
418
|
+
resume(): void;
|
|
413
419
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Engine } from './engine';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ActorOptions } from './actor';
|
|
3
3
|
import { Actor } from './actor';
|
|
4
4
|
/**
|
|
5
5
|
* Type guard to detect a screen element
|
|
@@ -12,7 +12,7 @@ export declare function isScreenElement(actor: Actor): actor is ScreenElement;
|
|
|
12
12
|
export declare class ScreenElement extends Actor {
|
|
13
13
|
protected _engine: Engine;
|
|
14
14
|
constructor();
|
|
15
|
-
constructor(config?:
|
|
15
|
+
constructor(config?: ActorOptions);
|
|
16
16
|
_initialize(engine: Engine): void;
|
|
17
17
|
contains(x: number, y: number, useWorld?: boolean): boolean;
|
|
18
18
|
}
|