melonjs 19.4.0 → 19.6.0
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/README.md +18 -2
- package/build/application/application.d.ts.map +1 -1
- package/build/application/settings.d.ts +25 -2
- package/build/application/settings.d.ts.map +1 -1
- package/build/audio/audio.d.ts +77 -253
- package/build/audio/audio.d.ts.map +1 -1
- package/build/audio/backend.d.ts +121 -0
- package/build/audio/backend.d.ts.map +1 -0
- package/build/audio/playback.d.ts +157 -0
- package/build/audio/playback.d.ts.map +1 -0
- package/build/audio/procedural.d.ts +105 -0
- package/build/audio/procedural.d.ts.map +1 -0
- package/build/audio/types.d.ts +205 -0
- package/build/audio/types.d.ts.map +1 -0
- package/build/index.d.ts +6 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2447 -396
- package/build/index.js.map +4 -4
- package/build/level/tiled/TMXTileMap.d.ts.map +1 -1
- package/build/level/tiled/TMXTileset.d.ts +12 -0
- package/build/level/tiled/TMXTileset.d.ts.map +1 -1
- package/build/level/tiled/factories/shape.d.ts +1 -1
- package/build/level/tiled/factories/shape.d.ts.map +1 -1
- package/build/level/tiled/factories/tile.d.ts.map +1 -1
- package/build/loader/loader.d.ts +2 -2
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/aseprite.d.ts +37 -0
- package/build/loader/parsers/aseprite.d.ts.map +1 -0
- package/build/physics/adapter.d.ts +560 -0
- package/build/physics/adapter.d.ts.map +1 -0
- package/build/physics/bounds.d.ts +18 -5
- package/build/physics/bounds.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +605 -0
- package/build/physics/builtin/body.d.ts.map +1 -0
- package/build/physics/builtin/builtin-adapter.d.ts +91 -0
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -0
- package/build/physics/builtin/detector.d.ts +167 -0
- package/build/physics/builtin/detector.d.ts.map +1 -0
- package/build/physics/builtin/quadtree.d.ts +112 -0
- package/build/physics/builtin/quadtree.d.ts.map +1 -0
- package/build/physics/builtin/raycast.d.ts +4 -0
- package/build/physics/builtin/raycast.d.ts.map +1 -0
- package/build/physics/{sat.d.ts → builtin/sat.d.ts} +7 -7
- package/build/physics/builtin/sat.d.ts.map +1 -0
- package/build/physics/world.d.ts +61 -26
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/collectable.d.ts +7 -1
- package/build/renderable/collectable.d.ts.map +1 -1
- package/build/renderable/container.d.ts +0 -13
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +78 -17
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +14 -1
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/renderable/ui/uispriteelement.d.ts.map +1 -1
- package/build/system/timer.d.ts +0 -5
- package/build/system/timer.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +0 -130
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/renderer.d.ts +111 -0
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/effects/shine.d.ts +87 -0
- package/build/video/webgl/effects/shine.d.ts.map +1 -0
- package/build/video/webgl/glshader.d.ts +46 -16
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/shadereffect.d.ts +23 -4
- package/build/video/webgl/shadereffect.d.ts.map +1 -1
- package/build/video/webgl/utils/uniforms.d.ts +8 -0
- package/build/video/webgl/utils/uniforms.d.ts.map +1 -1
- package/build/video/webgl/webgl_renderer.d.ts +0 -106
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/build/physics/body.d.ts +0 -351
- package/build/physics/body.d.ts.map +0 -1
- package/build/physics/detector.d.ts +0 -72
- package/build/physics/detector.d.ts.map +0 -1
- package/build/physics/quadtree.d.ts +0 -69
- package/build/physics/quadtree.d.ts.map +0 -1
- package/build/physics/sat.d.ts.map +0 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audio backend — the shared internal surface every other audio module
|
|
3
|
+
* (procedural, playback) builds on. Keeps the Howler reference and the
|
|
4
|
+
* cross-module mutable state in one place so the public surface modules
|
|
5
|
+
* stay backend-agnostic.
|
|
6
|
+
*
|
|
7
|
+
* Not part of the public `me.audio.*` API — the two getters
|
|
8
|
+
* `getAudioContext` / `getMasterGain` are re-exported from `audio.ts`
|
|
9
|
+
* for end users; everything else (the `state` object, `soundLoadError`)
|
|
10
|
+
* is internal.
|
|
11
|
+
*/
|
|
12
|
+
import { Howl } from "howler";
|
|
13
|
+
/**
|
|
14
|
+
* Whether to stop on an audio loading error.
|
|
15
|
+
*
|
|
16
|
+
* When `true`, melonJS throws an exception and aborts loading.
|
|
17
|
+
* When `false`, melonJS disables sound and logs a warning to the console.
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
export declare let stopOnAudioError: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Cross-module mutable state. A single object so multiple consumers
|
|
23
|
+
* can read and mutate the same fields without the "ESM `let` exports
|
|
24
|
+
* don't share writes across modules" footgun.
|
|
25
|
+
*
|
|
26
|
+
* Fields:
|
|
27
|
+
* - `tracks` — loaded Howl instances keyed by logical sound name.
|
|
28
|
+
* `Howl | undefined` because missing keys return undefined at runtime
|
|
29
|
+
* even though the type signature wouldn't normally admit it.
|
|
30
|
+
* - `currentTrackId` — the name of the currently-playing track managed
|
|
31
|
+
* by the `playTrack` / `stopTrack` helpers.
|
|
32
|
+
* - `retryCounter` — retry counter for `soundLoadError`'s back-off.
|
|
33
|
+
* - `audioExts` — the active list of audio formats set by `init`.
|
|
34
|
+
* @ignore
|
|
35
|
+
*/
|
|
36
|
+
export declare const state: {
|
|
37
|
+
tracks: Record<string, Howl | undefined>;
|
|
38
|
+
currentTrackId: string | null;
|
|
39
|
+
retryCounter: number;
|
|
40
|
+
audioExts: string[];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Look up a loaded `Howl` instance by logical name, or throw a
|
|
44
|
+
* uniform "audio clip X does not exist" error if it isn't loaded.
|
|
45
|
+
* Used by every per-clip helper across `playback.ts` / `audio.ts` so
|
|
46
|
+
* the error contract stays identical across the whole surface.
|
|
47
|
+
* @ignore
|
|
48
|
+
*/
|
|
49
|
+
export declare function getSoundOrThrow(sound_name: string): Howl;
|
|
50
|
+
/**
|
|
51
|
+
* Event listener callback on load error. Retries the load up to 3
|
|
52
|
+
* times, then either throws or disables audio (depending on the
|
|
53
|
+
* `stopOnAudioError` flag re-exported from `audio.ts`).
|
|
54
|
+
* @ignore
|
|
55
|
+
*/
|
|
56
|
+
export declare const soundLoadError: (sound_name: string, onerror_cb?: () => void, stopOnError?: boolean) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the underlying WebAudio `AudioContext` used by the audio
|
|
59
|
+
* module (the same one shared with file-based playback), or `null` if
|
|
60
|
+
* audio is disabled or no compatible WebAudio implementation is
|
|
61
|
+
* available.
|
|
62
|
+
*
|
|
63
|
+
* Use this when you need to build a custom WebAudio graph — procedural
|
|
64
|
+
* SFX, custom filters / spatial nodes, audio analysis — without
|
|
65
|
+
* spawning a second context. Browsers throttle or refuse multiple
|
|
66
|
+
* `AudioContext` instances on the same page and each has its own
|
|
67
|
+
* suspend-until-gesture state, so sharing matters.
|
|
68
|
+
*
|
|
69
|
+
* The context is lazily created on first access; the call also returns
|
|
70
|
+
* the cached instance on every subsequent call.
|
|
71
|
+
* @category Audio
|
|
72
|
+
*/
|
|
73
|
+
export declare function getAudioContext(): AudioContext | null;
|
|
74
|
+
/**
|
|
75
|
+
* Return the audio module's master gain node — the single `GainNode`
|
|
76
|
+
* every playback path runs through on its way to `ctx.destination`,
|
|
77
|
+
* and the lever that {@link setVolume} / {@link muteAll} manipulate.
|
|
78
|
+
*
|
|
79
|
+
* Connect to this node (instead of `ctx.destination`) whenever you
|
|
80
|
+
* build a custom WebAudio graph and want the result to respect the
|
|
81
|
+
* engine's mute / volume state. Returns `null` when audio is disabled
|
|
82
|
+
* or unavailable.
|
|
83
|
+
* @category Audio
|
|
84
|
+
*/
|
|
85
|
+
export declare function getMasterGain(): GainNode | null;
|
|
86
|
+
/**
|
|
87
|
+
* Get the audio module's global volume.
|
|
88
|
+
* @ignore
|
|
89
|
+
*/
|
|
90
|
+
export declare function getGlobalVolume(): number;
|
|
91
|
+
/**
|
|
92
|
+
* Set the audio module's global volume.
|
|
93
|
+
* @ignore
|
|
94
|
+
*/
|
|
95
|
+
export declare function setGlobalVolume(v: number): void;
|
|
96
|
+
/**
|
|
97
|
+
* Mute or unmute the audio module globally.
|
|
98
|
+
* @ignore
|
|
99
|
+
*/
|
|
100
|
+
export declare function setGlobalMuted(muted: boolean): void;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the audio module is currently muted globally.
|
|
103
|
+
* @ignore
|
|
104
|
+
*/
|
|
105
|
+
export declare function isGlobalMuted(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Stop every playing sound on every channel.
|
|
108
|
+
* @ignore
|
|
109
|
+
*/
|
|
110
|
+
export declare function stopAllPlayback(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the given audio codec is supported by the backend / browser.
|
|
113
|
+
* @ignore
|
|
114
|
+
*/
|
|
115
|
+
export declare function hasCodec(codec: string): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Whether at least one audio backend (HTML5 or WebAudio) is available.
|
|
118
|
+
* @ignore
|
|
119
|
+
*/
|
|
120
|
+
export declare function isAudioAvailable(): boolean;
|
|
121
|
+
//# sourceMappingURL=backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/audio/backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAU,MAAM,QAAQ,CAAC;AAEtC;;;;;;GAMG;AAEH,eAAO,IAAI,gBAAgB,EAAE,OAAc,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK;YACH,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,SAAS,CAAC;oBACtB,MAAM,GAAG,IAAI;;eAEpB,MAAM,EAAE;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAMxD;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAC1B,YAAY,MAAM,EAClB,aAAa,MAAM,IAAI,EACvB,cAAa,OAAc,KACzB,IAeF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,IAAI,YAAY,GAAG,IAAI,CAmBrD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,IAAI,QAAQ,GAAG,IAAI,CAS/C;AAUD;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAEnD;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAKvC;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAO/C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-based playback — load audio assets, then play / pause / fade /
|
|
3
|
+
* seek / etc. Every function in this module operates on the shared
|
|
4
|
+
* `state.tracks` map exposed from `backend.ts`, so the audio module's
|
|
5
|
+
* other surfaces (track helpers, mix, unload) can see the same set of
|
|
6
|
+
* loaded sounds.
|
|
7
|
+
*/
|
|
8
|
+
import type { LoadSettings, PannerAttributes, SoundAsset } from "./types.ts";
|
|
9
|
+
/**
|
|
10
|
+
* Load an audio file.
|
|
11
|
+
*
|
|
12
|
+
* `sound.src` is treated as a base path / prefix; the URL is built as
|
|
13
|
+
* `${sound.src}${sound.name}.${ext}` for each extension configured by
|
|
14
|
+
* {@link init}, until one loads. Data URLs (`data:audio/...`) are
|
|
15
|
+
* used as-is and skip the prefix-and-extension dance.
|
|
16
|
+
* @param sound - The {@link SoundAsset} descriptor — logical `name`,
|
|
17
|
+
* `src` base path / prefix (or data URL), and optional playback
|
|
18
|
+
* flags (`autoplay`, `loop`, `stream`, `html5`).
|
|
19
|
+
* @param onloadcb - Called when the resource has finished loading.
|
|
20
|
+
* @param onerrorcb - Called when loading fails.
|
|
21
|
+
* @param settings - Optional {@link LoadSettings} — `nocache` (query
|
|
22
|
+
* string appended for cache busting) and `withCredentials` (forwarded
|
|
23
|
+
* to the underlying XHR for cross-origin authenticated requests).
|
|
24
|
+
* @returns The number of assets loaded (always `1` on success).
|
|
25
|
+
* @category Audio
|
|
26
|
+
*/
|
|
27
|
+
export declare function load(sound: SoundAsset, onloadcb?: () => void, onerrorcb?: () => void, settings?: LoadSettings): number;
|
|
28
|
+
/**
|
|
29
|
+
* Play the specified sound.
|
|
30
|
+
* @param sound_name - Audio clip name (case-sensitive).
|
|
31
|
+
* @param loop - Whether to loop the clip. Defaults to `false`.
|
|
32
|
+
* @param onend - Called when the sound instance ends playing.
|
|
33
|
+
* @param volume - Playback volume, `0.0..1.0`. Defaults to the current
|
|
34
|
+
* global volume.
|
|
35
|
+
* @returns The sound instance ID.
|
|
36
|
+
* @example
|
|
37
|
+
* // play the "cling" audio clip
|
|
38
|
+
* me.audio.play("cling");
|
|
39
|
+
* // play & loop the "engine" audio clip
|
|
40
|
+
* me.audio.play("engine", true);
|
|
41
|
+
* // play the "gameover_sfx" audio clip and call myFunc when finished
|
|
42
|
+
* me.audio.play("gameover_sfx", false, myFunc);
|
|
43
|
+
* // play the "gameover_sfx" audio clip at half volume
|
|
44
|
+
* me.audio.play("gameover_sfx", false, null, 0.5);
|
|
45
|
+
* @category Audio
|
|
46
|
+
*/
|
|
47
|
+
export declare function play(sound_name: string, loop?: boolean, onend?: (() => void) | null, volume?: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* Fade a currently playing sound between two volumes.
|
|
50
|
+
* @param sound_name - Audio clip name (case-sensitive).
|
|
51
|
+
* @param from - Volume to fade from, `0.0..1.0`.
|
|
52
|
+
* @param to - Volume to fade to, `0.0..1.0`.
|
|
53
|
+
* @param duration - Fade time in milliseconds.
|
|
54
|
+
* @param id - Sound instance ID. When omitted, all sounds in the group
|
|
55
|
+
* are faded.
|
|
56
|
+
* @category Audio
|
|
57
|
+
*/
|
|
58
|
+
export declare function fade(sound_name: string, from: number, to: number, duration: number, id?: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* Get or set the playback position of a sound.
|
|
61
|
+
* @param sound_name - Audio clip name (case-sensitive).
|
|
62
|
+
* @param args - Optional seek position in seconds, optionally followed
|
|
63
|
+
* by the sound instance ID.
|
|
64
|
+
* @returns The current seek position when no extra arguments are given.
|
|
65
|
+
* @example
|
|
66
|
+
* // read the current position of the background music
|
|
67
|
+
* let current_pos = me.audio.seek("dst-gameforest");
|
|
68
|
+
* // rewind the background music to the beginning
|
|
69
|
+
* me.audio.seek("dst-gameforest", 0);
|
|
70
|
+
* @category Audio
|
|
71
|
+
*/
|
|
72
|
+
export declare function seek(sound_name: string, ...args: number[]): number;
|
|
73
|
+
/**
|
|
74
|
+
* Get or set the playback rate of a sound.
|
|
75
|
+
* @param sound_name - Audio clip name (case-sensitive).
|
|
76
|
+
* @param args - Optional playback rate (`0.5..4.0`, where `1.0` is
|
|
77
|
+
* normal speed), optionally followed by the sound instance ID.
|
|
78
|
+
* @returns The current playback rate when no extra arguments are given.
|
|
79
|
+
* @example
|
|
80
|
+
* // read the current playback rate
|
|
81
|
+
* let rate = me.audio.rate("dst-gameforest");
|
|
82
|
+
* // speed it up 2×
|
|
83
|
+
* me.audio.rate("dst-gameforest", 2.0);
|
|
84
|
+
* @category Audio
|
|
85
|
+
*/
|
|
86
|
+
export declare function rate(sound_name: string, ...args: number[]): number;
|
|
87
|
+
/** @inheritDoc */
|
|
88
|
+
export declare function stereo(sound_name: string): number;
|
|
89
|
+
/** @inheritDoc */
|
|
90
|
+
export declare function stereo(sound_name: string, pan: number, id?: number): void;
|
|
91
|
+
/** @inheritDoc */
|
|
92
|
+
export declare function position(sound_name: string): [number, number, number];
|
|
93
|
+
/** @inheritDoc */
|
|
94
|
+
export declare function position(sound_name: string, x: number, y?: number, z?: number, id?: number): void;
|
|
95
|
+
/** @inheritDoc */
|
|
96
|
+
export declare function orientation(sound_name: string): [number, number, number];
|
|
97
|
+
/** @inheritDoc */
|
|
98
|
+
export declare function orientation(sound_name: string, x: number, y?: number, z?: number, id?: number): void;
|
|
99
|
+
/**
|
|
100
|
+
* Get or set the panner-node attributes for a sound or sound group.
|
|
101
|
+
* @param sound_name - Audio clip name (case-sensitive).
|
|
102
|
+
* @param attributes - The {@link PannerAttributes} to apply (cone angles,
|
|
103
|
+
* distance model, panning algorithm, …). See the interface for
|
|
104
|
+
* per-field defaults.
|
|
105
|
+
* @param id - Sound instance ID. When omitted, all sounds in the group
|
|
106
|
+
* are affected.
|
|
107
|
+
* @returns The resulting {@link PannerAttributes} after the update.
|
|
108
|
+
* @example
|
|
109
|
+
* me.audio.panner("cling", {
|
|
110
|
+
* panningModel: "HRTF",
|
|
111
|
+
* refDistance: 0.8,
|
|
112
|
+
* rolloffFactor: 2.5,
|
|
113
|
+
* distanceModel: "exponential",
|
|
114
|
+
* });
|
|
115
|
+
* @category Audio
|
|
116
|
+
*/
|
|
117
|
+
export declare function panner(sound_name: string, attributes?: PannerAttributes, id?: number): PannerAttributes;
|
|
118
|
+
/**
|
|
119
|
+
* Stop the specified sound on all channels.
|
|
120
|
+
* @param sound_name - Audio clip name (case-sensitive). When omitted,
|
|
121
|
+
* every sound currently playing is stopped.
|
|
122
|
+
* @param id - Sound instance ID. When omitted, all sounds in the group
|
|
123
|
+
* are stopped.
|
|
124
|
+
* @example
|
|
125
|
+
* me.audio.stop("cling");
|
|
126
|
+
* @category Audio
|
|
127
|
+
*/
|
|
128
|
+
export declare function stop(sound_name?: string, id?: number): void;
|
|
129
|
+
/**
|
|
130
|
+
* Pause the specified sound on all channels. Does not reset the
|
|
131
|
+
* current playback position.
|
|
132
|
+
* @param sound_name - Audio clip name (case-sensitive).
|
|
133
|
+
* @param id - Sound instance ID. When omitted, all sounds in the group
|
|
134
|
+
* are paused.
|
|
135
|
+
* @example
|
|
136
|
+
* me.audio.pause("cling");
|
|
137
|
+
* @category Audio
|
|
138
|
+
*/
|
|
139
|
+
export declare function pause(sound_name: string, id?: number): void;
|
|
140
|
+
/**
|
|
141
|
+
* Resume the specified sound on all channels.
|
|
142
|
+
* @param sound_name - Audio clip name (case-sensitive).
|
|
143
|
+
* @param id - Sound instance ID. When omitted, all sounds in the group
|
|
144
|
+
* are resumed.
|
|
145
|
+
* @example
|
|
146
|
+
* // play an audio clip
|
|
147
|
+
* let id = me.audio.play("myClip");
|
|
148
|
+
* // ...
|
|
149
|
+
* // pause it
|
|
150
|
+
* me.audio.pause("myClip", id);
|
|
151
|
+
* // ...
|
|
152
|
+
* // resume
|
|
153
|
+
* me.audio.resume("myClip", id);
|
|
154
|
+
* @category Audio
|
|
155
|
+
*/
|
|
156
|
+
export declare function resume(sound_name: string, id?: number): void;
|
|
157
|
+
//# sourceMappingURL=playback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback.d.ts","sourceRoot":"","sources":["../../src/audio/playback.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CACnB,KAAK,EAAE,UAAU,EACjB,QAAQ,CAAC,EAAE,MAAM,IAAI,EACrB,SAAS,CAAC,EAAE,MAAM,IAAI,EACtB,QAAQ,GAAE,YAAiB,GACzB,MAAM,CAqCR;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,IAAI,CACnB,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,OAAe,EACrB,KAAK,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,EAC3B,MAAM,CAAC,EAAE,MAAM,GACb,MAAM,CAgBR;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CACnB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,EAAE,CAAC,EAAE,MAAM,GACT,IAAI,CAEN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAElE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAElE;AAED,kBAAkB;AAClB,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;AACnD,kBAAkB;AAClB,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;AA8B3E,kBAAkB;AAClB,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACvE,kBAAkB;AAClB,wBAAgB,QAAQ,CACvB,UAAU,EAAE,MAAM,EAClB,CAAC,EAAE,MAAM,EACT,CAAC,CAAC,EAAE,MAAM,EACV,CAAC,CAAC,EAAE,MAAM,EACV,EAAE,CAAC,EAAE,MAAM,GACT,IAAI,CAAC;AA+BR,kBAAkB;AAClB,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1E,kBAAkB;AAClB,wBAAgB,WAAW,CAC1B,UAAU,EAAE,MAAM,EAClB,CAAC,EAAE,MAAM,EACT,CAAC,CAAC,EAAE,MAAM,EACV,CAAC,CAAC,EAAE,MAAM,EACV,EAAE,CAAC,EAAE,MAAM,GACT,IAAI,CAAC;AAiCR;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CACrB,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,gBAAgB,EAC7B,EAAE,CAAC,EAAE,MAAM,GACT,gBAAgB,CAelB;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAS3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAE3D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAE5D"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedural audio — fire-and-forget envelope-shaped primitives that
|
|
3
|
+
* build on the shared `AudioContext` exposed by `backend.ts`. Designed
|
|
4
|
+
* for "just play a beep / explosion / whoosh" use cases where loading
|
|
5
|
+
* an audio file would be overkill.
|
|
6
|
+
*
|
|
7
|
+
* Two primitives:
|
|
8
|
+
* - `tone` for pitched sources (clicks, chimes, lasers, chord pings).
|
|
9
|
+
* - `noise` for non-pitched sources (explosions, hi-hats, swooshes,
|
|
10
|
+
* wind, footsteps).
|
|
11
|
+
*
|
|
12
|
+
* Both share the same envelope + output routing rails so future
|
|
13
|
+
* primitives can be added with zero copy-paste.
|
|
14
|
+
*/
|
|
15
|
+
import type { NoiseOptions, ToneOptions } from "./types.ts";
|
|
16
|
+
/**
|
|
17
|
+
* Fire a single-shot envelope-shaped oscillator on the shared
|
|
18
|
+
* {@link getAudioContext} context. Designed for the "just play a beep"
|
|
19
|
+
* niche where loading an audio file is overkill — UI clicks, hit
|
|
20
|
+
* confirms, retro arcade-style cues, placeholder feedback during
|
|
21
|
+
* prototyping.
|
|
22
|
+
*
|
|
23
|
+
* Multi-partial `freq` makes chimes, bells, and simple chords a single
|
|
24
|
+
* call; `pitchSlide` covers percussive pitch-drops and rising stings.
|
|
25
|
+
* The context is shared with file-based playback, so the usual browser
|
|
26
|
+
* autoplay gating applies: the first call after a user gesture lets
|
|
27
|
+
* every subsequent call play.
|
|
28
|
+
*
|
|
29
|
+
* **Requires WebAudio.** When WebAudio is not supported (or audio is
|
|
30
|
+
* explicitly disabled) this is a silent no-op: {@link getAudioContext}
|
|
31
|
+
* returns `null` and nothing is scheduled. Use the return value of
|
|
32
|
+
* {@link getAudioContext} to detect that case up front if your game
|
|
33
|
+
* wants to show a "no audio" badge or fall back to a different
|
|
34
|
+
* feedback channel.
|
|
35
|
+
* @param opts - the {@link ToneOptions} (frequency, duration,
|
|
36
|
+
* envelope, pan, slide). See the interface for per-field defaults.
|
|
37
|
+
* @example
|
|
38
|
+
* // simple UI click
|
|
39
|
+
* me.audio.tone({ freq: 1200, duration: 0.08, pitchSlide: 0.5 });
|
|
40
|
+
* // chime, panned right, two partials a fifth apart
|
|
41
|
+
* me.audio.tone({ freq: [880, 1320], duration: 0.4, gain: 0.18, pan: 0.5 });
|
|
42
|
+
* // descending "thud" — square wave with a wide pitch drop
|
|
43
|
+
* me.audio.tone({ freq: 200, duration: 0.15, wave: "square", pitchSlide: 0.25 });
|
|
44
|
+
* @category Audio
|
|
45
|
+
*/
|
|
46
|
+
export declare function tone(opts: ToneOptions): void;
|
|
47
|
+
/**
|
|
48
|
+
* Fire a single-shot envelope-shaped noise burst on the shared
|
|
49
|
+
* {@link getAudioContext} context. Sits alongside {@link tone} as the
|
|
50
|
+
* non-pitched half of the procedural-audio surface — `tone` is the right
|
|
51
|
+
* tool for anything with a clear pitch (clicks, chimes, lasers), `noise`
|
|
52
|
+
* is the right tool for anything percussive without one (explosions,
|
|
53
|
+
* hi-hats, swooshes, footsteps, wind).
|
|
54
|
+
*
|
|
55
|
+
* The output runs through the master gain shared with file-based
|
|
56
|
+
* playback, so {@link muteAll} / {@link setVolume} apply uniformly.
|
|
57
|
+
* Browser autoplay gating applies — the first call after a user
|
|
58
|
+
* gesture lets every subsequent call play.
|
|
59
|
+
*
|
|
60
|
+
* **Requires WebAudio.** When WebAudio is not supported (or audio is
|
|
61
|
+
* explicitly disabled) this is a silent no-op: {@link getAudioContext}
|
|
62
|
+
* returns `null` and nothing is scheduled.
|
|
63
|
+
* @param opts - the {@link NoiseOptions} (duration, spectral colour,
|
|
64
|
+
* envelope, pan, optional filter + sweep). See the interface for
|
|
65
|
+
* per-field defaults.
|
|
66
|
+
* @example
|
|
67
|
+
* // Explosion: brown rumble closing into a thud
|
|
68
|
+
* me.audio.noise({
|
|
69
|
+
* duration: 0.8,
|
|
70
|
+
* type: "brown",
|
|
71
|
+
* gain: 0.4,
|
|
72
|
+
* filter: { type: "lowpass", frequency: 800 },
|
|
73
|
+
* filterSweep: 0.3,
|
|
74
|
+
* });
|
|
75
|
+
* // Hi-hat: short, bright, top-end only
|
|
76
|
+
* me.audio.noise({
|
|
77
|
+
* duration: 0.05,
|
|
78
|
+
* filter: { type: "highpass", frequency: 7000 },
|
|
79
|
+
* gain: 0.2,
|
|
80
|
+
* });
|
|
81
|
+
* // Swoosh: bandpass white with rising sweep — UI transition, melee whoosh
|
|
82
|
+
* me.audio.noise({
|
|
83
|
+
* duration: 0.3,
|
|
84
|
+
* filter: { type: "bandpass", frequency: 400, Q: 1.5 },
|
|
85
|
+
* filterSweep: 4,
|
|
86
|
+
* gain: 0.3,
|
|
87
|
+
* });
|
|
88
|
+
* // Wind / breath: long, low-pink, no sweep
|
|
89
|
+
* me.audio.noise({
|
|
90
|
+
* duration: 2,
|
|
91
|
+
* type: "pink",
|
|
92
|
+
* filter: { type: "bandpass", frequency: 600 },
|
|
93
|
+
* gain: 0.08,
|
|
94
|
+
* });
|
|
95
|
+
* // Footstep on dirt — short brown thump
|
|
96
|
+
* me.audio.noise({
|
|
97
|
+
* duration: 0.08,
|
|
98
|
+
* type: "brown",
|
|
99
|
+
* filter: { type: "lowpass", frequency: 200 },
|
|
100
|
+
* gain: 0.25,
|
|
101
|
+
* });
|
|
102
|
+
* @category Audio
|
|
103
|
+
*/
|
|
104
|
+
export declare function noise(opts: NoiseOptions): void;
|
|
105
|
+
//# sourceMappingURL=procedural.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procedural.d.ts","sourceRoot":"","sources":["../../src/audio/procedural.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAmF5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CA0D5C;AAkDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CA6D9C"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public type declarations for the audio module. Kept in a dedicated
|
|
3
|
+
* file so the runtime entry point (`audio.ts`) stays focused on
|
|
4
|
+
* implementation; consumers can import types from
|
|
5
|
+
* `me.audio` exactly as before.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Sound asset descriptor passed to `audio.load`.
|
|
9
|
+
* @category Audio
|
|
10
|
+
*/
|
|
11
|
+
export interface SoundAsset {
|
|
12
|
+
/** Logical name used to play / stop / reference the sound later. */
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* Base path / prefix for the audio resource. The loader builds the
|
|
16
|
+
* full URL as `${src}${name}.${ext}` for each format configured by
|
|
17
|
+
* `audio.init()`, so `src` is typically a directory ending in `/`.
|
|
18
|
+
* Data URLs (`data:audio/...`) are used as-is and skip the prefix
|
|
19
|
+
* + extension construction.
|
|
20
|
+
*/
|
|
21
|
+
src: string;
|
|
22
|
+
/** Begin playback immediately on load. Defaults to `false`. */
|
|
23
|
+
autoplay?: boolean;
|
|
24
|
+
/** Loop playback when the clip ends. Defaults to `false`. */
|
|
25
|
+
loop?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Stream the resource instead of fully decoding upfront — preferred
|
|
28
|
+
* for long music tracks. Defaults to `false`.
|
|
29
|
+
*/
|
|
30
|
+
stream?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Force the HTML5 `<audio>` element backend instead of WebAudio
|
|
33
|
+
* decoding. Defaults to `false`.
|
|
34
|
+
*/
|
|
35
|
+
html5?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Optional settings applied to the audio resource load. The loader
|
|
39
|
+
* uses an XHR under the hood (via Howler), so the available knobs
|
|
40
|
+
* mirror what an XHR can be told to do.
|
|
41
|
+
* @category Audio
|
|
42
|
+
*/
|
|
43
|
+
export interface LoadSettings {
|
|
44
|
+
/** Cache-busting query string appended to the resource URL. */
|
|
45
|
+
nocache?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Forwarded to `XMLHttpRequest.withCredentials`. Set `true` so
|
|
48
|
+
* cross-origin loads include cookies / auth headers (e.g. when
|
|
49
|
+
* the audio is served from an authenticated CDN).
|
|
50
|
+
*/
|
|
51
|
+
withCredentials?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Spatial-audio cone + distance attributes passed to `audio.panner`.
|
|
55
|
+
* Mirrors the WebAudio `PannerNode` configuration so positional sound
|
|
56
|
+
* effects can be set up declaratively (see
|
|
57
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Web_audio_spatialization_basics#creating_a_panner_node | MDN — creating a panner node}
|
|
58
|
+
* for an end-to-end conceptual overview).
|
|
59
|
+
* @category Audio
|
|
60
|
+
*/
|
|
61
|
+
export interface PannerAttributes {
|
|
62
|
+
/**
|
|
63
|
+
* Inner cone angle in degrees within which there is no volume
|
|
64
|
+
* reduction. Defaults to `360` (omnidirectional).
|
|
65
|
+
*/
|
|
66
|
+
coneInnerAngle?: number | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Outer cone angle in degrees outside which the volume is reduced
|
|
69
|
+
* to `coneOuterGain`. Defaults to `360`.
|
|
70
|
+
*/
|
|
71
|
+
coneOuterAngle?: number | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Linear volume multiplier (`0..1`) applied outside
|
|
74
|
+
* `coneOuterAngle`. Defaults to `0` (silent outside the cone).
|
|
75
|
+
*/
|
|
76
|
+
coneOuterGain?: number | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Distance-attenuation algorithm — `"inverse"` (default), `"linear"`,
|
|
79
|
+
* or `"exponential"`. Matches the WebAudio `PannerNode.distanceModel`
|
|
80
|
+
* union.
|
|
81
|
+
*/
|
|
82
|
+
distanceModel?: DistanceModelType;
|
|
83
|
+
/**
|
|
84
|
+
* Distance at which volume reduction stops (used by the `"linear"`
|
|
85
|
+
* model; clamps the falloff curve for the other one). Defaults to
|
|
86
|
+
* `10000`.
|
|
87
|
+
*/
|
|
88
|
+
maxDistance?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Spatialization algorithm — `"equalpower"` (cheap, stereo-only) or
|
|
91
|
+
* `"HRTF"` (head-related, full 3D). Defaults to `"HRTF"`.
|
|
92
|
+
*/
|
|
93
|
+
panningModel?: "HRTF" | "equalpower";
|
|
94
|
+
/**
|
|
95
|
+
* Reference distance for the falloff curve — volume is `1` at this
|
|
96
|
+
* distance from the listener. Defaults to `1`.
|
|
97
|
+
*/
|
|
98
|
+
refDistance?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Steepness of the falloff curve for the `"inverse"` model.
|
|
101
|
+
* Defaults to `1`.
|
|
102
|
+
*/
|
|
103
|
+
rolloffFactor?: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Optional band-shaping filter applied to the procedural noise burst
|
|
107
|
+
* produced by `noise`. Mirrors a subset of the WebAudio `BiquadFilterNode`
|
|
108
|
+
* configuration so users can sculpt the spectral colour without dropping
|
|
109
|
+
* to a custom WebAudio graph.
|
|
110
|
+
* @category Audio
|
|
111
|
+
*/
|
|
112
|
+
export interface NoiseFilter {
|
|
113
|
+
/**
|
|
114
|
+
* Filter shape — `"lowpass"`, `"highpass"`, `"bandpass"`,
|
|
115
|
+
* `"lowshelf"`, `"highshelf"`, `"peaking"`, `"notch"`, or
|
|
116
|
+
* `"allpass"`. See the WebAudio `BiquadFilterNode` docs.
|
|
117
|
+
*/
|
|
118
|
+
type: BiquadFilterType;
|
|
119
|
+
/** Centre / cutoff frequency in Hz. */
|
|
120
|
+
frequency: number;
|
|
121
|
+
/** Filter resonance / quality factor. Defaults to the WebAudio default (`1`). */
|
|
122
|
+
Q?: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Options for `noise`.
|
|
126
|
+
* @category Audio
|
|
127
|
+
*/
|
|
128
|
+
export interface NoiseOptions {
|
|
129
|
+
/** Total burst length in seconds (envelope decays over this window). */
|
|
130
|
+
duration: number;
|
|
131
|
+
/**
|
|
132
|
+
* Spectral colour of the noise source:
|
|
133
|
+
* - `"white"` — flat, all frequencies equal (default).
|
|
134
|
+
* - `"pink"` — −3 dB / octave roll-off, perceptually balanced —
|
|
135
|
+
* classic for breath, wind, and acoustic-sounding ambient texture.
|
|
136
|
+
* - `"brown"` (red) — −6 dB / octave roll-off, low and rumbly —
|
|
137
|
+
* classic for distant thunder, ocean, low-fi rumble.
|
|
138
|
+
*/
|
|
139
|
+
type?: "white" | "pink" | "brown";
|
|
140
|
+
/** Peak gain at attack end, `0..1`. Defaults to `0.1`. */
|
|
141
|
+
gain?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Attack time in seconds — linear ramp from 0 up to `gain`. Clamped
|
|
144
|
+
* to `[0.001, duration / 2]`. For very short durations (< 2 ms) the
|
|
145
|
+
* upper bound wins so the envelope still fits inside the playback
|
|
146
|
+
* window. Defaults to `0.005`.
|
|
147
|
+
*/
|
|
148
|
+
attack?: number;
|
|
149
|
+
/**
|
|
150
|
+
* Stereo pan, `-1` (full left) to `1` (full right). Defaults to `0`.
|
|
151
|
+
*/
|
|
152
|
+
pan?: number;
|
|
153
|
+
/**
|
|
154
|
+
* Optional {@link NoiseFilter} applied to the noise source before
|
|
155
|
+
* the master gain. Use this to colour the noise — a lowpass on
|
|
156
|
+
* brown noise gives "explosion thump", a highpass on white gives
|
|
157
|
+
* "hi-hat tick", a bandpass gives "swoosh".
|
|
158
|
+
*/
|
|
159
|
+
filter?: NoiseFilter;
|
|
160
|
+
/**
|
|
161
|
+
* Frequency multiplier applied to {@link NoiseFilter.frequency}
|
|
162
|
+
* over `duration` as an exponential ramp. `1` = no sweep (default);
|
|
163
|
+
* `>1` = filter opens upward (rising swoosh, laser pew);
|
|
164
|
+
* `<1` = filter closes downward (descending thunk, explosion settle).
|
|
165
|
+
* Has no effect when `filter` is unset.
|
|
166
|
+
*/
|
|
167
|
+
filterSweep?: number;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Options for `tone`.
|
|
171
|
+
* @category Audio
|
|
172
|
+
*/
|
|
173
|
+
export interface ToneOptions {
|
|
174
|
+
/**
|
|
175
|
+
* Carrier frequency in Hz. Pass an array to layer multiple
|
|
176
|
+
* partials (chord, bell ring, fundamental + harmonic) — they
|
|
177
|
+
* share the gain envelope, pan, and pitch slide.
|
|
178
|
+
*/
|
|
179
|
+
freq: number | number[];
|
|
180
|
+
/** Total sound length in seconds (envelope decays over this window). */
|
|
181
|
+
duration: number;
|
|
182
|
+
/** Oscillator waveform. Defaults to `"sine"`. */
|
|
183
|
+
wave?: OscillatorType;
|
|
184
|
+
/** Peak gain at attack end, `0..1`. Defaults to `0.1`. */
|
|
185
|
+
gain?: number;
|
|
186
|
+
/**
|
|
187
|
+
* Attack time in seconds — linear ramp from 0 up to `gain`. Clamped
|
|
188
|
+
* to `[0.001, duration / 2]`. For very short durations (< 2 ms) the
|
|
189
|
+
* upper bound wins so the envelope still fits inside the playback
|
|
190
|
+
* window. Defaults to `0.005`.
|
|
191
|
+
*/
|
|
192
|
+
attack?: number;
|
|
193
|
+
/**
|
|
194
|
+
* Stereo pan, `-1` (full left) to `1` (full right). Defaults to `0`.
|
|
195
|
+
*/
|
|
196
|
+
pan?: number;
|
|
197
|
+
/**
|
|
198
|
+
* Frequency multiplier applied over `duration` as an exponential
|
|
199
|
+
* ramp. `1` = no slide (default); `0.5` = slide an octave down;
|
|
200
|
+
* `2` = slide an octave up. Useful for percussive impacts (small
|
|
201
|
+
* value < 1) or rising stings (value > 1).
|
|
202
|
+
*/
|
|
203
|
+
pitchSlide?: number;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/audio/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC5B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;;OAIG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC3B;;;;OAIG;IACH,IAAI,EAAE,gBAAgB,CAAC;IACvB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,CAAC,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;;;OAIG;IACH,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/build/index.d.ts
CHANGED
|
@@ -21,8 +21,8 @@ import { ColorMatrix } from "./math/color_matrix.ts";
|
|
|
21
21
|
import ParticleEmitter from "./particles/emitter.ts";
|
|
22
22
|
import Particle from "./particles/particle.ts";
|
|
23
23
|
import ParticleEmitterSettings from "./particles/settings.js";
|
|
24
|
-
import Body from "./physics/body.js";
|
|
25
|
-
import QuadTree from "./physics/quadtree.js";
|
|
24
|
+
import Body from "./physics/builtin/body.js";
|
|
25
|
+
import QuadTree from "./physics/builtin/quadtree.js";
|
|
26
26
|
import World from "./physics/world.js";
|
|
27
27
|
import { cache as plugins } from "./plugin/plugin.ts";
|
|
28
28
|
import Collectable from "./renderable/collectable.js";
|
|
@@ -75,6 +75,7 @@ import OutlineEffect from "./video/webgl/effects/outline.js";
|
|
|
75
75
|
import PixelateEffect from "./video/webgl/effects/pixelate.js";
|
|
76
76
|
import ScanlineEffect from "./video/webgl/effects/scanline.js";
|
|
77
77
|
import SepiaEffect from "./video/webgl/effects/sepia.js";
|
|
78
|
+
import ShineEffect from "./video/webgl/effects/shine.js";
|
|
78
79
|
import TintPulseEffect from "./video/webgl/effects/tintPulse.js";
|
|
79
80
|
import VignetteEffect from "./video/webgl/effects/vignette.js";
|
|
80
81
|
import WaveEffect from "./video/webgl/effects/wave.js";
|
|
@@ -105,7 +106,9 @@ export { ObservableVector2d } from "./math/observableVector2d.ts";
|
|
|
105
106
|
export { ObservableVector3d } from "./math/observableVector3d.ts";
|
|
106
107
|
export { Vector2d } from "./math/vector2d.ts";
|
|
107
108
|
export { Vector3d } from "./math/vector3d.ts";
|
|
109
|
+
export type { AdapterCapabilities, AdapterOptions, BodyDefinition, BodyShape, BodyType, CollisionResponse, PhysicsAdapter, PhysicsBody, RaycastHit, } from "./physics/adapter.ts";
|
|
108
110
|
export { Bounds } from "./physics/bounds.ts";
|
|
111
|
+
export { default as BuiltinAdapter } from "./physics/builtin/builtin-adapter.ts";
|
|
109
112
|
export { collision } from "./physics/collision.js";
|
|
110
113
|
export * as plugin from "./plugin/plugin.ts";
|
|
111
114
|
export { getPool } from "./pool.ts";
|
|
@@ -115,7 +118,7 @@ export * as utils from "./utils/utils.ts";
|
|
|
115
118
|
export * from "./version.ts";
|
|
116
119
|
export * as video from "./video/video.js";
|
|
117
120
|
export { Application, Batcher, BitmapText, BitmapTextData, BlurEffect, Body, Camera2d, CameraEffect, CanvasRenderer, CanvasRenderTarget, ChromaticAberrationEffect, Collectable, ColorLayer, ColorMatrix, ColorMatrixEffect, Container, DesaturateEffect, DissolveEffect, Draggable, DropShadowEffect, DropTarget, Entity, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
118
|
-
FadeEffect, FlashEffect, GLShader, GlowEffect, Gradient, HologramEffect, ImageLayer, InvertEffect, Light2d, MaskEffect, Mesh, NineSliceSprite, OutlineEffect, Particle, ParticleEmitter, ParticleEmitterSettings, PixelateEffect, Pointer, PrimitiveBatcher, plugins, pool, QuadBatcher, QuadTree, Renderable, Renderer, RenderState, RenderTarget, ScanlineEffect, SepiaEffect, ShaderEffect, ShakeEffect, Sprite, Stage, save, state, Text, TextureAtlas, Tile, TintPulseEffect, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, TMXUtils, Trail, Trigger, Tween, timer, UIBaseElement, UISpriteElement, UITextButton, VignetteEffect, WaveEffect, WebGLRenderer, World, };
|
|
121
|
+
FadeEffect, FlashEffect, GLShader, GlowEffect, Gradient, HologramEffect, ImageLayer, InvertEffect, Light2d, MaskEffect, Mesh, NineSliceSprite, OutlineEffect, Particle, ParticleEmitter, ParticleEmitterSettings, PixelateEffect, Pointer, PrimitiveBatcher, plugins, pool, QuadBatcher, QuadTree, Renderable, Renderer, RenderState, RenderTarget, ScanlineEffect, SepiaEffect, ShaderEffect, ShakeEffect, ShineEffect, Sprite, Stage, save, state, Text, TextureAtlas, Tile, TintPulseEffect, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, TMXUtils, Trail, Trigger, Tween, timer, UIBaseElement, UISpriteElement, UITextButton, VignetteEffect, WaveEffect, WebGLRenderer, World, };
|
|
119
122
|
/**
|
|
120
123
|
* disable melonJS auto-initialization
|
|
121
124
|
* @see {@link boot}
|