@datamoc/mw_games 0.36.0 → 0.37.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/CHANGELOG.md +49 -0
- package/README.md +6 -2
- package/api-surface.json +234 -0
- package/dist/assets/paths.d.ts.map +1 -1
- package/dist/assets/paths.js +3 -0
- package/dist/assets/paths.js.map +1 -1
- package/dist/audio/Playable.d.ts.map +1 -1
- package/dist/audio/Playable.js +14 -1
- package/dist/audio/Playable.js.map +1 -1
- package/dist/audio/Synth.d.ts +14 -0
- package/dist/audio/Synth.d.ts.map +1 -1
- package/dist/audio/Synth.js +16 -0
- package/dist/audio/Synth.js.map +1 -1
- package/dist/audio/index.d.ts +1 -1
- package/dist/audio/index.d.ts.map +1 -1
- package/dist/audio/index.js +1 -1
- package/dist/audio/index.js.map +1 -1
- package/dist/core/FixedStepper.d.ts +38 -0
- package/dist/core/FixedStepper.d.ts.map +1 -0
- package/dist/core/FixedStepper.js +56 -0
- package/dist/core/FixedStepper.js.map +1 -0
- package/dist/core/Input.d.ts +61 -0
- package/dist/core/Input.d.ts.map +1 -1
- package/dist/core/Input.js +101 -0
- package/dist/core/Input.js.map +1 -1
- package/dist/core/StoredValue.d.ts +11 -2
- package/dist/core/StoredValue.d.ts.map +1 -1
- package/dist/core/StoredValue.js +11 -2
- package/dist/core/StoredValue.js.map +1 -1
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -1
- package/dist/core/index.js.map +1 -1
- package/dist/mw_games.global.js +121 -121
- package/dist/physics/PhysicsWorld.d.ts +123 -0
- package/dist/physics/PhysicsWorld.d.ts.map +1 -0
- package/dist/physics/PhysicsWorld.js +137 -0
- package/dist/physics/PhysicsWorld.js.map +1 -0
- package/dist/physics/XpbdWorld.d.ts +139 -0
- package/dist/physics/XpbdWorld.d.ts.map +1 -0
- package/dist/physics/XpbdWorld.js +207 -0
- package/dist/physics/XpbdWorld.js.map +1 -0
- package/dist/physics/index.d.ts +3 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/index.js +2 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/xpbd.d.ts +3 -0
- package/dist/physics/xpbd.d.ts.map +1 -0
- package/dist/physics/xpbd.js +2 -0
- package/dist/physics/xpbd.js.map +1 -0
- package/dist/two-d/render/Camera.d.ts +6 -0
- package/dist/two-d/render/Camera.d.ts.map +1 -1
- package/dist/two-d/render/Camera.js +9 -0
- package/dist/two-d/render/Camera.js.map +1 -1
- package/dist/two-d/render/Particles.d.ts +10 -1
- package/dist/two-d/render/Particles.d.ts.map +1 -1
- package/dist/two-d/render/Particles.js +14 -7
- package/dist/two-d/render/Particles.js.map +1 -1
- package/dist/two-d/render/Shape2D.d.ts +7 -0
- package/dist/two-d/render/Shape2D.d.ts.map +1 -1
- package/dist/two-d/render/Shape2D.js +18 -0
- package/dist/two-d/render/Shape2D.js.map +1 -1
- package/dist/two-d/render/SpriteSheet.d.ts +5 -0
- package/dist/two-d/render/SpriteSheet.d.ts.map +1 -1
- package/dist/two-d/render/SpriteSheet.js +15 -0
- package/dist/two-d/render/SpriteSheet.js.map +1 -1
- package/dist/two-d/ui/Button.d.ts +7 -0
- package/dist/two-d/ui/Button.d.ts.map +1 -1
- package/dist/two-d/ui/Button.js +16 -2
- package/dist/two-d/ui/Button.js.map +1 -1
- package/dist/two-d/ui/Dropdown.d.ts +3 -0
- package/dist/two-d/ui/Dropdown.d.ts.map +1 -1
- package/dist/two-d/ui/Dropdown.js +3 -0
- package/dist/two-d/ui/Dropdown.js.map +1 -1
- package/dist/two-d/ui/DropdownView.d.ts +40 -0
- package/dist/two-d/ui/DropdownView.d.ts.map +1 -0
- package/dist/two-d/ui/DropdownView.js +75 -0
- package/dist/two-d/ui/DropdownView.js.map +1 -0
- package/dist/two-d/ui/Label.d.ts +2 -0
- package/dist/two-d/ui/Label.d.ts.map +1 -1
- package/dist/two-d/ui/Label.js +7 -0
- package/dist/two-d/ui/Label.js.map +1 -1
- package/dist/two-d/ui/Layout.d.ts +34 -0
- package/dist/two-d/ui/Layout.d.ts.map +1 -1
- package/dist/two-d/ui/Layout.js +47 -0
- package/dist/two-d/ui/Layout.js.map +1 -1
- package/dist/two-d/ui/Window.d.ts +7 -0
- package/dist/two-d/ui/Window.d.ts.map +1 -1
- package/dist/two-d/ui/Window.js +13 -0
- package/dist/two-d/ui/Window.js.map +1 -1
- package/dist/two-d/ui/index.d.ts +4 -2
- package/dist/two-d/ui/index.d.ts.map +1 -1
- package/dist/two-d/ui/index.js +2 -1
- package/dist/two-d/ui/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +22 -3
- package/sbom.cdx.json +64 -12
- package/tools/browser-driver.d.mts +14 -0
- package/tools/browser-driver.mjs +86 -10
- package/tools/build-tablebases.mjs +6 -2
- package/tools/classic-html.mjs +9 -1
- package/tools/compile-openings.mjs +6 -2
- package/tools/compile-resources.d.mts +5 -0
- package/tools/compile-resources.mjs +45 -4
- package/tools/compress-dist.mjs +15 -3
- package/tools/emit-page.mjs +5 -1
- package/tools/init.d.mts +5 -0
- package/tools/init.mjs +145 -0
- package/tools/play-uci.mjs +6 -3
- package/tools/sbom.mjs +5 -1
- package/tools/single-file.mjs +9 -1
- package/tools/vite.mjs +5 -0
- package/tools/webp-convert.mjs +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,55 @@ the public API may still change between minor versions.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.37.0] - 2026-10-14
|
|
11
|
+
|
|
12
|
+
Fixes and additions from the first outside game built on mwg (Pontifex, on 0.36.0): sounds compose with synthesized tones, two physics modules (matter-js rigid bodies and a deterministic XPBD structure solver), pointer and dropdown widgets, a project scaffold, and the `@datamoc/mwg` short-name package.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `audio.synthesizeSound(tone, options)`: a pooled `Sound` over a synthesized tone.
|
|
17
|
+
- `core.FixedStepper`: turns the variable frame `dt` into fixed simulation steps with a substep cap.
|
|
18
|
+
- `core.StoredValue` and `core.defaultStorage` are public, so a game can keep structured JSON progress under one key.
|
|
19
|
+
- `Button.setSelected`, `Label.setWrapWidth`, `Window({ closeButton: true })` (a visible ✕), and `ui.flowLayout` (wrapping rows with alignment).
|
|
20
|
+
- `ParticleEmitter.burst(count, { x, y, tint })`, `Shape2D.dashedLine`, `Camera.fit(worldWidth, worldHeight)` and `SpriteSheet.strip(path, frames)`.
|
|
21
|
+
- `BrowserDriver.drag(fromX, fromY, toX, toY, steps)` on Chrome (CDP) and Firefox (in-page pointer events).
|
|
22
|
+
- `Input.attachPointer`: down, move, drag and up signals with target-relative and world positions.
|
|
23
|
+
- `physics.PhysicsWorld` (`@datamoc/mw_games/physics`, optional peer `matter-js`): rigid bodies, constraints, contact events and breakable joints (`maxStretch`, `onBreak`, `stretchOf`) on a fixed clock.
|
|
24
|
+
- `physics.XpbdWorld` (`@datamoc/mw_games/physics/xpbd`, no `matter-js`): a deterministic XPBD structure solver with per-link loads, breaking at a real strength and ground collision, extracted from Pontifex.
|
|
25
|
+
- `ui.DropdownView`, the widget over the `Dropdown` model.
|
|
26
|
+
- `mwg-init <folder>`: writes a starter project that builds to a double-clickable page.
|
|
27
|
+
- `assets/credits.json` becomes `CREDITS.txt` in the compiled output (`compileResources`, `creditsText`).
|
|
28
|
+
- `@datamoc/mwg`, the short name for the package, generated into `packages/mwg` by `npm run alias:write` (publishing it is a separate step).
|
|
29
|
+
- Roadmap 412 is the owner-only step left: publishing `@datamoc/mwg`.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- `assets.resolve` returns a `data:` or `blob:` URL unchanged, so a synthesized tone or a runtime blob composes with `Sound`, `Music` and textures.
|
|
34
|
+
- `SpriteSheet.grid` warns when the frame size does not divide the sheet instead of cutting distorted frames silently.
|
|
35
|
+
- The README status line names the current version and the core row no longer calls the loop fixed-step.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- `compile-resources`, `compress-dist`, `play-uci`, `build-tablebases` and `compile-openings` took any importer whose file name was a suffix of theirs (`t.mjs` for `compress-dist.mjs`) for their own command line and ran it on import; they now compare real paths.
|
|
40
|
+
- A sound that is missing from the build plays as silence with a warning instead of rejecting inside `Game.start` and leaving a black screen.
|
|
41
|
+
- `tools/vite.mjs` and the build tools it imports no longer use top-level await, so a `vite.config.ts` in a project without `"type": "module"` loads.
|
|
42
|
+
- `mwgPage()` and the examples stop printing the `EMPTY_IMPORT_META` warning on every build.
|
|
43
|
+
|
|
44
|
+
## [0.36.1] - 2026-10-13
|
|
45
|
+
|
|
46
|
+
A maintenance release: the optional Lua dependency catches up with Pyroeis 0.9.0, and the CI no longer hangs on a stuck browser.
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- The optional `@datamoc/pyroeis` dependency moves from `^0.6.0` to `^0.9.0`. No API change on the mwg side.
|
|
51
|
+
- The Actions group is bumped (`actions/setup-node` 7.1.0 and `actions/upload-artifact`).
|
|
52
|
+
- The scheduled browser benchmark uses floors fit for a software-rendered runner (10 fps, p95 250 ms) instead of the GPU defaults it failed every week; the 15% history comparison still catches regressions.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- The browser driver kills the whole browser process group when it times out or closes, instead of only the launcher. Surviving helper processes held the output pipes and kept `npm test` alive until the runner's 6 hour limit.
|
|
57
|
+
- The browser start-up budget is 90 s and the CI `check` job is capped at 30 minutes; Linux Chrome runs with `--disable-dev-shm-usage --disable-gpu`.
|
|
58
|
+
|
|
10
59
|
## [0.36.0] - 2026-10-12
|
|
11
60
|
|
|
12
61
|
The optional Lua integration uses Pyroeis, with a matching public subpath, factories and types. Games using the Lua host must update their imports to `mwl/pyroeis` and the `Pyroeis` names.
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ playable in the browser with no download, plus the generated API reference.
|
|
|
15
15
|
planning or porting a demanding game with mwg, with links to the [mwg reference](https://github.com/datamoc/mwg/blob/main/REFERENCE.md)
|
|
16
16
|
and the [mwg Pixel Dungeon study](https://datamoc.github.io/mwg-pixel-dungeon/).
|
|
17
17
|
|
|
18
|
-
> **Status: pre-alpha (v0.
|
|
18
|
+
> **Status: pre-alpha (v0.36).** Every module in the shared floor below, plus optional
|
|
19
19
|
> 3D, mobile (Capacitor) and desktop (WebView2) packaging, is built and tested - see
|
|
20
20
|
> [ROADMAP.md](https://github.com/datamoc/mwg/blob/main/ROADMAP.md) for open work, and
|
|
21
21
|
> [CLOSED.md](https://github.com/datamoc/mwg/blob/main/CLOSED.md) for the full, numbered shipped history.
|
|
@@ -164,6 +164,10 @@ With Vite, none of that is by hand: `@datamoc/mw_games/tools/vite`'s `mwgPage()`
|
|
|
164
164
|
the classic-script configuration and, when `vite build` finishes, compiles `assets/`, rewrites
|
|
165
165
|
the tag and precompresses the output (item 381). The same finishing step is `emitPage` from
|
|
166
166
|
`@datamoc/mw_games/tools/emit-page`, or the `mwg-emit` command, for another bundler.
|
|
167
|
+
`mwgPage({ singleFile: true })` (or `{ singleFile: { compress: true } }`) additionally writes one
|
|
168
|
+
self-contained `standalone.html`. Plain `.ts` tests under `node --test` need a Node with type
|
|
169
|
+
stripping (22.18 or later, or any build with `--experimental-strip-types`); otherwise run them
|
|
170
|
+
through `tsx`.
|
|
167
171
|
|
|
168
172
|
The finished page also carries a Content-Security-Policy, with nothing to configure (item 374):
|
|
169
173
|
scripts only from its own folder and its own hashed inline scripts, no network request except to
|
|
@@ -190,7 +194,7 @@ only some do.
|
|
|
190
194
|
|
|
191
195
|
| area | capability | provided by |
|
|
192
196
|
| --- | --- | --- |
|
|
193
|
-
| **core** | fixed
|
|
197
|
+
| **core** | frame loop (variable `dt`, clamped; `FixedStepper` for fixed simulation steps), scenes, timing | `mwg/core` |
|
|
194
198
|
| | signals and listeners | `mwg/core` |
|
|
195
199
|
| | deterministic seeded RNG, reproducible across machines | `mwg/core` |
|
|
196
200
|
| | named, versioned save slots with a preview | `mwg/core` |
|
package/api-surface.json
CHANGED
|
@@ -611,6 +611,12 @@
|
|
|
611
611
|
"subpath": ".",
|
|
612
612
|
"declaringModule": "core/Settings.d.ts"
|
|
613
613
|
},
|
|
614
|
+
{
|
|
615
|
+
"name": "defaultStorage",
|
|
616
|
+
"kind": "function",
|
|
617
|
+
"subpath": ".",
|
|
618
|
+
"declaringModule": "core/Save.d.ts"
|
|
619
|
+
},
|
|
614
620
|
{
|
|
615
621
|
"name": "defaultTheme",
|
|
616
622
|
"kind": "const",
|
|
@@ -677,6 +683,18 @@
|
|
|
677
683
|
"subpath": ".",
|
|
678
684
|
"declaringModule": "two-d/ui/Dropdown.d.ts"
|
|
679
685
|
},
|
|
686
|
+
{
|
|
687
|
+
"name": "DropdownView",
|
|
688
|
+
"kind": "class",
|
|
689
|
+
"subpath": ".",
|
|
690
|
+
"declaringModule": "two-d/ui/DropdownView.d.ts"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
"name": "DropdownViewOptions",
|
|
694
|
+
"kind": "interface",
|
|
695
|
+
"subpath": ".",
|
|
696
|
+
"declaringModule": "two-d/ui/DropdownView.d.ts"
|
|
697
|
+
},
|
|
680
698
|
{
|
|
681
699
|
"name": "Easing",
|
|
682
700
|
"kind": "const",
|
|
@@ -767,6 +785,12 @@
|
|
|
767
785
|
"subpath": ".",
|
|
768
786
|
"declaringModule": "two-d/ui/TextSharpness.d.ts"
|
|
769
787
|
},
|
|
788
|
+
{
|
|
789
|
+
"name": "FixedStepper",
|
|
790
|
+
"kind": "class",
|
|
791
|
+
"subpath": ".",
|
|
792
|
+
"declaringModule": "core/FixedStepper.d.ts"
|
|
793
|
+
},
|
|
770
794
|
{
|
|
771
795
|
"name": "FlightHandle",
|
|
772
796
|
"kind": "interface",
|
|
@@ -875,6 +899,30 @@
|
|
|
875
899
|
"subpath": ".",
|
|
876
900
|
"declaringModule": "core/Random.d.ts"
|
|
877
901
|
},
|
|
902
|
+
{
|
|
903
|
+
"name": "FlowItem",
|
|
904
|
+
"kind": "interface",
|
|
905
|
+
"subpath": ".",
|
|
906
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
"name": "flowLayout",
|
|
910
|
+
"kind": "function",
|
|
911
|
+
"subpath": ".",
|
|
912
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"name": "FlowOptions",
|
|
916
|
+
"kind": "interface",
|
|
917
|
+
"subpath": ".",
|
|
918
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
"name": "FlowResult",
|
|
922
|
+
"kind": "interface",
|
|
923
|
+
"subpath": ".",
|
|
924
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
925
|
+
},
|
|
878
926
|
{
|
|
879
927
|
"name": "FogCell",
|
|
880
928
|
"kind": "type",
|
|
@@ -2933,6 +2981,12 @@
|
|
|
2933
2981
|
"subpath": ".",
|
|
2934
2982
|
"declaringModule": "two-d/render/StatusVisuals.d.ts"
|
|
2935
2983
|
},
|
|
2984
|
+
{
|
|
2985
|
+
"name": "StoredValue",
|
|
2986
|
+
"kind": "class",
|
|
2987
|
+
"subpath": ".",
|
|
2988
|
+
"declaringModule": "core/StoredValue.d.ts"
|
|
2989
|
+
},
|
|
2936
2990
|
{
|
|
2937
2991
|
"name": "StoryBeat",
|
|
2938
2992
|
"kind": "interface",
|
|
@@ -5363,6 +5417,12 @@
|
|
|
5363
5417
|
"subpath": "./audio",
|
|
5364
5418
|
"declaringModule": "audio/SoundFont.d.ts"
|
|
5365
5419
|
},
|
|
5420
|
+
{
|
|
5421
|
+
"name": "synthesizeSound",
|
|
5422
|
+
"kind": "function",
|
|
5423
|
+
"subpath": "./audio",
|
|
5424
|
+
"declaringModule": "audio/Synth.d.ts"
|
|
5425
|
+
},
|
|
5366
5426
|
{
|
|
5367
5427
|
"name": "synthesizeTone",
|
|
5368
5428
|
"kind": "function",
|
|
@@ -6581,6 +6641,12 @@
|
|
|
6581
6641
|
"subpath": "./core",
|
|
6582
6642
|
"declaringModule": "core/Settings.d.ts"
|
|
6583
6643
|
},
|
|
6644
|
+
{
|
|
6645
|
+
"name": "defaultStorage",
|
|
6646
|
+
"kind": "function",
|
|
6647
|
+
"subpath": "./core",
|
|
6648
|
+
"declaringModule": "core/Save.d.ts"
|
|
6649
|
+
},
|
|
6584
6650
|
{
|
|
6585
6651
|
"name": "deserializeReplay",
|
|
6586
6652
|
"kind": "function",
|
|
@@ -6677,6 +6743,12 @@
|
|
|
6677
6743
|
"subpath": "./core",
|
|
6678
6744
|
"declaringModule": "core/Feedback.d.ts"
|
|
6679
6745
|
},
|
|
6746
|
+
{
|
|
6747
|
+
"name": "FixedStepper",
|
|
6748
|
+
"kind": "class",
|
|
6749
|
+
"subpath": "./core",
|
|
6750
|
+
"declaringModule": "core/FixedStepper.d.ts"
|
|
6751
|
+
},
|
|
6680
6752
|
{
|
|
6681
6753
|
"name": "FloatSource",
|
|
6682
6754
|
"kind": "interface",
|
|
@@ -7367,6 +7439,12 @@
|
|
|
7367
7439
|
"subpath": "./core",
|
|
7368
7440
|
"declaringModule": "core/State.d.ts"
|
|
7369
7441
|
},
|
|
7442
|
+
{
|
|
7443
|
+
"name": "StoredValue",
|
|
7444
|
+
"kind": "class",
|
|
7445
|
+
"subpath": "./core",
|
|
7446
|
+
"declaringModule": "core/StoredValue.d.ts"
|
|
7447
|
+
},
|
|
7370
7448
|
{
|
|
7371
7449
|
"name": "SyncGuard",
|
|
7372
7450
|
"kind": "class",
|
|
@@ -9035,6 +9113,84 @@
|
|
|
9035
9113
|
"subpath": "./mwl/pyroeis",
|
|
9036
9114
|
"declaringModule": "mwl/pyroeis-runtime.d.ts"
|
|
9037
9115
|
},
|
|
9116
|
+
{
|
|
9117
|
+
"name": "BodyOptions",
|
|
9118
|
+
"kind": "interface",
|
|
9119
|
+
"subpath": "./physics",
|
|
9120
|
+
"declaringModule": "physics/PhysicsWorld.d.ts"
|
|
9121
|
+
},
|
|
9122
|
+
{
|
|
9123
|
+
"name": "ConstraintOptions",
|
|
9124
|
+
"kind": "interface",
|
|
9125
|
+
"subpath": "./physics",
|
|
9126
|
+
"declaringModule": "physics/PhysicsWorld.d.ts"
|
|
9127
|
+
},
|
|
9128
|
+
{
|
|
9129
|
+
"name": "PhysicsBody",
|
|
9130
|
+
"kind": "type",
|
|
9131
|
+
"subpath": "./physics",
|
|
9132
|
+
"declaringModule": "physics/PhysicsWorld.d.ts"
|
|
9133
|
+
},
|
|
9134
|
+
{
|
|
9135
|
+
"name": "PhysicsConstraint",
|
|
9136
|
+
"kind": "type",
|
|
9137
|
+
"subpath": "./physics",
|
|
9138
|
+
"declaringModule": "physics/PhysicsWorld.d.ts"
|
|
9139
|
+
},
|
|
9140
|
+
{
|
|
9141
|
+
"name": "PhysicsOptions",
|
|
9142
|
+
"kind": "interface",
|
|
9143
|
+
"subpath": "./physics",
|
|
9144
|
+
"declaringModule": "physics/PhysicsWorld.d.ts"
|
|
9145
|
+
},
|
|
9146
|
+
{
|
|
9147
|
+
"name": "PhysicsWorld",
|
|
9148
|
+
"kind": "class",
|
|
9149
|
+
"subpath": "./physics",
|
|
9150
|
+
"declaringModule": "physics/PhysicsWorld.d.ts"
|
|
9151
|
+
},
|
|
9152
|
+
{
|
|
9153
|
+
"name": "XpbdGround",
|
|
9154
|
+
"kind": "type",
|
|
9155
|
+
"subpath": "./physics/xpbd",
|
|
9156
|
+
"declaringModule": "physics/XpbdWorld.d.ts"
|
|
9157
|
+
},
|
|
9158
|
+
{
|
|
9159
|
+
"name": "XpbdLink",
|
|
9160
|
+
"kind": "interface",
|
|
9161
|
+
"subpath": "./physics/xpbd",
|
|
9162
|
+
"declaringModule": "physics/XpbdWorld.d.ts"
|
|
9163
|
+
},
|
|
9164
|
+
{
|
|
9165
|
+
"name": "XpbdLinkSpec",
|
|
9166
|
+
"kind": "interface",
|
|
9167
|
+
"subpath": "./physics/xpbd",
|
|
9168
|
+
"declaringModule": "physics/XpbdWorld.d.ts"
|
|
9169
|
+
},
|
|
9170
|
+
{
|
|
9171
|
+
"name": "XpbdNode",
|
|
9172
|
+
"kind": "interface",
|
|
9173
|
+
"subpath": "./physics/xpbd",
|
|
9174
|
+
"declaringModule": "physics/XpbdWorld.d.ts"
|
|
9175
|
+
},
|
|
9176
|
+
{
|
|
9177
|
+
"name": "XpbdNodeSpec",
|
|
9178
|
+
"kind": "interface",
|
|
9179
|
+
"subpath": "./physics/xpbd",
|
|
9180
|
+
"declaringModule": "physics/XpbdWorld.d.ts"
|
|
9181
|
+
},
|
|
9182
|
+
{
|
|
9183
|
+
"name": "XpbdOptions",
|
|
9184
|
+
"kind": "interface",
|
|
9185
|
+
"subpath": "./physics/xpbd",
|
|
9186
|
+
"declaringModule": "physics/XpbdWorld.d.ts"
|
|
9187
|
+
},
|
|
9188
|
+
{
|
|
9189
|
+
"name": "XpbdWorld",
|
|
9190
|
+
"kind": "class",
|
|
9191
|
+
"subpath": "./physics/xpbd",
|
|
9192
|
+
"declaringModule": "physics/XpbdWorld.d.ts"
|
|
9193
|
+
},
|
|
9038
9194
|
{
|
|
9039
9195
|
"name": "AbilityCycle",
|
|
9040
9196
|
"kind": "class",
|
|
@@ -10637,6 +10793,12 @@
|
|
|
10637
10793
|
"subpath": "./tools/i18n-edit",
|
|
10638
10794
|
"declaringModule": "tools/i18n-edit.mjs"
|
|
10639
10795
|
},
|
|
10796
|
+
{
|
|
10797
|
+
"name": "./tools/init",
|
|
10798
|
+
"kind": "tool",
|
|
10799
|
+
"subpath": "./tools/init",
|
|
10800
|
+
"declaringModule": "tools/init.mjs"
|
|
10801
|
+
},
|
|
10640
10802
|
{
|
|
10641
10803
|
"name": "./tools/make-example-assets",
|
|
10642
10804
|
"kind": "tool",
|
|
@@ -11129,6 +11291,18 @@
|
|
|
11129
11291
|
"subpath": "./two-d",
|
|
11130
11292
|
"declaringModule": "two-d/ui/Dropdown.d.ts"
|
|
11131
11293
|
},
|
|
11294
|
+
{
|
|
11295
|
+
"name": "DropdownView",
|
|
11296
|
+
"kind": "class",
|
|
11297
|
+
"subpath": "./two-d",
|
|
11298
|
+
"declaringModule": "two-d/ui/DropdownView.d.ts"
|
|
11299
|
+
},
|
|
11300
|
+
{
|
|
11301
|
+
"name": "DropdownViewOptions",
|
|
11302
|
+
"kind": "interface",
|
|
11303
|
+
"subpath": "./two-d",
|
|
11304
|
+
"declaringModule": "two-d/ui/DropdownView.d.ts"
|
|
11305
|
+
},
|
|
11132
11306
|
{
|
|
11133
11307
|
"name": "EMPTY",
|
|
11134
11308
|
"kind": "const",
|
|
@@ -11255,6 +11429,30 @@
|
|
|
11255
11429
|
"subpath": "./two-d",
|
|
11256
11430
|
"declaringModule": "two-d/ui/FloatingTextStack.d.ts"
|
|
11257
11431
|
},
|
|
11432
|
+
{
|
|
11433
|
+
"name": "FlowItem",
|
|
11434
|
+
"kind": "interface",
|
|
11435
|
+
"subpath": "./two-d",
|
|
11436
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
11437
|
+
},
|
|
11438
|
+
{
|
|
11439
|
+
"name": "flowLayout",
|
|
11440
|
+
"kind": "function",
|
|
11441
|
+
"subpath": "./two-d",
|
|
11442
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
11443
|
+
},
|
|
11444
|
+
{
|
|
11445
|
+
"name": "FlowOptions",
|
|
11446
|
+
"kind": "interface",
|
|
11447
|
+
"subpath": "./two-d",
|
|
11448
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
11449
|
+
},
|
|
11450
|
+
{
|
|
11451
|
+
"name": "FlowResult",
|
|
11452
|
+
"kind": "interface",
|
|
11453
|
+
"subpath": "./two-d",
|
|
11454
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
11455
|
+
},
|
|
11258
11456
|
{
|
|
11259
11457
|
"name": "FogCell",
|
|
11260
11458
|
"kind": "type",
|
|
@@ -14531,6 +14729,18 @@
|
|
|
14531
14729
|
"subpath": "./two-d/ui",
|
|
14532
14730
|
"declaringModule": "two-d/ui/Dropdown.d.ts"
|
|
14533
14731
|
},
|
|
14732
|
+
{
|
|
14733
|
+
"name": "DropdownView",
|
|
14734
|
+
"kind": "class",
|
|
14735
|
+
"subpath": "./two-d/ui",
|
|
14736
|
+
"declaringModule": "two-d/ui/DropdownView.d.ts"
|
|
14737
|
+
},
|
|
14738
|
+
{
|
|
14739
|
+
"name": "DropdownViewOptions",
|
|
14740
|
+
"kind": "interface",
|
|
14741
|
+
"subpath": "./two-d/ui",
|
|
14742
|
+
"declaringModule": "two-d/ui/DropdownView.d.ts"
|
|
14743
|
+
},
|
|
14534
14744
|
{
|
|
14535
14745
|
"name": "escapeHtml",
|
|
14536
14746
|
"kind": "function",
|
|
@@ -14621,6 +14831,30 @@
|
|
|
14621
14831
|
"subpath": "./two-d/ui",
|
|
14622
14832
|
"declaringModule": "two-d/ui/FloatingTextStack.d.ts"
|
|
14623
14833
|
},
|
|
14834
|
+
{
|
|
14835
|
+
"name": "FlowItem",
|
|
14836
|
+
"kind": "interface",
|
|
14837
|
+
"subpath": "./two-d/ui",
|
|
14838
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
14839
|
+
},
|
|
14840
|
+
{
|
|
14841
|
+
"name": "flowLayout",
|
|
14842
|
+
"kind": "function",
|
|
14843
|
+
"subpath": "./two-d/ui",
|
|
14844
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
14845
|
+
},
|
|
14846
|
+
{
|
|
14847
|
+
"name": "FlowOptions",
|
|
14848
|
+
"kind": "interface",
|
|
14849
|
+
"subpath": "./two-d/ui",
|
|
14850
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
14851
|
+
},
|
|
14852
|
+
{
|
|
14853
|
+
"name": "FlowResult",
|
|
14854
|
+
"kind": "interface",
|
|
14855
|
+
"subpath": "./two-d/ui",
|
|
14856
|
+
"declaringModule": "two-d/ui/Layout.d.ts"
|
|
14857
|
+
},
|
|
14624
14858
|
{
|
|
14625
14859
|
"name": "GlyphLayout",
|
|
14626
14860
|
"kind": "interface",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/assets/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACxC;CACD;AAKD,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAKD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,CAEzE;AAOD,2EAA2E;AAC3E,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,KAAK,IAAI,MAAM,EAAE,CAEhC;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGzC;AAED,wEAAwE;AACxE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/assets/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACxC;CACD;AAKD,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE1C;AAKD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,CAEzE;AAOD,2EAA2E;AAC3E,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,KAAK,IAAI,MAAM,EAAE,CAEhC;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGzC;AAED,wEAAwE;AACxE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa5C;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC"}
|
package/dist/assets/paths.js
CHANGED
|
@@ -76,6 +76,9 @@ export function has(path) {
|
|
|
76
76
|
}
|
|
77
77
|
/** an asset path resolved to something the browser can actually load */
|
|
78
78
|
export function resolve(path) {
|
|
79
|
+
//already a loadable URL (a synthesized tone, a canvas blob): nothing to look up
|
|
80
|
+
if (/^(data|blob):/.test(path))
|
|
81
|
+
return path;
|
|
79
82
|
const map = compiled();
|
|
80
83
|
if (!map)
|
|
81
84
|
return base + path;
|
package/dist/assets/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/assets/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAQH,kFAAkF;AAClF,IAAI,IAAI,GAAG,EAAE,CAAC;AAEd,mEAAmE;AACnE,MAAM,UAAU,OAAO,CAAC,IAAY;IACnC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC;AAC9D,CAAC;AAED,yFAAyF;AACzF,IAAI,QAA4C,CAAC;AAEjD;;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AM,IAAI,KAAK,CACd,UAAU,IAAI,mFAAmF,CACjG,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Playable.d.ts","sourceRoot":"","sources":["../../src/audio/Playable.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACxB,IAAI,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,KAAK,IAAI,IAAI,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;+EAC2E;IAC3E,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"Playable.d.ts","sourceRoot":"","sources":["../../src/audio/Playable.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACxB,IAAI,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,KAAK,IAAI,IAAI,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;+EAC2E;IAC3E,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAUlD"}
|
package/dist/audio/Playable.js
CHANGED
|
@@ -11,6 +11,19 @@ import * as Resources from '../assets/paths.js';
|
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
export function createAudio(path) {
|
|
14
|
-
|
|
14
|
+
let url;
|
|
15
|
+
try {
|
|
16
|
+
url = Resources.resolve(path);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
//a sound missing from the build must not stop the game from starting: it plays as silence
|
|
20
|
+
console.warn(`${error.message} - "${path}" will be silent`);
|
|
21
|
+
return silentPlayable();
|
|
22
|
+
}
|
|
23
|
+
return new Audio(url);
|
|
24
|
+
}
|
|
25
|
+
/** a `Playable` that makes no sound, standing in for an asset that could not be resolved */
|
|
26
|
+
function silentPlayable() {
|
|
27
|
+
return { play() { }, pause() { }, currentTime: 0, volume: 1, loop: false };
|
|
15
28
|
}
|
|
16
29
|
//# sourceMappingURL=Playable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Playable.js","sourceRoot":"","sources":["../../src/audio/Playable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAqBhD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACvC,OAAO,IAAI,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"Playable.js","sourceRoot":"","sources":["../../src/audio/Playable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAqBhD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACvC,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACJ,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,0FAA0F;QAC1F,OAAO,CAAC,IAAI,CAAC,GAAI,KAAe,CAAC,OAAO,OAAO,IAAI,kBAAkB,CAAC,CAAC;QACvE,OAAO,cAAc,EAAE,CAAC;IACzB,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,4FAA4F;AAC5F,SAAS,cAAc;IACtB,OAAO,EAAE,IAAI,KAAI,CAAC,EAAE,KAAK,KAAI,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC1E,CAAC"}
|
package/dist/audio/Synth.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Playable } from './Playable.ts';
|
|
2
|
+
import { Sound, type SoundOptions } from './Sound.ts';
|
|
2
3
|
/**
|
|
3
4
|
* A small runtime waveform generator - the licence-avoiding synthesis
|
|
4
5
|
* `tools/make-example-assets.mjs` already does offline for this project's own example
|
|
@@ -47,4 +48,17 @@ export declare function synthesizeTone(options?: ToneOptions): string;
|
|
|
47
48
|
* ```
|
|
48
49
|
*/
|
|
49
50
|
export declare function playTone(options?: ToneOptions, create?: (dataUri: string) => Playable): Playable;
|
|
51
|
+
/**
|
|
52
|
+
* A pooled `Sound` playing a synthesized tone: `synthesizeTone` and `Sound` composed, for the
|
|
53
|
+
* common case of a procedural effect that must overlap itself.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { synthesizeSound } from '@datamoc/mw_games/audio';
|
|
58
|
+
*
|
|
59
|
+
* const blip = synthesizeSound({ waveform: 'square', frequency: 660, duration: 0.08 }, { poolSize: 6 });
|
|
60
|
+
* blip.play(1, 0.9 + Math.random() * 0.2); // a little pitch variance per hit
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function synthesizeSound(tone?: ToneOptions, sound?: SoundOptions): Sound;
|
|
50
64
|
//# sourceMappingURL=Synth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Synth.d.ts","sourceRoot":"","sources":["../../src/audio/Synth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Synth.d.ts","sourceRoot":"","sources":["../../src/audio/Synth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,WAAgB,GAAG,MAAM,CAsBhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CACvB,OAAO,GAAE,WAAgB,EACzB,MAAM,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,QAAkC,GAC7D,QAAQ,CAMV;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,WAAgB,EAAE,KAAK,GAAE,YAAiB,GAAG,KAAK,CAEvF"}
|
package/dist/audio/Synth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Sound } from './Sound.js';
|
|
1
2
|
/**
|
|
2
3
|
* Renders a short tone to a `data:audio/wav` URI, ready to hand to an `Audio` element (or
|
|
3
4
|
* any other `Playable` source) without touching the network or `mwg/assets` - nothing here
|
|
@@ -54,6 +55,21 @@ export function playTone(options = {}, create = (uri) => new Audio(uri)) {
|
|
|
54
55
|
void Promise.resolve(playable.play()).catch(() => { });
|
|
55
56
|
return playable;
|
|
56
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* A pooled `Sound` playing a synthesized tone: `synthesizeTone` and `Sound` composed, for the
|
|
60
|
+
* common case of a procedural effect that must overlap itself.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* import { synthesizeSound } from '@datamoc/mw_games/audio';
|
|
65
|
+
*
|
|
66
|
+
* const blip = synthesizeSound({ waveform: 'square', frequency: 660, duration: 0.08 }, { poolSize: 6 });
|
|
67
|
+
* blip.play(1, 0.9 + Math.random() * 0.2); // a little pitch variance per hit
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export function synthesizeSound(tone = {}, sound = {}) {
|
|
71
|
+
return new Sound(synthesizeTone(tone), sound);
|
|
72
|
+
}
|
|
57
73
|
function waveSample(waveform, phase, seed, index) {
|
|
58
74
|
switch (waveform) {
|
|
59
75
|
case 'sine':
|
package/dist/audio/Synth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Synth.js","sourceRoot":"","sources":["../../src/audio/Synth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Synth.js","sourceRoot":"","sources":["../../src/audio/Synth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAqB,MAAM,YAAY,CAAC;AAyBtD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,OAAO,GAAgB,EAAE;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC;IAC9C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,GAAG,CAAC;IAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAA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AAE,CAAC;IAChB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9D,OAAO,yBAAyB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,UAAU,CAAC,IAAc,EAAE,MAAc,EAAE,IAAY;IAC/D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC"}
|
package/dist/audio/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { createAudio } from './Playable.ts';
|
|
|
8
8
|
export type { Playable } from './Playable.ts';
|
|
9
9
|
export { Orchestrator } from './Orchestrator.ts';
|
|
10
10
|
export type { OrchestratorState } from './Orchestrator.ts';
|
|
11
|
-
export { synthesizeTone, playTone } from './Synth.ts';
|
|
11
|
+
export { synthesizeTone, synthesizeSound, playTone } from './Synth.ts';
|
|
12
12
|
export type { Waveform, ToneOptions } from './Synth.ts';
|
|
13
13
|
export { parseMidi, scheduleMidi, noteToFrequency, midiLoopStart, MidiPlayer } from './Midi.ts';
|
|
14
14
|
export type { MidiFile, MidiEvent, MidiNoteEvent, MidiTempoEvent, MidiProgramEvent, MidiControlEvent, MidiPitchBendEvent, MidiVoice, ScheduledNote, MidiPlayerOptions, } from './Midi.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAA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AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,YAAY,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAChF,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/audio/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { onCaption } from './Captions.js';
|
|
|
3
3
|
export { Music } from './Music.js';
|
|
4
4
|
export { createAudio } from './Playable.js';
|
|
5
5
|
export { Orchestrator } from './Orchestrator.js';
|
|
6
|
-
export { synthesizeTone, playTone } from './Synth.js';
|
|
6
|
+
export { synthesizeTone, synthesizeSound, playTone } from './Synth.js';
|
|
7
7
|
export { parseMidi, scheduleMidi, noteToFrequency, midiLoopStart, MidiPlayer } from './Midi.js';
|
|
8
8
|
export { renderMidiToBuffer, renderMidiToBufferAsync } from './MidiRender.js';
|
|
9
9
|
export { collectSoundFontUsage, parseSoundFont, subsetSoundFont } from './SoundFont.js';
|
package/dist/audio/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,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M,+BAA+B,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns the variable frame time `Scene.update(dt)` receives into fixed simulation steps.
|
|
3
|
+
*
|
|
4
|
+
* `Game` clamps and scales each frame's `dt` but does not make it constant, so a simulation
|
|
5
|
+
* that must be deterministic and independent of the display's refresh rate (a physics solver,
|
|
6
|
+
* a lockstep game) feeds `dt` here and runs its tick once per returned step instead. The
|
|
7
|
+
* leftover time carries to the next frame, and `maxSubsteps` bounds a slow frame so catching
|
|
8
|
+
* up cannot make the next frame slower still.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { FixedStepper } from '@datamoc/mw_games/core';
|
|
13
|
+
*
|
|
14
|
+
* const stepper = new FixedStepper(1 / 60);
|
|
15
|
+
* const world = { step: (h: number) => console.log('step', h) };
|
|
16
|
+
* // inside Scene.update(dt), here one 40 ms frame:
|
|
17
|
+
* const dt = 0.04;
|
|
18
|
+
* stepper.advance(dt, (h) => world.step(h));
|
|
19
|
+
* const blend = stepper.alpha; // 0..1 into the next step, for interpolated drawing
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class FixedStepper {
|
|
23
|
+
readonly step: number;
|
|
24
|
+
readonly maxSubsteps: number;
|
|
25
|
+
private accumulator;
|
|
26
|
+
constructor(step?: number, maxSubsteps?: number);
|
|
27
|
+
/**
|
|
28
|
+
* Adds `dt` seconds and runs `tick(step)` for every whole step now due.
|
|
29
|
+
*
|
|
30
|
+
* @returns how many steps ran; time beyond `maxSubsteps` steps is dropped, not banked
|
|
31
|
+
*/
|
|
32
|
+
advance(dt: number, tick: (step: number) => void): number;
|
|
33
|
+
/** how far into the next step the leftover time reaches, 0 up to (not including) 1 */
|
|
34
|
+
get alpha(): number;
|
|
35
|
+
/** forgets the leftover time, after a scene change or a load */
|
|
36
|
+
reset(): void;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=FixedStepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixedStepper.d.ts","sourceRoot":"","sources":["../../src/core/FixedStepper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAY;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,WAAW,CAAK;IAExB,YAAY,IAAI,SAAS,EAAE,WAAW,SAAI,EAIzC;IAED;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,CAUxD;IAED,sFAAsF;IACtF,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,gEAAgE;IAChE,KAAK,IAAI,IAAI,CAEZ;CACD"}
|