zx-kit 0.19.1 → 0.20.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 +242 -3
- package/dist/audio.d.ts +28 -3
- package/dist/audio.d.ts.map +1 -1
- package/dist/audio.js +28 -3
- package/dist/audio.js.map +1 -1
- package/dist/ay.d.ts +42 -3
- package/dist/ay.d.ts.map +1 -1
- package/dist/ay.js +42 -3
- package/dist/ay.js.map +1 -1
- package/dist/ui.d.ts +259 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +357 -0
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -536,7 +536,7 @@ requestAnimationFrame(loop)
|
|
|
536
536
|
| [`ay.ts`](#ayts--ay-3-8912-melodik-audio) | AY chip emulator: 3-channel tone, LFSR noise, 16 envelope shapes |
|
|
537
537
|
| [`renderer.ts`](#rendererts--canvas-renderer) | Canvas setup, sprites, text, scanlines, border flash |
|
|
538
538
|
| [`audio.ts`](#audiots--beeper-audio) | 1-bit beeper: square-wave notes, patterns, volume control |
|
|
539
|
-
| [`ui.ts`](#uits--ui-widgets) |
|
|
539
|
+
| [`ui.ts`](#uits--ui-widgets) | Boxes, frames, panel titles, progress bars + instrumentation widgets (dotted grids, segmented bars, fluid tanks, dials, text compass) |
|
|
540
540
|
| [`input.ts`](#inputts--keyboard-input) | Movement with key-repeat, action flags, state reset |
|
|
541
541
|
| [`sprite.ts`](#spritets--free-roaming-sprites) | Sprites: position, velocity, gravity, flip, render |
|
|
542
542
|
| [`collision.ts`](#collisionts--aabb-collision) | AABB overlap tests, tile-map wall resolution |
|
|
@@ -550,10 +550,77 @@ requestAnimationFrame(loop)
|
|
|
550
550
|
|
|
551
551
|
---
|
|
552
552
|
|
|
553
|
+
## Audio architecture — beeper vs AY
|
|
554
|
+
|
|
555
|
+
zx-kit ships two independent audio modules — [`audio.ts`](#audiots--beeper-audio) (the **beeper**) and [`ay.ts`](#ayts--ay-3-8912-melodik-audio) (the **AY chip**). They are **not alternatives** — most ZX Spectrum 128K games used both at once, and so should yours.
|
|
556
|
+
|
|
557
|
+
### The history (so the choice makes sense)
|
|
558
|
+
|
|
559
|
+
| Hardware | Beeper (1-bit) | AY-3-8912 (3 ch) |
|
|
560
|
+
|----------|:--:|:--:|
|
|
561
|
+
| Spectrum 48K | ✅ built-in | ❌ |
|
|
562
|
+
| Spectrum 128K / +2 / +3 | ✅ built-in | ✅ built-in |
|
|
563
|
+
| Melodik add-on (for 48K) | — | ✅ |
|
|
564
|
+
|
|
565
|
+
- **48K games** (Manic Miner, Jet Set Willy, Atic Atac) had only the beeper — every blip, jump, footstep and title jingle was a square wave forced out of the 1-bit speaker by tight CPU loops.
|
|
566
|
+
- **128K games** (Robocop, R-Type, Chase H.Q., Lord of the Rings) used the AY for **music** — proper 3-channel tunes with envelope shaping — while the beeper kept doing **sound effects** in parallel. AY hummed an orchestral score; the beeper still went *pew pew*.
|
|
567
|
+
|
|
568
|
+
### When to use which
|
|
569
|
+
|
|
570
|
+
| Want to play… | Module | Function | Why |
|
|
571
|
+
|---|---|---|---|
|
|
572
|
+
| Short SFX (shot, jump, hit, beep) | `audio.ts` | `beep(freq, dur, t)` | Single square wave, punchy, era-correct for SFX |
|
|
573
|
+
| A 3-channel jingle / chord | `ay.ts` | `playAY({ a, b, c })` | Needs ≥2 simultaneous voices |
|
|
574
|
+
| Game-over fanfare / level music | `ay.ts` | `playAY(...)` | Envelope shaping + multiple voices |
|
|
575
|
+
| Single-voice melody | `audio.ts` | `playPattern(notes)` | Lighter setup, no AY init needed |
|
|
576
|
+
| Live, dynamically-changing tone (siren, engine) | `ay.ts` | `createAY()` then `tone()` | Persistent oscillator handle |
|
|
577
|
+
| Title-screen music | `ay.ts` | `playAY(...)` | Authentic 128K title-music feel |
|
|
578
|
+
|
|
579
|
+
**Rule of thumb:** if it needs to be *heard at the same time as something else*, you almost certainly want AY for at least one of the two.
|
|
580
|
+
|
|
581
|
+
### Authentic parallel pattern — the "Robocop" pattern
|
|
582
|
+
|
|
583
|
+
This is how 128K games actually sounded:
|
|
584
|
+
|
|
585
|
+
```ts
|
|
586
|
+
import { initAudio, beep, getAudioContext, resumeAudio } from 'zx-kit' // beeper
|
|
587
|
+
import { playAY } from 'zx-kit' // AY
|
|
588
|
+
|
|
589
|
+
// One-time setup (must be inside a user gesture — click, keydown — due to browser autoplay policy)
|
|
590
|
+
window.addEventListener('keydown', () => { initAudio(); resumeAudio() }, { once: true })
|
|
591
|
+
|
|
592
|
+
// Title screen: AY plays a multi-voice melody...
|
|
593
|
+
playAY({
|
|
594
|
+
a: [{ freq: 523, dur: 200 }, { freq: 659, dur: 200 }, { freq: 784, dur: 400, envShape: 12, envCycleDurMs: 200 }],
|
|
595
|
+
b: [{ freq: 262, dur: 200 }, { freq: 330, dur: 200 }, { freq: 392, dur: 400 }],
|
|
596
|
+
})
|
|
597
|
+
|
|
598
|
+
// ...meanwhile in the game loop, beeper does the SFX:
|
|
599
|
+
function onPlayerShoots() {
|
|
600
|
+
const audio = getAudioContext()
|
|
601
|
+
if (audio) beep(1200, 40, audio.currentTime) // sharp pew
|
|
602
|
+
}
|
|
603
|
+
function onPlayerHit() {
|
|
604
|
+
const audio = getAudioContext()
|
|
605
|
+
if (audio) beep(120, 200, audio.currentTime) // low thump
|
|
606
|
+
}
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
Both modules route through the **same master `GainNode`**, so `setMasterVolume(v)` controls both at once. They share state cleanly — no audio bus conflicts.
|
|
610
|
+
|
|
611
|
+
### Notes on accuracy
|
|
612
|
+
|
|
613
|
+
- **Beeper** (`audio.ts`) is a faithful 1-bit-style square wave via Web Audio's `OscillatorNode`. Era-correct for SFX use.
|
|
614
|
+
- **AY** (`ay.ts`) is a *good approximation* of the AY-3-8912 — hardware-accurate logarithmic amplitudes (16 levels, ≈ √2 ratio), all 16 envelope shapes, proper LFSR noise. **Not sample-accurate**: Web Audio's `OscillatorNode` is band-limited (no aliasing artefacts), real AY's raw squares have a buzzier, fuzzier character; envelopes are smooth ramps here vs the chip's 16-step ramps. For chip-tune purists wanting bit-exact AY emulation, a future AudioWorklet-based backend is on the roadmap. For game sound and most music, the current implementation is more than convincing.
|
|
615
|
+
|
|
616
|
+
---
|
|
617
|
+
|
|
553
618
|
## `ay.ts` — AY-3-8912 Melodik Audio
|
|
554
619
|
|
|
555
620
|
The AY-3-8912 chip (sold as the *Melodik* add-on for ZX Spectrum 48K, built into the 128K) gave the Spectrum three independent square-wave channels, a shared LFSR noise generator, and a hardware envelope generator with 16 distinct shapes. This module emulates all of it via the Web Audio API with hardware-accurate logarithmic amplitude values.
|
|
556
621
|
|
|
622
|
+
> **Pair with [`audio.ts`](#audiots--beeper-audio) (the beeper) for sound effects.** Use AY for music, beeper for SFX — see [Audio architecture — beeper vs AY](#audio-architecture--beeper-vs-ay) for the historical context and the parallel-use pattern. Both modules share the same master gain, so `setMasterVolume()` controls them together.
|
|
623
|
+
|
|
557
624
|
Two usage modes:
|
|
558
625
|
|
|
559
626
|
| Mode | Function | Use case |
|
|
@@ -839,9 +906,11 @@ curveDisplay(ctx, 256, 208, 6) // stronger warp
|
|
|
839
906
|
|
|
840
907
|
## `audio.ts` — Beeper Audio
|
|
841
908
|
|
|
842
|
-
Single-channel 1-bit square-wave audio, faithful to the ZX Spectrum beeper. Use this for
|
|
909
|
+
Single-channel 1-bit square-wave audio, faithful to the ZX Spectrum beeper. Use this for **sound effects** (shots, jumps, hits, beeps) and simple monophonic melodies.
|
|
843
910
|
|
|
844
|
-
|
|
911
|
+
> **Pair with [`ay.ts`](#ayts--ay-3-8912-melodik-audio) for music.** This is how 128K Spectrum games actually sounded — see [Audio architecture — beeper vs AY](#audio-architecture--beeper-vs-ay) for the reasoning and the "Robocop" parallel-use pattern.
|
|
912
|
+
|
|
913
|
+
All audio routes through a shared `AudioContext` and master `GainNode` — `setMasterVolume()` controls both modules at once. **`initAudio()` must be called inside a user-gesture handler** due to browser autoplay policy.
|
|
845
914
|
|
|
846
915
|
### `initAudio(volume?): void`
|
|
847
916
|
|
|
@@ -993,6 +1062,176 @@ drawPanelTitle(ctx, {
|
|
|
993
1062
|
})
|
|
994
1063
|
```
|
|
995
1064
|
|
|
1065
|
+
### Instrumentation widgets (stateless)
|
|
1066
|
+
|
|
1067
|
+
Five stateless primitives for HUDs, dashboards and tactical displays — gauges, bars, tanks, dials, compass. Each function takes a `ctx` plus an `options` object and renders immediately. The caller drives state on every frame (no built-in animation, no internal timers). Pair with `Animation` / `Tween` from `animation.ts` if you want smoothed transitions.
|
|
1068
|
+
|
|
1069
|
+
#### `drawDottedGrid(ctx, options): void`
|
|
1070
|
+
|
|
1071
|
+
Regularly-spaced dot pattern. Useful for radar / sonar screens, tactical scanner overlays, debug grids, stippled backgrounds, alien-invasion detection grids.
|
|
1072
|
+
|
|
1073
|
+
```ts
|
|
1074
|
+
// Sonar background (submarine HUD)
|
|
1075
|
+
drawDottedGrid(ctx, {
|
|
1076
|
+
x: 8, y: 8, width: 64, height: 48,
|
|
1077
|
+
spacing: 4, color: C.GREEN, paper: C.BLACK,
|
|
1078
|
+
})
|
|
1079
|
+
|
|
1080
|
+
// Chunky 2×2 dots for tactical map overlay
|
|
1081
|
+
drawDottedGrid(ctx, {
|
|
1082
|
+
x: 0, y: 0, width: 256, height: 192,
|
|
1083
|
+
spacing: 8, dotSize: 2, color: C.B_WHITE,
|
|
1084
|
+
})
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
| Option | Type | Default | Description |
|
|
1088
|
+
|--------|------|---------|-------------|
|
|
1089
|
+
| `x`, `y`, `width`, `height` | `number` | — | Area covered by the dot field |
|
|
1090
|
+
| `spacing` | `number` | — | Distance between adjacent dot centres |
|
|
1091
|
+
| `color` | `SpectrumColor` | — | Dot colour |
|
|
1092
|
+
| `paper` | `SpectrumColor` | — | Optional background fill |
|
|
1093
|
+
| `dotSize` | `number` | `1` | Dot size in pixels (use `2` for chunkier dots) |
|
|
1094
|
+
|
|
1095
|
+
#### `drawSegmentedBar(ctx, options): void`
|
|
1096
|
+
|
|
1097
|
+
Discrete segmented bar — health, ammo, shield, fuel, stamina, mana, battery, damage. Computes `round(value/max * segments)` filled segments.
|
|
1098
|
+
|
|
1099
|
+
Two colouring strategies, mutually exclusive:
|
|
1100
|
+
|
|
1101
|
+
- **Single colour** (`color`): every filled segment uses it. Classic Robocop health style.
|
|
1102
|
+
- **Threshold gradient** (`colors: [low, mid, high]`): the widget picks one of three colours based on `value/max` (`< 1/3` → low, `< 2/3` → mid, else high). Classic oxygen / damage indicator.
|
|
1103
|
+
|
|
1104
|
+
```ts
|
|
1105
|
+
// Robocop-style health (single colour)
|
|
1106
|
+
drawSegmentedBar(ctx, {
|
|
1107
|
+
x: 0, y: 0, segments: 10, value: 7, max: 10,
|
|
1108
|
+
color: C.B_GREEN, paper: C.BLACK,
|
|
1109
|
+
})
|
|
1110
|
+
|
|
1111
|
+
// Oxygen with threshold gradient (red → yellow → green)
|
|
1112
|
+
drawSegmentedBar(ctx, {
|
|
1113
|
+
x: 0, y: 0, segments: 10, value: 8, max: 10,
|
|
1114
|
+
colors: [C.B_RED, C.B_YELLOW, C.B_GREEN],
|
|
1115
|
+
paper: C.BLACK,
|
|
1116
|
+
})
|
|
1117
|
+
|
|
1118
|
+
// Vertical bar (e.g. ammo column on the side of the HUD)
|
|
1119
|
+
drawSegmentedBar(ctx, {
|
|
1120
|
+
x: 0, y: 0, segments: 8, value: 5, max: 8,
|
|
1121
|
+
orientation: 'vertical', color: C.B_GREEN,
|
|
1122
|
+
})
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
| Option | Type | Default | Description |
|
|
1126
|
+
|--------|------|---------|-------------|
|
|
1127
|
+
| `x`, `y` | `number` | — | Top-left corner |
|
|
1128
|
+
| `segments` | `number` | — | Total segment count |
|
|
1129
|
+
| `value`, `max` | `number` | — | Filled = `round(value/max * segments)` |
|
|
1130
|
+
| `segmentWidth` | `number` | `8` (CELL) | Width of one segment |
|
|
1131
|
+
| `segmentHeight` | `number` | `8` (CELL) | Height of one segment |
|
|
1132
|
+
| `gap` | `number` | `1` | Pixels between adjacent segments |
|
|
1133
|
+
| `color` | `SpectrumColor` | — | Single fill colour (mutually exclusive with `colors`) |
|
|
1134
|
+
| `colors` | `[low, mid, high]` | — | Three-stop threshold gradient |
|
|
1135
|
+
| `paper` | `SpectrumColor` | — | Background for empty segments |
|
|
1136
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Layout direction |
|
|
1137
|
+
|
|
1138
|
+
#### `drawTank(ctx, options): void`
|
|
1139
|
+
|
|
1140
|
+
Fluid container — ballast tanks, fuel gauges, water reservoirs, lava levels, oil drums, chemical canisters. Liquid fills from the bottom up.
|
|
1141
|
+
|
|
1142
|
+
```ts
|
|
1143
|
+
// Submarine ballast tank (pill, cyan fluid)
|
|
1144
|
+
drawTank(ctx, {
|
|
1145
|
+
x: 8, y: 16, width: 16, height: 48,
|
|
1146
|
+
fillPct: 0.66, shape: 'pill',
|
|
1147
|
+
liquidColor: C.B_CYAN,
|
|
1148
|
+
containerColor: C.WHITE,
|
|
1149
|
+
emptyColor: C.BLACK,
|
|
1150
|
+
})
|
|
1151
|
+
|
|
1152
|
+
// Generic fuel gauge (rect, yellow fluid)
|
|
1153
|
+
drawTank(ctx, {
|
|
1154
|
+
x: 200, y: 8, width: 24, height: 32,
|
|
1155
|
+
fillPct: 0.4, shape: 'rect',
|
|
1156
|
+
liquidColor: C.B_YELLOW,
|
|
1157
|
+
containerColor: C.WHITE,
|
|
1158
|
+
emptyColor: C.BLACK,
|
|
1159
|
+
})
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
| Option | Type | Default | Description |
|
|
1163
|
+
|--------|------|---------|-------------|
|
|
1164
|
+
| `x`, `y`, `width`, `height` | `number` | — | Container bounding box |
|
|
1165
|
+
| `fillPct` | `number` | — | Fill level `0..1`, clamped |
|
|
1166
|
+
| `shape` | `'pill' \| 'rect'` | `'pill'` | `'pill'` = rounded caps, `'rect'` = sharp corners |
|
|
1167
|
+
| `liquidColor` | `SpectrumColor` | — | Fluid colour |
|
|
1168
|
+
| `containerColor` | `SpectrumColor` | `liquidColor` | Outline colour |
|
|
1169
|
+
| `emptyColor` | `SpectrumColor \| 'transparent'` | `C.BLACK` | Fill for the empty portion. Use `'transparent'` to leave it un-painted (so the underlying frame shows through) |
|
|
1170
|
+
|
|
1171
|
+
#### `drawDial(ctx, options): void`
|
|
1172
|
+
|
|
1173
|
+
Circular analog gauge with movable needle — RPM, speedometer, fuel, temperature, volume knob. Decorations (face fill, rim outline, tick marks) are optional; the needle alone is the minimum visible output.
|
|
1174
|
+
|
|
1175
|
+
```ts
|
|
1176
|
+
// Submarine motor RPM gauge (range 0–3000)
|
|
1177
|
+
drawDial(ctx, {
|
|
1178
|
+
cx: 128, cy: 100, radius: 24,
|
|
1179
|
+
value: 1500, min: 0, max: 3000,
|
|
1180
|
+
needleColor: C.B_RED,
|
|
1181
|
+
rimColor: C.WHITE,
|
|
1182
|
+
tickColor: C.WHITE,
|
|
1183
|
+
ticks: 7,
|
|
1184
|
+
})
|
|
1185
|
+
|
|
1186
|
+
// Bare minimum: just the needle
|
|
1187
|
+
drawDial(ctx, {
|
|
1188
|
+
cx: 50, cy: 50, radius: 10,
|
|
1189
|
+
value: 75, needleColor: C.B_GREEN,
|
|
1190
|
+
})
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
| Option | Type | Default | Description |
|
|
1194
|
+
|--------|------|---------|-------------|
|
|
1195
|
+
| `cx`, `cy`, `radius` | `number` | — | Centre and radius |
|
|
1196
|
+
| `value` | `number` | — | Mapped to needle angle |
|
|
1197
|
+
| `min` | `number` | `0` | Minimum value |
|
|
1198
|
+
| `max` | `number` | `100` | Maximum value |
|
|
1199
|
+
| `startAngle` | `number` (rad) | `3π/4` | Needle angle at `min` (bottom-left default) |
|
|
1200
|
+
| `endAngle` | `number` (rad) | `9π/4` | Needle angle at `max` (bottom-right, after sweeping CW through top) |
|
|
1201
|
+
| `needleColor` | `SpectrumColor` | — | Needle colour |
|
|
1202
|
+
| `faceColor` | `SpectrumColor` | — | Optional filled disc background |
|
|
1203
|
+
| `rimColor` | `SpectrumColor` | — | Optional circle outline |
|
|
1204
|
+
| `tickColor` | `SpectrumColor` | — | Optional tick mark colour (requires `ticks`) |
|
|
1205
|
+
| `ticks` | `number` | `0` | Number of evenly-spaced tick marks |
|
|
1206
|
+
|
|
1207
|
+
Angles use canvas convention: `0` = right, `π/2` = down, `π` = left, `3π/2` = up — angles increase **clockwise** because the canvas y-axis points down. Default sweep covers the typical 270° gauge arc through the top.
|
|
1208
|
+
|
|
1209
|
+
#### `drawCompassText(ctx, options): void`
|
|
1210
|
+
|
|
1211
|
+
Text-based heading indicator in the classic 80s tactical-display style `[W [NW] N [NE] E]` — current direction in the centre, highlighted, with two neighbouring directions on each side. Heading rounds to the nearest 45° step.
|
|
1212
|
+
|
|
1213
|
+
```ts
|
|
1214
|
+
drawCompassText(ctx, {
|
|
1215
|
+
x: 0, y: 168,
|
|
1216
|
+
heading: 0, // N
|
|
1217
|
+
color: C.WHITE,
|
|
1218
|
+
highlightColor: C.B_YELLOW,
|
|
1219
|
+
paper: C.BLACK,
|
|
1220
|
+
})
|
|
1221
|
+
// heading=0 → centre is N. Five labels: W, NW, N, NE, E
|
|
1222
|
+
// → `W [NW] N [NE] E` — centre "N" in bright yellow, ±1 in brackets,
|
|
1223
|
+
// outer ±2 ("W", "E") rendered plain.
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
| Option | Type | Default | Description |
|
|
1227
|
+
|--------|------|---------|-------------|
|
|
1228
|
+
| `x`, `y` | `number` | — | Top-left of the rendered string |
|
|
1229
|
+
| `heading` | `number` (degrees) | — | `0`/`360` = N, `90` = E, `180` = S, `270` = W (wraps automatically) |
|
|
1230
|
+
| `color` | `SpectrumColor` | — | Colour for non-current direction labels |
|
|
1231
|
+
| `highlightColor` | `SpectrumColor` | `color` | Colour for current direction (centre label) |
|
|
1232
|
+
| `paper` | `SpectrumColor` | — | Optional background behind labels |
|
|
1233
|
+
| `brackets` | `boolean` | `true` | Wrap **only the ±1 (adjacent) directions** in `[…]`. The centre label and the outer ±2 directions are never bracketed. |
|
|
1234
|
+
|
|
996
1235
|
### Stateful widget — Progress Bar
|
|
997
1236
|
|
|
998
1237
|
The progress bar is a **managed widget**: after a `drawProgressBar` call, the bar is automatically re-rendered on subsequent frames by `renderUI` until `visibilityLength` milliseconds have elapsed. Calling `drawProgressBar` again resets the timer.
|
package/dist/audio.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module audio
|
|
3
|
+
*
|
|
4
|
+
* **The beeper** — single-channel, 1-bit-style square-wave audio, faithful to
|
|
5
|
+
* the ZX Spectrum 48K speaker. Use this module for **sound effects** (jumps,
|
|
6
|
+
* shots, hits, beeps) and simple monophonic melodies.
|
|
7
|
+
*
|
|
8
|
+
* For **music** (multi-voice harmony, envelope shaping, noise mixing), use
|
|
9
|
+
* the companion {@link "ay" | ay.ts} module — the AY-3-8912 chip that 128K
|
|
10
|
+
* Spectrum games used alongside the beeper. Both modules share the same
|
|
11
|
+
* `AudioContext` and master `GainNode`, so:
|
|
12
|
+
*
|
|
13
|
+
* - `setMasterVolume()` controls both at once
|
|
14
|
+
* - `initAudio()` initialises both (call once, inside a user-gesture handler)
|
|
15
|
+
* - You can run AY music and beeper SFX in parallel — that's the authentic
|
|
16
|
+
* 128K pattern (Robocop, R-Type, Chase H.Q.…)
|
|
17
|
+
*
|
|
18
|
+
* @see {@link createAY} and {@link playAY} for multi-channel music in `ay.ts`
|
|
19
|
+
*/
|
|
1
20
|
/**
|
|
2
21
|
* Creates the shared `AudioContext` and master `GainNode`. Idempotent — safe to call
|
|
3
22
|
* multiple times (subsequent calls are no-ops).
|
|
@@ -95,10 +114,16 @@ export interface Note {
|
|
|
95
114
|
*/
|
|
96
115
|
export declare function playPattern(notes: Note[], startDelay?: number): void;
|
|
97
116
|
/**
|
|
98
|
-
* Schedules a single square-wave beep on the shared `AudioContext
|
|
99
|
-
*
|
|
117
|
+
* Schedules a single square-wave beep on the shared `AudioContext` — the
|
|
118
|
+
* canonical Spectrum **sound effect**: short, monophonic, era-correct.
|
|
119
|
+
*
|
|
120
|
+
* Uses a 5 ms linear ramp attack and release to avoid click artefacts.
|
|
100
121
|
* Routed through the master gain node.
|
|
101
|
-
*
|
|
122
|
+
*
|
|
123
|
+
* **When to reach for `beep`:** SFX (shots, jumps, hits, pickup blips).
|
|
124
|
+
* **For sequences,** use `playPattern`. **For multi-voice music,** use
|
|
125
|
+
* `playAY` from `ay.js` — the two modules are designed to run in parallel
|
|
126
|
+
* (AY music + beeper SFX = the authentic 128K Spectrum sound).
|
|
102
127
|
*
|
|
103
128
|
* @param freq - Frequency in Hz
|
|
104
129
|
* @param durationMs - Duration in milliseconds
|
package/dist/audio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../src/audio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../src/audio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAM,GAAG,IAAI,CAM5C;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,IAAI,YAAY,GAAG,IAAI,CAErD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,QAAQ,GAAG,IAAI,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAGpD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,6EAA6E;AAC7E,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,UAAU,SAAI,GAAG,IAAI,CAS/D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAc9E"}
|
package/dist/audio.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module audio
|
|
3
|
+
*
|
|
4
|
+
* **The beeper** — single-channel, 1-bit-style square-wave audio, faithful to
|
|
5
|
+
* the ZX Spectrum 48K speaker. Use this module for **sound effects** (jumps,
|
|
6
|
+
* shots, hits, beeps) and simple monophonic melodies.
|
|
7
|
+
*
|
|
8
|
+
* For **music** (multi-voice harmony, envelope shaping, noise mixing), use
|
|
9
|
+
* the companion {@link "ay" | ay.ts} module — the AY-3-8912 chip that 128K
|
|
10
|
+
* Spectrum games used alongside the beeper. Both modules share the same
|
|
11
|
+
* `AudioContext` and master `GainNode`, so:
|
|
12
|
+
*
|
|
13
|
+
* - `setMasterVolume()` controls both at once
|
|
14
|
+
* - `initAudio()` initialises both (call once, inside a user-gesture handler)
|
|
15
|
+
* - You can run AY music and beeper SFX in parallel — that's the authentic
|
|
16
|
+
* 128K pattern (Robocop, R-Type, Chase H.Q.…)
|
|
17
|
+
*
|
|
18
|
+
* @see {@link createAY} and {@link playAY} for multi-channel music in `ay.ts`
|
|
19
|
+
*/
|
|
1
20
|
let ctx = null;
|
|
2
21
|
let masterGain = null;
|
|
3
22
|
const VOLUME_STEP = 0.1;
|
|
@@ -131,10 +150,16 @@ export function playPattern(notes, startDelay = 0) {
|
|
|
131
150
|
}
|
|
132
151
|
}
|
|
133
152
|
/**
|
|
134
|
-
* Schedules a single square-wave beep on the shared `AudioContext
|
|
135
|
-
*
|
|
153
|
+
* Schedules a single square-wave beep on the shared `AudioContext` — the
|
|
154
|
+
* canonical Spectrum **sound effect**: short, monophonic, era-correct.
|
|
155
|
+
*
|
|
156
|
+
* Uses a 5 ms linear ramp attack and release to avoid click artefacts.
|
|
136
157
|
* Routed through the master gain node.
|
|
137
|
-
*
|
|
158
|
+
*
|
|
159
|
+
* **When to reach for `beep`:** SFX (shots, jumps, hits, pickup blips).
|
|
160
|
+
* **For sequences,** use `playPattern`. **For multi-voice music,** use
|
|
161
|
+
* `playAY` from `ay.js` — the two modules are designed to run in parallel
|
|
162
|
+
* (AY music + beeper SFX = the authentic 128K Spectrum sound).
|
|
138
163
|
*
|
|
139
164
|
* @param freq - Frequency in Hz
|
|
140
165
|
* @param durationMs - Duration in milliseconds
|
package/dist/audio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio.js","sourceRoot":"","sources":["../src/audio.ts"],"names":[],"mappings":"AAAA,IAAI,GAAG,GAAwB,IAAI,CAAA;AACnC,IAAI,UAAU,GAAoB,IAAI,CAAA;AAEtC,MAAM,WAAW,GAAG,GAAG,CAAA;AAEvB,SAAS,WAAW,CAAC,CAAS;IAC5B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACpC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,MAAM,GAAG,GAAG;IACpC,IAAI,GAAG;QAAE,OAAM;IACf,GAAG,GAAG,IAAI,YAAY,EAAE,CAAA;IACxB,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAA;IAC7B,UAAU,CAAC,IAAI,CAAC,KAA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UAAU,EAAE,CAAA;IAC7B,GAAG,CAAC,IAAI,GAAG,QAAQ,CAAA;IACnB,GAAG,CAAC,SAAS,CAAC,KAAK,GAAG,IAAI,CAAA;IAC1B,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,SAAS,CAAC,CAAA;IACtC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,GAAG,EAAE,SAAS,GAAG,KAAK,CAAC,CAAA;IACzD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,UAAU,GAAG,IAAI,GAAG,KAAK,CAAC,CAAA;IACpE,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC,CAAA;IACnE,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACxB,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACpB,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC,CAAA;AAChD,CAAC"}
|
package/dist/ay.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ay
|
|
3
|
+
*
|
|
4
|
+
* **AY-3-8912 chip emulator** — three independent square-wave channels, shared
|
|
5
|
+
* LFSR noise generator, 16-shape hardware envelope generator. This is the chip
|
|
6
|
+
* built into the ZX Spectrum 128K / +2 / +3 (and sold as the *Melodik* add-on
|
|
7
|
+
* for the 48K) — the source of every 3-voice tune you remember from Robocop,
|
|
8
|
+
* R-Type, Chase H.Q. and a thousand other 128K games.
|
|
9
|
+
*
|
|
10
|
+
* Use this module for **music** — title screens, in-game soundtracks,
|
|
11
|
+
* multi-voice jingles, chord-based fanfares. For **sound effects** (single
|
|
12
|
+
* blips, jumps, shots), pair this with the companion {@link "audio" | audio.ts}
|
|
13
|
+
* module (the 1-bit beeper). That's the authentic 128K pattern: AY hums the
|
|
14
|
+
* orchestral score, beeper still goes *pew pew*.
|
|
15
|
+
*
|
|
16
|
+
* Both modules share the same `AudioContext` and master `GainNode`:
|
|
17
|
+
*
|
|
18
|
+
* - `setMasterVolume()` (from audio.ts) controls AY and beeper together
|
|
19
|
+
* - `initAudio()` initialises both — call once inside a user gesture
|
|
20
|
+
* - Run AY music and beeper SFX in parallel without bus conflicts
|
|
21
|
+
*
|
|
22
|
+
* Accuracy notes: this is a *good approximation*, not a sample-accurate
|
|
23
|
+
* AY emulator. Hardware-accurate logarithmic amplitudes (16 levels, ≈ √2
|
|
24
|
+
* ratio) and all 16 envelope shapes are correct. Web Audio's `OscillatorNode`
|
|
25
|
+
* is band-limited (no aliasing artefacts), so the sound is slightly cleaner
|
|
26
|
+
* than the real chip's raw squares. A sample-accurate AudioWorklet backend
|
|
27
|
+
* is on the roadmap.
|
|
28
|
+
*
|
|
29
|
+
* @see {@link beep} and {@link playPattern} for single-voice SFX in `audio.ts`
|
|
30
|
+
*/
|
|
1
31
|
/** ZX Spectrum 128K / Melodik AY-3-8912 master clock. */
|
|
2
32
|
export declare const AY_CLOCK = 1773400;
|
|
3
33
|
/**
|
|
@@ -68,12 +98,21 @@ export declare const AY_ENVELOPE_SHAPES: readonly ["\\_ ", "\\_ ", "\\_ ", "\\_
|
|
|
68
98
|
*/
|
|
69
99
|
export declare function createAY(): AYChip;
|
|
70
100
|
/**
|
|
71
|
-
* Pre-schedules up to three independent AY note arrays on the shared
|
|
72
|
-
*
|
|
73
|
-
*
|
|
101
|
+
* Pre-schedules up to three independent AY note arrays on the shared
|
|
102
|
+
* `AudioContext` — the canonical Spectrum 128K **music** primitive:
|
|
103
|
+
* 3-voice harmony, envelope shaping, noise mixing, all in one call.
|
|
104
|
+
*
|
|
105
|
+
* All channels start at the same wall-clock time; shorter channels finish
|
|
106
|
+
* earlier. Fire-and-forget — no handle returned.
|
|
74
107
|
*
|
|
75
108
|
* Each `AYNote` may optionally mix in LFSR noise and/or apply an envelope shape.
|
|
76
109
|
*
|
|
110
|
+
* **When to reach for `playAY`:** title screen music, level themes,
|
|
111
|
+
* game-over fanfares, multi-voice jingles. **For sound effects** (single
|
|
112
|
+
* blips, jumps, hits), use `beep` from `audio.js` in parallel — the two
|
|
113
|
+
* modules share the master gain and were designed to run together
|
|
114
|
+
* (the authentic 128K pattern: AY music + beeper SFX).
|
|
115
|
+
*
|
|
77
116
|
* @example
|
|
78
117
|
* playAY({
|
|
79
118
|
* a: [{ freq: 440, dur: 300 }, { freq: 523, dur: 300, envShape: 12, envCycleDurMs: 150 }],
|
package/dist/ay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ay.d.ts","sourceRoot":"","sources":["../src/ay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ay.d.ts","sourceRoot":"","sources":["../src/ay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAMH,yDAAyD;AACzD,eAAO,MAAM,QAAQ,UAAY,CAAA;AAEjC;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,MAAM,EAGnC,CAAA;AAWD,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAEvC,2CAA2C;AAC3C,MAAM,WAAW,MAAM;IACrB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wDAAwD;IACxD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uFAAuF;IACvF,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,yDAAyD;AACzD,MAAM,WAAW,MAAM;IACrB,kFAAkF;IAClF,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrD,kFAAkF;IAClF,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjD,kCAAkC;IAClC,YAAY,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAAA;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IAChE,yCAAyC;IACzC,IAAI,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAAA;IACzB,mCAAmC;IACnC,OAAO,IAAI,IAAI,CAAA;IACf,kEAAkE;IAClE,IAAI,IAAI,IAAI,CAAA;CACb;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,mIAWrB,CAAA;AAwFV;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,QAAQ,IAAI,MAAM,CA6GjC;AAID;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,MAAM,CACpB,OAAO,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EACrD,UAAU,SAAI,GACb,IAAI,CA+EN"}
|
package/dist/ay.js
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ay
|
|
3
|
+
*
|
|
4
|
+
* **AY-3-8912 chip emulator** — three independent square-wave channels, shared
|
|
5
|
+
* LFSR noise generator, 16-shape hardware envelope generator. This is the chip
|
|
6
|
+
* built into the ZX Spectrum 128K / +2 / +3 (and sold as the *Melodik* add-on
|
|
7
|
+
* for the 48K) — the source of every 3-voice tune you remember from Robocop,
|
|
8
|
+
* R-Type, Chase H.Q. and a thousand other 128K games.
|
|
9
|
+
*
|
|
10
|
+
* Use this module for **music** — title screens, in-game soundtracks,
|
|
11
|
+
* multi-voice jingles, chord-based fanfares. For **sound effects** (single
|
|
12
|
+
* blips, jumps, shots), pair this with the companion {@link "audio" | audio.ts}
|
|
13
|
+
* module (the 1-bit beeper). That's the authentic 128K pattern: AY hums the
|
|
14
|
+
* orchestral score, beeper still goes *pew pew*.
|
|
15
|
+
*
|
|
16
|
+
* Both modules share the same `AudioContext` and master `GainNode`:
|
|
17
|
+
*
|
|
18
|
+
* - `setMasterVolume()` (from audio.ts) controls AY and beeper together
|
|
19
|
+
* - `initAudio()` initialises both — call once inside a user gesture
|
|
20
|
+
* - Run AY music and beeper SFX in parallel without bus conflicts
|
|
21
|
+
*
|
|
22
|
+
* Accuracy notes: this is a *good approximation*, not a sample-accurate
|
|
23
|
+
* AY emulator. Hardware-accurate logarithmic amplitudes (16 levels, ≈ √2
|
|
24
|
+
* ratio) and all 16 envelope shapes are correct. Web Audio's `OscillatorNode`
|
|
25
|
+
* is band-limited (no aliasing artefacts), so the sound is slightly cleaner
|
|
26
|
+
* than the real chip's raw squares. A sample-accurate AudioWorklet backend
|
|
27
|
+
* is on the roadmap.
|
|
28
|
+
*
|
|
29
|
+
* @see {@link beep} and {@link playPattern} for single-voice SFX in `audio.ts`
|
|
30
|
+
*/
|
|
1
31
|
import { initAudio, getMasterGain } from './audio.js';
|
|
2
32
|
// ─── Hardware constants ────────────────────────────────────────────────────────
|
|
3
33
|
/** ZX Spectrum 128K / Melodik AY-3-8912 master clock. */
|
|
@@ -210,12 +240,21 @@ export function createAY() {
|
|
|
210
240
|
}
|
|
211
241
|
// ─── Sequencer ────────────────────────────────────────────────────────────────
|
|
212
242
|
/**
|
|
213
|
-
* Pre-schedules up to three independent AY note arrays on the shared
|
|
214
|
-
*
|
|
215
|
-
*
|
|
243
|
+
* Pre-schedules up to three independent AY note arrays on the shared
|
|
244
|
+
* `AudioContext` — the canonical Spectrum 128K **music** primitive:
|
|
245
|
+
* 3-voice harmony, envelope shaping, noise mixing, all in one call.
|
|
246
|
+
*
|
|
247
|
+
* All channels start at the same wall-clock time; shorter channels finish
|
|
248
|
+
* earlier. Fire-and-forget — no handle returned.
|
|
216
249
|
*
|
|
217
250
|
* Each `AYNote` may optionally mix in LFSR noise and/or apply an envelope shape.
|
|
218
251
|
*
|
|
252
|
+
* **When to reach for `playAY`:** title screen music, level themes,
|
|
253
|
+
* game-over fanfares, multi-voice jingles. **For sound effects** (single
|
|
254
|
+
* blips, jumps, hits), use `beep` from `audio.js` in parallel — the two
|
|
255
|
+
* modules share the master gain and were designed to run together
|
|
256
|
+
* (the authentic 128K pattern: AY music + beeper SFX).
|
|
257
|
+
*
|
|
219
258
|
* @example
|
|
220
259
|
* playAY({
|
|
221
260
|
* a: [{ freq: 440, dur: 300 }, { freq: 523, dur: 300, envShape: 12, envCycleDurMs: 150 }],
|
package/dist/ay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ay.js","sourceRoot":"","sources":["../src/ay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAErD,kFAAkF;AAElF,yDAAyD;AACzD,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAA;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAsB;IACvC,CAAC,EAAO,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;CAC5D,CAAA;AAED,qEAAqE;AACrE,MAAM,OAAO,GAAG,IAAI,CAAA;AAEpB,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,MAA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BAAM,CAAC;oBACN,MAAM,GAAG,GAAG,KAAK,CAAA;oBACjB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC,CAAA;oBACxC,MAAM,EAAE,GAAI,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;oBAC5B,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;oBACnC,SAAS,CAAC,IAAI,CAAC,uBAAuB,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAA;oBACnD,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC,CAAA;oBACjD,SAAS,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;gBACrD,CAAC;gBAED,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;gBAC7B,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;gBAC9B,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;gBACzB,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBACjB,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAA;YAChC,CAAC;YAED,CAAC,IAAI,IAAI,CAAA;QACX,CAAC;IACH,CAAC,CAAA;IAED,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC1B,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC1B,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAC5B,CAAC"}
|
package/dist/ui.d.ts
CHANGED
|
@@ -153,6 +153,265 @@ export declare function drawPanelTitle(ctx: CanvasRenderingContext2D, options: {
|
|
|
153
153
|
/** Width used for centering (game pixels). Required when `centered: true`. */
|
|
154
154
|
width?: number;
|
|
155
155
|
}): void;
|
|
156
|
+
/**
|
|
157
|
+
* Options for {@link drawDottedGrid}.
|
|
158
|
+
*/
|
|
159
|
+
export type DrawDottedGridOptions = {
|
|
160
|
+
/** Left edge in game pixels. */
|
|
161
|
+
x: number;
|
|
162
|
+
/** Top edge in game pixels. */
|
|
163
|
+
y: number;
|
|
164
|
+
/** Total width covered by the dot field, in pixels. */
|
|
165
|
+
width: number;
|
|
166
|
+
/** Total height covered by the dot field, in pixels. */
|
|
167
|
+
height: number;
|
|
168
|
+
/** Distance between adjacent dot centres in pixels. Common values: 2, 4, 8. */
|
|
169
|
+
spacing: number;
|
|
170
|
+
/** Dot colour. */
|
|
171
|
+
color: SpectrumColor;
|
|
172
|
+
/** Optional background fill behind the dots. Omit for transparent. */
|
|
173
|
+
paper?: SpectrumColor;
|
|
174
|
+
/** Dot size in pixels (default `1`). Use `2` for chunkier dots. */
|
|
175
|
+
dotSize?: number;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Draws a regularly-spaced dot pattern covering a rectangular area.
|
|
179
|
+
*
|
|
180
|
+
* Useful for: radar / sonar screens, tactical scanner overlays, debug grids,
|
|
181
|
+
* stippled backgrounds, "dotted line" decorative elements, alien-invasion
|
|
182
|
+
* style detection grids.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* // Sonar background (submarine)
|
|
186
|
+
* drawDottedGrid(ctx, {
|
|
187
|
+
* x: 8, y: 8, width: 64, height: 48,
|
|
188
|
+
* spacing: 4, color: C.GREEN, paper: C.BLACK,
|
|
189
|
+
* })
|
|
190
|
+
*
|
|
191
|
+
* // Tactical overlay
|
|
192
|
+
* drawDottedGrid(ctx, { x: 0, y: 0, width: 256, height: 192, spacing: 8, color: C.B_WHITE })
|
|
193
|
+
*/
|
|
194
|
+
export declare function drawDottedGrid(ctx: CanvasRenderingContext2D, options: DrawDottedGridOptions): void;
|
|
195
|
+
/**
|
|
196
|
+
* Options for {@link drawSegmentedBar}.
|
|
197
|
+
*
|
|
198
|
+
* Choose ONE colouring strategy:
|
|
199
|
+
* - **Single colour:** set `color` — every filled segment uses it (e.g. Robocop health bar).
|
|
200
|
+
* - **Threshold gradient:** set `colors` as `[lowColor, midColor, highColor]` — the
|
|
201
|
+
* widget picks one of the three based on `value / max`: `< 1/3 → lowColor`,
|
|
202
|
+
* `< 2/3 → midColor`, `else → highColor` (e.g. oxygen status: red → yellow → green).
|
|
203
|
+
*/
|
|
204
|
+
export type DrawSegmentedBarOptions = {
|
|
205
|
+
/** Left edge in game pixels. */
|
|
206
|
+
x: number;
|
|
207
|
+
/** Top edge in game pixels. */
|
|
208
|
+
y: number;
|
|
209
|
+
/** Total number of segments rendered (filled + empty). */
|
|
210
|
+
segments: number;
|
|
211
|
+
/** Current value mapped to the bar. */
|
|
212
|
+
value: number;
|
|
213
|
+
/** Maximum value (the bar is full when `value >= max`). */
|
|
214
|
+
max: number;
|
|
215
|
+
/** Width of each segment in pixels. Default `8` (one `CELL`). */
|
|
216
|
+
segmentWidth?: number;
|
|
217
|
+
/** Height of each segment in pixels. Default `8` (one `CELL`). */
|
|
218
|
+
segmentHeight?: number;
|
|
219
|
+
/** Gap between adjacent segments in pixels. Default `1`. */
|
|
220
|
+
gap?: number;
|
|
221
|
+
/** Single fill colour for every filled segment. Mutually exclusive with `colors`. */
|
|
222
|
+
color?: SpectrumColor;
|
|
223
|
+
/** Three-stop threshold gradient `[low, mid, high]`. Mutually exclusive with `color`. */
|
|
224
|
+
colors?: [SpectrumColor, SpectrumColor, SpectrumColor];
|
|
225
|
+
/** Background colour for empty segments. Omit for transparent. */
|
|
226
|
+
paper?: SpectrumColor;
|
|
227
|
+
/** Bar orientation. Default `'horizontal'`. */
|
|
228
|
+
orientation?: 'horizontal' | 'vertical';
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Draws a discrete segmented bar — health, ammo, shield, fuel, stamina, mana,
|
|
232
|
+
* battery, damage indicators. The bar shows `round(value/max * segments)` filled
|
|
233
|
+
* segments out of `segments` total.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* // Robocop-style health (single colour):
|
|
237
|
+
* drawSegmentedBar(ctx, {
|
|
238
|
+
* x: 0, y: 0, segments: 10, value: 7, max: 10, color: C.B_GREEN,
|
|
239
|
+
* })
|
|
240
|
+
*
|
|
241
|
+
* // Oxygen with threshold gradient (red → yellow → green):
|
|
242
|
+
* drawSegmentedBar(ctx, {
|
|
243
|
+
* x: 0, y: 0, segments: 10, value: 8, max: 10,
|
|
244
|
+
* colors: [C.B_RED, C.B_YELLOW, C.B_GREEN],
|
|
245
|
+
* paper: C.BLACK,
|
|
246
|
+
* })
|
|
247
|
+
*
|
|
248
|
+
* // Vertical bar (e.g. oxygen indicator next to ballast tanks):
|
|
249
|
+
* drawSegmentedBar(ctx, {
|
|
250
|
+
* x: 0, y: 0, segments: 8, value: 5, max: 8,
|
|
251
|
+
* orientation: 'vertical', color: C.B_GREEN,
|
|
252
|
+
* })
|
|
253
|
+
*/
|
|
254
|
+
export declare function drawSegmentedBar(ctx: CanvasRenderingContext2D, options: DrawSegmentedBarOptions): void;
|
|
255
|
+
/**
|
|
256
|
+
* Options for {@link drawTank}.
|
|
257
|
+
*/
|
|
258
|
+
export type DrawTankOptions = {
|
|
259
|
+
/** Left edge in game pixels. */
|
|
260
|
+
x: number;
|
|
261
|
+
/** Top edge in game pixels. */
|
|
262
|
+
y: number;
|
|
263
|
+
/** Container width in pixels. */
|
|
264
|
+
width: number;
|
|
265
|
+
/** Container height in pixels. */
|
|
266
|
+
height: number;
|
|
267
|
+
/** Fill level `0..1`. Out-of-range values are clamped. */
|
|
268
|
+
fillPct: number;
|
|
269
|
+
/** Container outline shape. `'pill'` = rounded ends (submarine-style),
|
|
270
|
+
* `'rect'` = sharp corners. Default `'pill'`. */
|
|
271
|
+
shape?: 'pill' | 'rect';
|
|
272
|
+
/** Fluid colour. */
|
|
273
|
+
liquidColor: SpectrumColor;
|
|
274
|
+
/** Container outline colour. Defaults to `liquidColor`. */
|
|
275
|
+
containerColor?: SpectrumColor;
|
|
276
|
+
/** Background colour for the empty portion. Defaults to `C.BLACK`.
|
|
277
|
+
* Set explicitly to a different palette colour, or use `'transparent'` to
|
|
278
|
+
* leave the empty area un-painted (so the underlying frame shows through). */
|
|
279
|
+
emptyColor?: SpectrumColor | 'transparent';
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Draws a fluid container — ballast tanks, fuel gauges, water reservoirs,
|
|
283
|
+
* lava levels, oil drums, chemical canisters. Liquid fills from the bottom up.
|
|
284
|
+
*
|
|
285
|
+
* **Shape `'pill'`** renders rounded semicircular caps at top and bottom for a
|
|
286
|
+
* sci-fi / submarine look. **Shape `'rect'`** uses sharp corners — simpler and
|
|
287
|
+
* more industrial. Both share the same fill semantics.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* // Submarine ballast tank (pill, cyan fluid)
|
|
291
|
+
* drawTank(ctx, {
|
|
292
|
+
* x: 8, y: 16, width: 16, height: 48,
|
|
293
|
+
* fillPct: 0.66,
|
|
294
|
+
* shape: 'pill',
|
|
295
|
+
* liquidColor: C.B_CYAN,
|
|
296
|
+
* containerColor: C.WHITE,
|
|
297
|
+
* emptyColor: C.BLACK,
|
|
298
|
+
* })
|
|
299
|
+
*
|
|
300
|
+
* // Generic fuel gauge (rect, yellow fluid)
|
|
301
|
+
* drawTank(ctx, {
|
|
302
|
+
* x: 200, y: 8, width: 24, height: 32,
|
|
303
|
+
* fillPct: 0.4, shape: 'rect',
|
|
304
|
+
* liquidColor: C.B_YELLOW, containerColor: C.WHITE, emptyColor: C.BLACK,
|
|
305
|
+
* })
|
|
306
|
+
*/
|
|
307
|
+
export declare function drawTank(ctx: CanvasRenderingContext2D, options: DrawTankOptions): void;
|
|
308
|
+
/**
|
|
309
|
+
* Options for {@link drawDial}.
|
|
310
|
+
*/
|
|
311
|
+
export type DrawDialOptions = {
|
|
312
|
+
/** Centre x in game pixels. */
|
|
313
|
+
cx: number;
|
|
314
|
+
/** Centre y in game pixels. */
|
|
315
|
+
cy: number;
|
|
316
|
+
/** Dial radius in pixels. */
|
|
317
|
+
radius: number;
|
|
318
|
+
/** Current value mapped to the needle angle. */
|
|
319
|
+
value: number;
|
|
320
|
+
/** Minimum value. Default `0`. */
|
|
321
|
+
min?: number;
|
|
322
|
+
/** Maximum value. Default `100`. */
|
|
323
|
+
max?: number;
|
|
324
|
+
/** Needle start angle in radians (corresponds to `min`). Default `3π/4`
|
|
325
|
+
* (bottom-left at 7–8 o'clock). Canvas convention: `0` = right, `π/2` = down,
|
|
326
|
+
* `π` = left, `3π/2` = up — angles increase **clockwise** on screen because
|
|
327
|
+
* the y-axis points down. */
|
|
328
|
+
startAngle?: number;
|
|
329
|
+
/** Needle end angle in radians (corresponds to `max`). Default `9π/4`
|
|
330
|
+
* (bottom-right at 4–5 o'clock, after sweeping clockwise through the top).
|
|
331
|
+
* Note the value is greater than `2π` so linear interpolation from `startAngle`
|
|
332
|
+
* traverses the top of the dial rather than the short path through the bottom. */
|
|
333
|
+
endAngle?: number;
|
|
334
|
+
/** Needle colour. */
|
|
335
|
+
needleColor: SpectrumColor;
|
|
336
|
+
/** Optional dial face fill (filled circle). */
|
|
337
|
+
faceColor?: SpectrumColor;
|
|
338
|
+
/** Optional dial rim outline colour (circle outline). */
|
|
339
|
+
rimColor?: SpectrumColor;
|
|
340
|
+
/** Optional tick mark colour. Requires `ticks` to actually draw any. */
|
|
341
|
+
tickColor?: SpectrumColor;
|
|
342
|
+
/** Number of evenly-spaced tick marks between startAngle and endAngle.
|
|
343
|
+
* Default `0` (no ticks). Tick marks are short radial lines at the rim. */
|
|
344
|
+
ticks?: number;
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* Draws a circular analog gauge with a movable needle — RPM, speedometer,
|
|
348
|
+
* fuel level, temperature, volume knob, anything that maps a scalar to an angle.
|
|
349
|
+
*
|
|
350
|
+
* Optional decorations: filled face background, circular rim outline, evenly
|
|
351
|
+
* spaced tick marks. None of these are required; the needle alone is the
|
|
352
|
+
* minimum visible output.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* // Submarine motor RPM gauge (range 0-3000)
|
|
356
|
+
* drawDial(ctx, {
|
|
357
|
+
* cx: 128, cy: 100, radius: 24,
|
|
358
|
+
* value: 1500, min: 0, max: 3000,
|
|
359
|
+
* needleColor: C.B_RED,
|
|
360
|
+
* rimColor: C.WHITE,
|
|
361
|
+
* tickColor: C.WHITE,
|
|
362
|
+
* ticks: 7,
|
|
363
|
+
* })
|
|
364
|
+
*
|
|
365
|
+
* // Bare minimum: just the needle
|
|
366
|
+
* drawDial(ctx, { cx: 50, cy: 50, radius: 10, value: 75, needleColor: C.B_GREEN })
|
|
367
|
+
*/
|
|
368
|
+
export declare function drawDial(ctx: CanvasRenderingContext2D, options: DrawDialOptions): void;
|
|
369
|
+
/**
|
|
370
|
+
* Options for {@link drawCompassText}.
|
|
371
|
+
*/
|
|
372
|
+
export type DrawCompassTextOptions = {
|
|
373
|
+
/** Left edge in game pixels (text baseline starts here). */
|
|
374
|
+
x: number;
|
|
375
|
+
/** Top edge in game pixels. */
|
|
376
|
+
y: number;
|
|
377
|
+
/** Heading in degrees `0..360`. `0`/`360` = North, `90` = East, `180` = South, `270` = West. */
|
|
378
|
+
heading: number;
|
|
379
|
+
/** Colour for non-current direction labels. */
|
|
380
|
+
color: SpectrumColor;
|
|
381
|
+
/** Colour for the current direction label. Defaults to `color` (no highlight). */
|
|
382
|
+
highlightColor?: SpectrumColor;
|
|
383
|
+
/** Optional background colour behind each label. */
|
|
384
|
+
paper?: SpectrumColor;
|
|
385
|
+
/** Wrap the two directions immediately adjacent to the centre in square
|
|
386
|
+
* brackets `[NW] [NE]` — the classic tactical-display look from 80s sub
|
|
387
|
+
* and space sims. The outer (±2) directions and the centre are never bracketed.
|
|
388
|
+
* Default `true`. */
|
|
389
|
+
brackets?: boolean;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Draws a text-based compass heading indicator — the classic 80s tactical
|
|
393
|
+
* display `[W [NW] N [NE] E]` style with the current direction in the centre,
|
|
394
|
+
* highlighted, and the two neighbouring directions on each side.
|
|
395
|
+
*
|
|
396
|
+
* Useful for: submarine HUD, space sim navigation, rally / driving game
|
|
397
|
+
* heading, any first-person game that needs a cheap-to-render compass.
|
|
398
|
+
*
|
|
399
|
+
* The heading is rounded to the nearest 45° step and then five labels are
|
|
400
|
+
* shown — the centre direction plus two on each side, wrapping around as
|
|
401
|
+
* needed (heading `0` → `W [NW] N [NE] E`, heading `90` → `N [NE] E [SE] S`).
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* drawCompassText(ctx, {
|
|
405
|
+
* x: 0, y: 168,
|
|
406
|
+
* heading: 0, // N
|
|
407
|
+
* color: C.WHITE,
|
|
408
|
+
* highlightColor: C.B_YELLOW,
|
|
409
|
+
* paper: C.BLACK,
|
|
410
|
+
* })
|
|
411
|
+
* // Renders: `W [NW] N [NE] E` — centre "N" in bright yellow, ±1 in brackets,
|
|
412
|
+
* // outer ±2 ("W", "E") plain.
|
|
413
|
+
*/
|
|
414
|
+
export declare function drawCompassText(ctx: CanvasRenderingContext2D, options: DrawCompassTextOptions): void;
|
|
156
415
|
/**
|
|
157
416
|
* Draws a ZX-style progress / value bar and registers it for managed redraws.
|
|
158
417
|
*
|
package/dist/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAKjD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;IAErB;;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;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,wBAAwB,EAC7B,OAAO,EAAE,eAAe,GACvB,IAAI,CA2CN;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,4DAA4D;IAC5D,CAAC,EAAE,MAAM,CAAA;IACT,+BAA+B;IAC/B,CAAC,EAAE,MAAM,CAAA;IACT,gGAAgG;IAChG,OAAO,EAAE,MAAM,CAAA;IACf,+CAA+C;IAC/C,KAAK,EAAE,aAAa,CAAA;IACpB,kFAAkF;IAClF,cAAc,CAAC,EAAE,aAAa,CAAA;IAC9B,oDAAoD;IACpD,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB;;;yBAGqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,wBAAwB,EAC7B,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CAgCN;AAwED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,eAAe,CAC7B,GAAG,EAAE,wBAAwB,EAC7B,OAAO,EAAE,sBAAsB,GAC9B,IAAI,CASN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAMzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,wBAAwB,GAAG,IAAI,CAI5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAE9B"}
|
package/dist/ui.js
CHANGED
|
@@ -108,6 +108,363 @@ export function drawPanelTitle(ctx, options) {
|
|
|
108
108
|
: x + padding;
|
|
109
109
|
drawText(ctx, text, tx, y + padding, ink, paper);
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Draws a regularly-spaced dot pattern covering a rectangular area.
|
|
113
|
+
*
|
|
114
|
+
* Useful for: radar / sonar screens, tactical scanner overlays, debug grids,
|
|
115
|
+
* stippled backgrounds, "dotted line" decorative elements, alien-invasion
|
|
116
|
+
* style detection grids.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* // Sonar background (submarine)
|
|
120
|
+
* drawDottedGrid(ctx, {
|
|
121
|
+
* x: 8, y: 8, width: 64, height: 48,
|
|
122
|
+
* spacing: 4, color: C.GREEN, paper: C.BLACK,
|
|
123
|
+
* })
|
|
124
|
+
*
|
|
125
|
+
* // Tactical overlay
|
|
126
|
+
* drawDottedGrid(ctx, { x: 0, y: 0, width: 256, height: 192, spacing: 8, color: C.B_WHITE })
|
|
127
|
+
*/
|
|
128
|
+
export function drawDottedGrid(ctx, options) {
|
|
129
|
+
const { x, y, width, height, spacing, color, paper, dotSize = 1 } = options;
|
|
130
|
+
if (paper !== undefined) {
|
|
131
|
+
ctx.fillStyle = paper;
|
|
132
|
+
ctx.fillRect(x, y, width, height);
|
|
133
|
+
}
|
|
134
|
+
ctx.fillStyle = color;
|
|
135
|
+
for (let dy = 0; dy < height; dy += spacing) {
|
|
136
|
+
for (let dx = 0; dx < width; dx += spacing) {
|
|
137
|
+
ctx.fillRect(x + dx, y + dy, dotSize, dotSize);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Draws a discrete segmented bar — health, ammo, shield, fuel, stamina, mana,
|
|
143
|
+
* battery, damage indicators. The bar shows `round(value/max * segments)` filled
|
|
144
|
+
* segments out of `segments` total.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* // Robocop-style health (single colour):
|
|
148
|
+
* drawSegmentedBar(ctx, {
|
|
149
|
+
* x: 0, y: 0, segments: 10, value: 7, max: 10, color: C.B_GREEN,
|
|
150
|
+
* })
|
|
151
|
+
*
|
|
152
|
+
* // Oxygen with threshold gradient (red → yellow → green):
|
|
153
|
+
* drawSegmentedBar(ctx, {
|
|
154
|
+
* x: 0, y: 0, segments: 10, value: 8, max: 10,
|
|
155
|
+
* colors: [C.B_RED, C.B_YELLOW, C.B_GREEN],
|
|
156
|
+
* paper: C.BLACK,
|
|
157
|
+
* })
|
|
158
|
+
*
|
|
159
|
+
* // Vertical bar (e.g. oxygen indicator next to ballast tanks):
|
|
160
|
+
* drawSegmentedBar(ctx, {
|
|
161
|
+
* x: 0, y: 0, segments: 8, value: 5, max: 8,
|
|
162
|
+
* orientation: 'vertical', color: C.B_GREEN,
|
|
163
|
+
* })
|
|
164
|
+
*/
|
|
165
|
+
export function drawSegmentedBar(ctx, options) {
|
|
166
|
+
const { x, y, segments, value, max, segmentWidth = CELL, segmentHeight = CELL, gap = 1, color, colors, paper, orientation = 'horizontal', } = options;
|
|
167
|
+
if ((color === undefined) === (colors === undefined)) {
|
|
168
|
+
throw new Error('drawSegmentedBar: provide exactly one of `color` or `colors`');
|
|
169
|
+
}
|
|
170
|
+
const clamped = Math.max(0, Math.min(max, value));
|
|
171
|
+
const ratio = max === 0 ? 0 : clamped / max;
|
|
172
|
+
const filled = Math.round(ratio * segments);
|
|
173
|
+
let fillColor;
|
|
174
|
+
if (color !== undefined) {
|
|
175
|
+
fillColor = color;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
const [lo, mid, hi] = colors;
|
|
179
|
+
fillColor = ratio < 1 / 3 ? lo : ratio < 2 / 3 ? mid : hi;
|
|
180
|
+
}
|
|
181
|
+
for (let i = 0; i < segments; i++) {
|
|
182
|
+
const filledHere = i < filled;
|
|
183
|
+
const drawColor = filledHere ? fillColor : paper;
|
|
184
|
+
if (drawColor === undefined)
|
|
185
|
+
continue;
|
|
186
|
+
const dx = orientation === 'horizontal' ? i * (segmentWidth + gap) : 0;
|
|
187
|
+
const dy = orientation === 'horizontal' ? 0 : (segments - 1 - i) * (segmentHeight + gap);
|
|
188
|
+
ctx.fillStyle = drawColor;
|
|
189
|
+
ctx.fillRect(x + dx, y + dy, segmentWidth, segmentHeight);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Draws a fluid container — ballast tanks, fuel gauges, water reservoirs,
|
|
194
|
+
* lava levels, oil drums, chemical canisters. Liquid fills from the bottom up.
|
|
195
|
+
*
|
|
196
|
+
* **Shape `'pill'`** renders rounded semicircular caps at top and bottom for a
|
|
197
|
+
* sci-fi / submarine look. **Shape `'rect'`** uses sharp corners — simpler and
|
|
198
|
+
* more industrial. Both share the same fill semantics.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* // Submarine ballast tank (pill, cyan fluid)
|
|
202
|
+
* drawTank(ctx, {
|
|
203
|
+
* x: 8, y: 16, width: 16, height: 48,
|
|
204
|
+
* fillPct: 0.66,
|
|
205
|
+
* shape: 'pill',
|
|
206
|
+
* liquidColor: C.B_CYAN,
|
|
207
|
+
* containerColor: C.WHITE,
|
|
208
|
+
* emptyColor: C.BLACK,
|
|
209
|
+
* })
|
|
210
|
+
*
|
|
211
|
+
* // Generic fuel gauge (rect, yellow fluid)
|
|
212
|
+
* drawTank(ctx, {
|
|
213
|
+
* x: 200, y: 8, width: 24, height: 32,
|
|
214
|
+
* fillPct: 0.4, shape: 'rect',
|
|
215
|
+
* liquidColor: C.B_YELLOW, containerColor: C.WHITE, emptyColor: C.BLACK,
|
|
216
|
+
* })
|
|
217
|
+
*/
|
|
218
|
+
export function drawTank(ctx, options) {
|
|
219
|
+
const { x, y, width, height, fillPct, shape = 'pill', liquidColor, containerColor = liquidColor, emptyColor = C.BLACK, } = options;
|
|
220
|
+
const pct = Math.max(0, Math.min(1, fillPct));
|
|
221
|
+
const fillHeight = Math.round(height * pct);
|
|
222
|
+
const fillTop = y + height - fillHeight;
|
|
223
|
+
// For pill shape, the cap radius is half the width capped to a sensible max.
|
|
224
|
+
const capRadius = shape === 'pill' ? Math.min(Math.floor(width / 2), Math.floor(height / 2)) : 0;
|
|
225
|
+
// ── Empty region fill ────────────────────────────────────────────────────
|
|
226
|
+
if (emptyColor !== 'transparent') {
|
|
227
|
+
ctx.fillStyle = emptyColor;
|
|
228
|
+
if (shape === 'rect') {
|
|
229
|
+
ctx.fillRect(x, y, width, height - fillHeight);
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
// Pill: fill the body (rectangle middle), and add top semicircle if
|
|
233
|
+
// empty area extends into it.
|
|
234
|
+
for (let dy = 0; dy < height - fillHeight; dy++) {
|
|
235
|
+
const py = y + dy;
|
|
236
|
+
const insetLeft = _capInset(dy, height, capRadius, width);
|
|
237
|
+
ctx.fillRect(x + insetLeft, py, width - 2 * insetLeft, 1);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// ── Liquid region fill ──────────────────────────────────────────────────
|
|
242
|
+
if (fillHeight > 0) {
|
|
243
|
+
ctx.fillStyle = liquidColor;
|
|
244
|
+
if (shape === 'rect') {
|
|
245
|
+
ctx.fillRect(x, fillTop, width, fillHeight);
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
for (let dy = 0; dy < fillHeight; dy++) {
|
|
249
|
+
const py = fillTop + dy;
|
|
250
|
+
const trueDy = (height - fillHeight) + dy; // offset within full container
|
|
251
|
+
const insetLeft = _capInset(trueDy, height, capRadius, width);
|
|
252
|
+
ctx.fillRect(x + insetLeft, py, width - 2 * insetLeft, 1);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// ── Container outline ────────────────────────────────────────────────────
|
|
257
|
+
ctx.fillStyle = containerColor;
|
|
258
|
+
if (shape === 'rect') {
|
|
259
|
+
// 4 thin lines for the rectangular outline (1 px thick)
|
|
260
|
+
ctx.fillRect(x, y, width, 1); // top
|
|
261
|
+
ctx.fillRect(x, y + height - 1, width, 1); // bottom
|
|
262
|
+
ctx.fillRect(x, y, 1, height); // left
|
|
263
|
+
ctx.fillRect(x + width - 1, y, 1, height); // right
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
// Pill outline: vertical sides + curved top/bottom via _capInset
|
|
267
|
+
for (let dy = 0; dy < height; dy++) {
|
|
268
|
+
const inset = _capInset(dy, height, capRadius, width);
|
|
269
|
+
// Left and right edge pixels of the outline at this row
|
|
270
|
+
ctx.fillRect(x + inset, y + dy, 1, 1);
|
|
271
|
+
ctx.fillRect(x + width - 1 - inset, y + dy, 1, 1);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Internal helper: for a pill shape of given dimensions and cap radius,
|
|
277
|
+
* returns how many pixels are inset from the left edge at row `dy` (0-indexed
|
|
278
|
+
* from the top). Returns 0 in the rectangular middle. The shape is symmetric,
|
|
279
|
+
* so the right edge inset equals the left edge inset.
|
|
280
|
+
*/
|
|
281
|
+
function _capInset(dy, totalHeight, capRadius, _width) {
|
|
282
|
+
if (capRadius === 0)
|
|
283
|
+
return 0;
|
|
284
|
+
// Top cap: rows 0..capRadius-1
|
|
285
|
+
if (dy < capRadius) {
|
|
286
|
+
const r = capRadius;
|
|
287
|
+
const offsetFromCenter = r - 1 - dy;
|
|
288
|
+
const horiz = Math.round(r - Math.sqrt(Math.max(0, r * r - (offsetFromCenter + 0.5) * (offsetFromCenter + 0.5))));
|
|
289
|
+
return horiz;
|
|
290
|
+
}
|
|
291
|
+
// Bottom cap: rows (totalHeight - capRadius)..totalHeight-1
|
|
292
|
+
if (dy >= totalHeight - capRadius) {
|
|
293
|
+
const r = capRadius;
|
|
294
|
+
const offsetFromCenter = dy - (totalHeight - capRadius);
|
|
295
|
+
const horiz = Math.round(r - Math.sqrt(Math.max(0, r * r - (offsetFromCenter + 0.5) * (offsetFromCenter + 0.5))));
|
|
296
|
+
return horiz;
|
|
297
|
+
}
|
|
298
|
+
return 0; // straight middle
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Draws a circular analog gauge with a movable needle — RPM, speedometer,
|
|
302
|
+
* fuel level, temperature, volume knob, anything that maps a scalar to an angle.
|
|
303
|
+
*
|
|
304
|
+
* Optional decorations: filled face background, circular rim outline, evenly
|
|
305
|
+
* spaced tick marks. None of these are required; the needle alone is the
|
|
306
|
+
* minimum visible output.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* // Submarine motor RPM gauge (range 0-3000)
|
|
310
|
+
* drawDial(ctx, {
|
|
311
|
+
* cx: 128, cy: 100, radius: 24,
|
|
312
|
+
* value: 1500, min: 0, max: 3000,
|
|
313
|
+
* needleColor: C.B_RED,
|
|
314
|
+
* rimColor: C.WHITE,
|
|
315
|
+
* tickColor: C.WHITE,
|
|
316
|
+
* ticks: 7,
|
|
317
|
+
* })
|
|
318
|
+
*
|
|
319
|
+
* // Bare minimum: just the needle
|
|
320
|
+
* drawDial(ctx, { cx: 50, cy: 50, radius: 10, value: 75, needleColor: C.B_GREEN })
|
|
321
|
+
*/
|
|
322
|
+
export function drawDial(ctx, options) {
|
|
323
|
+
const { cx, cy, radius, value, min = 0, max = 100, startAngle = 3 * Math.PI / 4, endAngle = Math.PI / 4 + 2 * Math.PI, needleColor, faceColor, rimColor, tickColor, ticks = 0, } = options;
|
|
324
|
+
// Face
|
|
325
|
+
if (faceColor !== undefined) {
|
|
326
|
+
ctx.fillStyle = faceColor;
|
|
327
|
+
_fillCircle(ctx, cx, cy, radius);
|
|
328
|
+
}
|
|
329
|
+
// Rim
|
|
330
|
+
if (rimColor !== undefined) {
|
|
331
|
+
ctx.fillStyle = rimColor;
|
|
332
|
+
_plotCircle(ctx, cx, cy, radius);
|
|
333
|
+
}
|
|
334
|
+
// Ticks
|
|
335
|
+
if (tickColor !== undefined && ticks > 0) {
|
|
336
|
+
ctx.fillStyle = tickColor;
|
|
337
|
+
const sweep = endAngle - startAngle;
|
|
338
|
+
const innerR = Math.max(0, radius - 3);
|
|
339
|
+
for (let i = 0; i < ticks; i++) {
|
|
340
|
+
const t = ticks === 1 ? 0 : i / (ticks - 1);
|
|
341
|
+
const a = startAngle + sweep * t;
|
|
342
|
+
const cosA = Math.cos(a), sinA = Math.sin(a);
|
|
343
|
+
_plotLine(ctx, cx + innerR * cosA, cy + innerR * sinA, cx + radius * cosA, cy + radius * sinA);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
// Needle
|
|
347
|
+
const clamped = Math.max(min, Math.min(max, value));
|
|
348
|
+
const t = max === min ? 0 : (clamped - min) / (max - min);
|
|
349
|
+
const angle = startAngle + (endAngle - startAngle) * t;
|
|
350
|
+
ctx.fillStyle = needleColor;
|
|
351
|
+
_plotLine(ctx, cx, cy, cx + radius * Math.cos(angle), cy + radius * Math.sin(angle));
|
|
352
|
+
}
|
|
353
|
+
const _COMPASS_DIRS = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
|
|
354
|
+
/**
|
|
355
|
+
* Draws a text-based compass heading indicator — the classic 80s tactical
|
|
356
|
+
* display `[W [NW] N [NE] E]` style with the current direction in the centre,
|
|
357
|
+
* highlighted, and the two neighbouring directions on each side.
|
|
358
|
+
*
|
|
359
|
+
* Useful for: submarine HUD, space sim navigation, rally / driving game
|
|
360
|
+
* heading, any first-person game that needs a cheap-to-render compass.
|
|
361
|
+
*
|
|
362
|
+
* The heading is rounded to the nearest 45° step and then five labels are
|
|
363
|
+
* shown — the centre direction plus two on each side, wrapping around as
|
|
364
|
+
* needed (heading `0` → `W [NW] N [NE] E`, heading `90` → `N [NE] E [SE] S`).
|
|
365
|
+
*
|
|
366
|
+
* @example
|
|
367
|
+
* drawCompassText(ctx, {
|
|
368
|
+
* x: 0, y: 168,
|
|
369
|
+
* heading: 0, // N
|
|
370
|
+
* color: C.WHITE,
|
|
371
|
+
* highlightColor: C.B_YELLOW,
|
|
372
|
+
* paper: C.BLACK,
|
|
373
|
+
* })
|
|
374
|
+
* // Renders: `W [NW] N [NE] E` — centre "N" in bright yellow, ±1 in brackets,
|
|
375
|
+
* // outer ±2 ("W", "E") plain.
|
|
376
|
+
*/
|
|
377
|
+
export function drawCompassText(ctx, options) {
|
|
378
|
+
const { x, y, heading, color, highlightColor = color, paper, brackets = true, } = options;
|
|
379
|
+
// Normalise heading into [0, 360)
|
|
380
|
+
const h = ((heading % 360) + 360) % 360;
|
|
381
|
+
// Round to nearest 45° step → index 0..7
|
|
382
|
+
const centerIdx = Math.round(h / 45) % 8;
|
|
383
|
+
// Five directions: centre and ±1, ±2 (wrapping)
|
|
384
|
+
const indices = [
|
|
385
|
+
(centerIdx + 6) % 8, // -2
|
|
386
|
+
(centerIdx + 7) % 8, // -1
|
|
387
|
+
centerIdx, // 0
|
|
388
|
+
(centerIdx + 1) % 8, // +1
|
|
389
|
+
(centerIdx + 2) % 8, // +2
|
|
390
|
+
];
|
|
391
|
+
let cursorX = x;
|
|
392
|
+
for (let i = 0; i < indices.length; i++) {
|
|
393
|
+
const label = _COMPASS_DIRS[indices[i]];
|
|
394
|
+
const isCenter = i === 2;
|
|
395
|
+
const isAdjacent = i === 1 || i === 3;
|
|
396
|
+
const shown = isAdjacent && brackets ? `[${label}]` : label;
|
|
397
|
+
const ink = isCenter ? highlightColor : color;
|
|
398
|
+
drawText(ctx, shown, cursorX, y, ink, paper);
|
|
399
|
+
cursorX += shown.length * CELL;
|
|
400
|
+
// single-cell space between tokens
|
|
401
|
+
cursorX += CELL;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
// ─── Drawing primitives (private) ────────────────────────────────────────────
|
|
405
|
+
/**
|
|
406
|
+
* Bresenham line algorithm — plots a 1-pixel-wide line from (x0,y0) to (x1,y1)
|
|
407
|
+
* using the current `ctx.fillStyle`. Coordinates are rounded to integers.
|
|
408
|
+
*/
|
|
409
|
+
function _plotLine(ctx, x0, y0, x1, y1) {
|
|
410
|
+
let ix0 = Math.round(x0), iy0 = Math.round(y0);
|
|
411
|
+
const ix1 = Math.round(x1), iy1 = Math.round(y1);
|
|
412
|
+
const dx = Math.abs(ix1 - ix0);
|
|
413
|
+
const dy = -Math.abs(iy1 - iy0);
|
|
414
|
+
const sx = ix0 < ix1 ? 1 : -1;
|
|
415
|
+
const sy = iy0 < iy1 ? 1 : -1;
|
|
416
|
+
let err = dx + dy;
|
|
417
|
+
while (true) {
|
|
418
|
+
ctx.fillRect(ix0, iy0, 1, 1);
|
|
419
|
+
if (ix0 === ix1 && iy0 === iy1)
|
|
420
|
+
break;
|
|
421
|
+
const e2 = 2 * err;
|
|
422
|
+
if (e2 >= dy) {
|
|
423
|
+
err += dy;
|
|
424
|
+
ix0 += sx;
|
|
425
|
+
}
|
|
426
|
+
if (e2 <= dx) {
|
|
427
|
+
err += dx;
|
|
428
|
+
iy0 += sy;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Midpoint circle algorithm — plots a 1-pixel-wide circle outline of radius
|
|
434
|
+
* `r` centred at (cx,cy) using the current `ctx.fillStyle`.
|
|
435
|
+
*/
|
|
436
|
+
function _plotCircle(ctx, cx, cy, r) {
|
|
437
|
+
let x = 0, y = r, d = 1 - r;
|
|
438
|
+
while (y >= x) {
|
|
439
|
+
ctx.fillRect(cx + x, cy + y, 1, 1);
|
|
440
|
+
ctx.fillRect(cx + y, cy + x, 1, 1);
|
|
441
|
+
ctx.fillRect(cx - x, cy + y, 1, 1);
|
|
442
|
+
ctx.fillRect(cx - y, cy + x, 1, 1);
|
|
443
|
+
ctx.fillRect(cx + x, cy - y, 1, 1);
|
|
444
|
+
ctx.fillRect(cx + y, cy - x, 1, 1);
|
|
445
|
+
ctx.fillRect(cx - x, cy - y, 1, 1);
|
|
446
|
+
ctx.fillRect(cx - y, cy - x, 1, 1);
|
|
447
|
+
x++;
|
|
448
|
+
if (d < 0) {
|
|
449
|
+
d += 2 * x + 1;
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
y--;
|
|
453
|
+
d += 2 * (x - y) + 1;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Fills a solid disc of radius `r` centred at (cx,cy) using the current
|
|
459
|
+
* `ctx.fillStyle`. Uses horizontal `fillRect` spans for efficiency.
|
|
460
|
+
*/
|
|
461
|
+
function _fillCircle(ctx, cx, cy, r) {
|
|
462
|
+
for (let dy = -r; dy <= r; dy++) {
|
|
463
|
+
const xMax = Math.floor(Math.sqrt(Math.max(0, r * r - dy * dy)));
|
|
464
|
+
if (xMax >= 0)
|
|
465
|
+
ctx.fillRect(cx - xMax, cy + dy, 2 * xMax + 1, 1);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
111
468
|
// ─── Public API — stateful widget ────────────────────────────────────────────
|
|
112
469
|
/**
|
|
113
470
|
* Draws a ZX-style progress / value bar and registers it for managed redraws.
|
package/dist/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAyFlD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAA;AAE1C,iFAAiF;AAEjF,SAAS,WAAW,CAClB,GAA6B,EAC7B,CAAS,EACT,CAAS,EACT,KAAa,EACb,MAAc,EACd,MAAqB,EACrB,aAA4B;IAE5B,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;QAAE,OAAM;IACpC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,aAAa,CAAA;IAC3C,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,IAAI,CAAC,CAAA;IAC/B,GAAG,CAAC,SAAS,GAAG,KAAK,CAAA;IACrB,IAAI,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA,CAAuB,MAAM;QACzD,GAAG,CAAC,QAAQ,CAAC,CA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