zx-kit 0.32.1 → 0.34.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 +46 -2762
- package/dist/audio.d.ts +42 -0
- package/dist/audio.d.ts.map +1 -1
- package/dist/audio.js +77 -0
- package/dist/audio.js.map +1 -1
- package/dist/debug.d.ts +98 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +91 -0
- package/dist/debug.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +18 -3
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +30 -3
- package/dist/input.js.map +1 -1
- package/package.json +1 -1
package/dist/audio.d.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @see {@link createAY} and {@link playAY} for multi-channel music in `ay.ts`
|
|
19
19
|
*/
|
|
20
|
+
import type { SpectrumColor } from './palette.js';
|
|
20
21
|
/**
|
|
21
22
|
* Creates the shared `AudioContext` and master `GainNode`. Idempotent — safe to call
|
|
22
23
|
* multiple times (subsequent calls are no-ops).
|
|
@@ -74,6 +75,8 @@ export declare function getMasterVolume(): number;
|
|
|
74
75
|
export declare function setMasterVolume(volume: number): void;
|
|
75
76
|
/**
|
|
76
77
|
* Increases master volume by 0.1, up to a maximum of 1.0.
|
|
78
|
+
* Also marks the moment so {@link drawVolumeBar} auto-shows the HUD bar — calling
|
|
79
|
+
* this (by key **or** programmatically) makes the bar appear for ~1.5 s.
|
|
77
80
|
*
|
|
78
81
|
* @example
|
|
79
82
|
* increaseVolume() // 0.3 → 0.4
|
|
@@ -81,11 +84,50 @@ export declare function setMasterVolume(volume: number): void;
|
|
|
81
84
|
export declare function increaseVolume(): void;
|
|
82
85
|
/**
|
|
83
86
|
* Decreases master volume by 0.1, down to a minimum of 0.0.
|
|
87
|
+
* Also marks the moment so {@link drawVolumeBar} auto-shows the HUD bar — calling
|
|
88
|
+
* this (by key **or** programmatically) makes the bar appear for ~1.5 s.
|
|
84
89
|
*
|
|
85
90
|
* @example
|
|
86
91
|
* decreaseVolume() // 0.3 → 0.2
|
|
87
92
|
*/
|
|
88
93
|
export declare function decreaseVolume(): void;
|
|
94
|
+
/** Optional overrides for {@link setVolumeBarStyle}. */
|
|
95
|
+
export interface VolumeBarStyleOptions {
|
|
96
|
+
/** Bar ink colour. Default `C.B_GREEN`. */
|
|
97
|
+
color?: SpectrumColor;
|
|
98
|
+
/** Bar width in cells (`width = segments * CELL`). Default `10`. */
|
|
99
|
+
segments?: number;
|
|
100
|
+
/** Left edge in game pixels. Omit to centre horizontally. */
|
|
101
|
+
x?: number;
|
|
102
|
+
/** Top edge in game pixels. Default `96 - CELL` (≈ mid-screen). */
|
|
103
|
+
y?: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Configures the auto-hide volume bar's appearance (config-once style). Stores
|
|
107
|
+
* style in module state only — does **not** render. Optional: the defaults
|
|
108
|
+
* (centred 10-segment green bar, mid-screen) apply if this is never called.
|
|
109
|
+
*
|
|
110
|
+
* @param opts - Style overrides; unspecified fields keep their current value.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* setVolumeBarStyle({ color: C.B_CYAN }) // recolour only
|
|
114
|
+
* setVolumeBarStyle({ segments: 16, y: 176 }) // wider, near the bottom
|
|
115
|
+
*/
|
|
116
|
+
export declare function setVolumeBarStyle(opts?: VolumeBarStyleOptions): void;
|
|
117
|
+
/**
|
|
118
|
+
* Draws the volume bar — the only render-loop call. Reads the stored style (see
|
|
119
|
+
* {@link setVolumeBarStyle}); takes no style args. Auto-show: draws nothing once
|
|
120
|
+
* more than ~1.5 s has passed since the last {@link increaseVolume} /
|
|
121
|
+
* {@link decreaseVolume}; otherwise renders the current master volume and hides
|
|
122
|
+
* itself afterwards. Call every frame.
|
|
123
|
+
*
|
|
124
|
+
* @param canvasCtx - The game canvas 2D context (scaled by `SCALE`).
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* // in the render loop:
|
|
128
|
+
* drawVolumeBar(ctx) // shows ~1.5 s after a change, then hides itself
|
|
129
|
+
*/
|
|
130
|
+
export declare function drawVolumeBar(canvasCtx: CanvasRenderingContext2D): void;
|
|
89
131
|
/** A single note in a melody pattern. Use `freq: 0` for a rest (silence). */
|
|
90
132
|
export interface Note {
|
|
91
133
|
freq: number;
|
package/dist/audio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../src/audio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../src/audio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAkBjD;;;;;;;;;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;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAGrC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAGrC;AAwBD,wDAAwD;AACxD,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6DAA6D;IAC7D,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,mEAAmE;IACnE,CAAC,CAAC,EAAE,MAAM,CAAA;CACX;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,qBAA0B,GAAG,IAAI,CAKxE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,wBAAwB,GAAG,IAAI,CAuBvE;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
|
@@ -17,9 +17,15 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @see {@link createAY} and {@link playAY} for multi-channel music in `ay.ts`
|
|
19
19
|
*/
|
|
20
|
+
import { C, CELL, SCALE } from './palette.js';
|
|
21
|
+
import { drawProgressBar } from './ui.js';
|
|
20
22
|
let ctx = null;
|
|
21
23
|
let masterGain = null;
|
|
22
24
|
const VOLUME_STEP = 0.1;
|
|
25
|
+
/** Wall-clock time (ms, `performance.now()`) of the last volume change — drives the auto-show HUD bar. */
|
|
26
|
+
let _volumeChangedAt = 0;
|
|
27
|
+
/** How long {@link drawVolumeBar} keeps the bar visible after a change (ms). */
|
|
28
|
+
const VOLUME_BAR_MS = 1500;
|
|
23
29
|
function clampVolume(v) {
|
|
24
30
|
return Math.max(0, Math.min(1, v));
|
|
25
31
|
}
|
|
@@ -100,21 +106,92 @@ export function setMasterVolume(volume) {
|
|
|
100
106
|
}
|
|
101
107
|
/**
|
|
102
108
|
* Increases master volume by 0.1, up to a maximum of 1.0.
|
|
109
|
+
* Also marks the moment so {@link drawVolumeBar} auto-shows the HUD bar — calling
|
|
110
|
+
* this (by key **or** programmatically) makes the bar appear for ~1.5 s.
|
|
103
111
|
*
|
|
104
112
|
* @example
|
|
105
113
|
* increaseVolume() // 0.3 → 0.4
|
|
106
114
|
*/
|
|
107
115
|
export function increaseVolume() {
|
|
108
116
|
setMasterVolume(getMasterVolume() + VOLUME_STEP);
|
|
117
|
+
_volumeChangedAt = performance.now();
|
|
109
118
|
}
|
|
110
119
|
/**
|
|
111
120
|
* Decreases master volume by 0.1, down to a minimum of 0.0.
|
|
121
|
+
* Also marks the moment so {@link drawVolumeBar} auto-shows the HUD bar — calling
|
|
122
|
+
* this (by key **or** programmatically) makes the bar appear for ~1.5 s.
|
|
112
123
|
*
|
|
113
124
|
* @example
|
|
114
125
|
* decreaseVolume() // 0.3 → 0.2
|
|
115
126
|
*/
|
|
116
127
|
export function decreaseVolume() {
|
|
117
128
|
setMasterVolume(getMasterVolume() - VOLUME_STEP);
|
|
129
|
+
_volumeChangedAt = performance.now();
|
|
130
|
+
}
|
|
131
|
+
const _volumeBarStyle = {
|
|
132
|
+
color: C.B_GREEN, // → drawProgressBar ink
|
|
133
|
+
segments: 10, // → width = 10 * CELL = 80 px
|
|
134
|
+
x: undefined, // centred horizontally
|
|
135
|
+
y: 96 - CELL, // roughly mid-screen
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Configures the auto-hide volume bar's appearance (config-once style). Stores
|
|
139
|
+
* style in module state only — does **not** render. Optional: the defaults
|
|
140
|
+
* (centred 10-segment green bar, mid-screen) apply if this is never called.
|
|
141
|
+
*
|
|
142
|
+
* @param opts - Style overrides; unspecified fields keep their current value.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* setVolumeBarStyle({ color: C.B_CYAN }) // recolour only
|
|
146
|
+
* setVolumeBarStyle({ segments: 16, y: 176 }) // wider, near the bottom
|
|
147
|
+
*/
|
|
148
|
+
export function setVolumeBarStyle(opts = {}) {
|
|
149
|
+
if (opts.color !== undefined)
|
|
150
|
+
_volumeBarStyle.color = opts.color;
|
|
151
|
+
if (opts.segments !== undefined)
|
|
152
|
+
_volumeBarStyle.segments = opts.segments;
|
|
153
|
+
if (opts.x !== undefined)
|
|
154
|
+
_volumeBarStyle.x = opts.x;
|
|
155
|
+
if (opts.y !== undefined)
|
|
156
|
+
_volumeBarStyle.y = opts.y;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Draws the volume bar — the only render-loop call. Reads the stored style (see
|
|
160
|
+
* {@link setVolumeBarStyle}); takes no style args. Auto-show: draws nothing once
|
|
161
|
+
* more than ~1.5 s has passed since the last {@link increaseVolume} /
|
|
162
|
+
* {@link decreaseVolume}; otherwise renders the current master volume and hides
|
|
163
|
+
* itself afterwards. Call every frame.
|
|
164
|
+
*
|
|
165
|
+
* @param canvasCtx - The game canvas 2D context (scaled by `SCALE`).
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* // in the render loop:
|
|
169
|
+
* drawVolumeBar(ctx) // shows ~1.5 s after a change, then hides itself
|
|
170
|
+
*/
|
|
171
|
+
export function drawVolumeBar(canvasCtx) {
|
|
172
|
+
if (performance.now() - _volumeChangedAt > VOLUME_BAR_MS)
|
|
173
|
+
return;
|
|
174
|
+
const { color, segments, x, y } = _volumeBarStyle;
|
|
175
|
+
const width = segments * CELL;
|
|
176
|
+
// drawProgressBar works in game-pixel space; convert the device-pixel backing
|
|
177
|
+
// store to it via the context's current horizontal scale (set by setupCanvas),
|
|
178
|
+
// so centring is correct at any scale. Falls back to SCALE if getTransform is
|
|
179
|
+
// unavailable (e.g. a bare test mock).
|
|
180
|
+
const scaleX = canvasCtx.getTransform?.().a || SCALE;
|
|
181
|
+
const screenW = canvasCtx.canvas.width / scaleX;
|
|
182
|
+
drawProgressBar(canvasCtx, {
|
|
183
|
+
id: 'zxkit:volume',
|
|
184
|
+
x: x ?? Math.round((screenW - width) / 2),
|
|
185
|
+
y,
|
|
186
|
+
width,
|
|
187
|
+
value: getMasterVolume(),
|
|
188
|
+
min: 0,
|
|
189
|
+
max: 1,
|
|
190
|
+
ink: color,
|
|
191
|
+
paper: C.BLACK,
|
|
192
|
+
border: { style: 'solid' },
|
|
193
|
+
visibilityLength: VOLUME_BAR_MS,
|
|
194
|
+
});
|
|
118
195
|
}
|
|
119
196
|
/**
|
|
120
197
|
* Schedules a sequence of notes on the shared `AudioContext`.
|
package/dist/audio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio.js","sourceRoot":"","sources":["../src/audio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,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,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IAC3C,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AACrC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW;IACzB,IAAI,GAAG,IAAI,GAAG,CAAC,K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AAI,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/debug.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { type SpectrumColor } from './palette.js';
|
|
2
|
+
/**
|
|
3
|
+
* A snapshot of debug/telemetry numbers for one frame, produced by {@link sampleDebug}.
|
|
4
|
+
*
|
|
5
|
+
* Only what a 2D-canvas browser game can honestly measure: frame pacing and JS main-thread work.
|
|
6
|
+
* There is **no VRAM or GPU figure** — neither is observable from a Canvas2D context (that would
|
|
7
|
+
* need WebGL + driver hooks the browser does not expose). `cpuLoad` is the JS update+render cost
|
|
8
|
+
* against the frame budget, not the GPU's blit time. Resolution, JS heap, draw-call counters and
|
|
9
|
+
* estimated bitmap memory are planned for later slices.
|
|
10
|
+
*/
|
|
11
|
+
export interface DebugInfo {
|
|
12
|
+
/** Smoothed frames per second (exponential moving average). */
|
|
13
|
+
fps: number;
|
|
14
|
+
/** Duration of the last frame in milliseconds (delta between consecutive `beginFrame` calls). */
|
|
15
|
+
frameMs: number;
|
|
16
|
+
/** Measured update+render time in ms (between `beginFrame` and `endFrame`); `0` if `endFrame` was not called. */
|
|
17
|
+
workMs: number;
|
|
18
|
+
/** Target per-frame budget in ms (`1000 / targetFps`, e.g. `16.67` at 60 fps). */
|
|
19
|
+
budgetMs: number;
|
|
20
|
+
/** `workMs / budgetMs` (0..1+): JS main-thread load against the budget. Above `1` means the frame overran. */
|
|
21
|
+
cpuLoad: number;
|
|
22
|
+
/** Game-supplied fields merged into the snapshot — e.g. `{ mines: 12, level: 3 }`. */
|
|
23
|
+
custom: Record<string, string | number>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Per-frame timing state. Create with {@link createDebugMonitor}, bracket each frame with
|
|
27
|
+
* {@link beginFrame} / {@link endFrame}, then read with {@link sampleDebug}.
|
|
28
|
+
* Holds no DOM references — safe to keep at module scope.
|
|
29
|
+
*/
|
|
30
|
+
export interface DebugMonitor {
|
|
31
|
+
/** Target frame rate used for `budgetMs` / `cpuLoad` (default `60`). */
|
|
32
|
+
targetFps: number;
|
|
33
|
+
/** EMA smoothing factor 0..1 applied to `fps` (default `0.1`; higher = snappier, noisier). */
|
|
34
|
+
smoothing: number;
|
|
35
|
+
/** Timestamp of the last `beginFrame`, or `null` before the first frame. */
|
|
36
|
+
lastTime: number | null;
|
|
37
|
+
/** Timestamp captured at `beginFrame`, used by `endFrame` to compute `workMs`. */
|
|
38
|
+
workStart: number;
|
|
39
|
+
/** Current smoothed fps. */
|
|
40
|
+
fps: number;
|
|
41
|
+
/** Last frame delta in ms. */
|
|
42
|
+
frameMs: number;
|
|
43
|
+
/** Last measured work time in ms. */
|
|
44
|
+
workMs: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates a frame-timing monitor.
|
|
48
|
+
*
|
|
49
|
+
* @param opts.targetFps - Frame rate the budget/load are measured against (default `60`)
|
|
50
|
+
* @param opts.smoothing - EMA factor 0..1 for the fps readout (default `0.1`)
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* const dbg = createDebugMonitor() // 60 fps budget
|
|
54
|
+
* const dbg = createDebugMonitor({ targetFps: 50 }) // PAL
|
|
55
|
+
*/
|
|
56
|
+
export declare function createDebugMonitor(opts?: {
|
|
57
|
+
targetFps?: number;
|
|
58
|
+
smoothing?: number;
|
|
59
|
+
}): DebugMonitor;
|
|
60
|
+
/**
|
|
61
|
+
* Marks the start of a frame. Updates `frameMs` (delta since the previous `beginFrame`) and the
|
|
62
|
+
* smoothed `fps`, and starts the work-time clock for {@link endFrame}.
|
|
63
|
+
* Call once at the top of your `requestAnimationFrame` loop.
|
|
64
|
+
*
|
|
65
|
+
* @param now - Timestamp in ms (default `performance.now()`); pass the rAF timestamp for accuracy.
|
|
66
|
+
*/
|
|
67
|
+
export declare function beginFrame(m: DebugMonitor, now?: number): void;
|
|
68
|
+
/**
|
|
69
|
+
* Marks the end of the frame's JS work (after update + render). Sets `workMs` to the time since
|
|
70
|
+
* {@link beginFrame}. Optional — skip it and `workMs` / `cpuLoad` stay `0`.
|
|
71
|
+
*
|
|
72
|
+
* @param now - Timestamp in ms (default `performance.now()`).
|
|
73
|
+
*/
|
|
74
|
+
export declare function endFrame(m: DebugMonitor, now?: number): void;
|
|
75
|
+
/**
|
|
76
|
+
* Reads the current numbers as a fresh {@link DebugInfo}. Merge game-specific fields via `custom`.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* const info = sampleDebug(dbg, { mines: mineCount, level })
|
|
80
|
+
*/
|
|
81
|
+
export declare function sampleDebug(m: DebugMonitor, custom?: Record<string, string | number>): DebugInfo;
|
|
82
|
+
/**
|
|
83
|
+
* Draws a small Spectrum-style debug overlay: `FPS` + frame ms, then `CPU %` (only when work time
|
|
84
|
+
* was measured), then one line per `custom` field. Lines are `CELL`-spaced down from `(x, y)`.
|
|
85
|
+
*
|
|
86
|
+
* The game owns the toggle key and placement — this is just a convenience renderer over
|
|
87
|
+
* {@link drawText}.
|
|
88
|
+
*
|
|
89
|
+
* @param x - Left edge in game pixels (default `1`)
|
|
90
|
+
* @param y - Top edge in game pixels (default `1`)
|
|
91
|
+
* @param ink - Text colour (default `C.B_YELLOW`)
|
|
92
|
+
* @param paper - Background colour for readability (default `C.BLACK`)
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* if (showDebug) drawDebugOverlay(ctx, sampleDebug(dbg, { mines }))
|
|
96
|
+
*/
|
|
97
|
+
export declare function drawDebugOverlay(ctx: CanvasRenderingContext2D, info: DebugInfo, x?: number, y?: number, ink?: SpectrumColor, paper?: SpectrumColor): void;
|
|
98
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,cAAc,CAAA;AAG1D;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAA;IACX,iGAAiG;IACjG,OAAO,EAAE,MAAM,CAAA;IACf,iHAAiH;IACjH,MAAM,EAAE,MAAM,CAAA;IACd,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAA;IAChB,8GAA8G;IAC9G,OAAO,EAAE,MAAM,CAAA;IACf,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAA;IACjB,8FAA8F;IAC9F,SAAS,EAAE,MAAM,CAAA;IACjB,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAA;IACjB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GACpD,YAAY,CAUd;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,GAAE,MAA0B,GAAG,IAAI,CASjF;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,GAAE,MAA0B,GAAG,IAAI,CAE/E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,CAAC,EAAE,YAAY,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,GAC3C,SAAS,CAUX;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,wBAAwB,EAC7B,IAAI,EAAE,SAAS,EACf,CAAC,GAAE,MAAU,EACb,CAAC,GAAE,MAAU,EACb,GAAG,GAAE,aAA0B,EAC/B,KAAK,GAAE,aAAuB,GAC7B,IAAI,CAKN"}
|
package/dist/debug.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { C, CELL } from './palette.js';
|
|
2
|
+
import { drawText } from './renderer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a frame-timing monitor.
|
|
5
|
+
*
|
|
6
|
+
* @param opts.targetFps - Frame rate the budget/load are measured against (default `60`)
|
|
7
|
+
* @param opts.smoothing - EMA factor 0..1 for the fps readout (default `0.1`)
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const dbg = createDebugMonitor() // 60 fps budget
|
|
11
|
+
* const dbg = createDebugMonitor({ targetFps: 50 }) // PAL
|
|
12
|
+
*/
|
|
13
|
+
export function createDebugMonitor(opts = {}) {
|
|
14
|
+
return {
|
|
15
|
+
targetFps: opts.targetFps ?? 60,
|
|
16
|
+
smoothing: opts.smoothing ?? 0.1,
|
|
17
|
+
lastTime: null,
|
|
18
|
+
workStart: 0,
|
|
19
|
+
fps: 0,
|
|
20
|
+
frameMs: 0,
|
|
21
|
+
workMs: 0,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Marks the start of a frame. Updates `frameMs` (delta since the previous `beginFrame`) and the
|
|
26
|
+
* smoothed `fps`, and starts the work-time clock for {@link endFrame}.
|
|
27
|
+
* Call once at the top of your `requestAnimationFrame` loop.
|
|
28
|
+
*
|
|
29
|
+
* @param now - Timestamp in ms (default `performance.now()`); pass the rAF timestamp for accuracy.
|
|
30
|
+
*/
|
|
31
|
+
export function beginFrame(m, now = performance.now()) {
|
|
32
|
+
if (m.lastTime !== null) {
|
|
33
|
+
m.frameMs = now - m.lastTime;
|
|
34
|
+
const inst = m.frameMs > 0 ? 1000 / m.frameMs : 0;
|
|
35
|
+
// First real sample primes directly; afterwards apply EMA smoothing.
|
|
36
|
+
m.fps = m.fps === 0 ? inst : m.fps + m.smoothing * (inst - m.fps);
|
|
37
|
+
}
|
|
38
|
+
m.lastTime = now;
|
|
39
|
+
m.workStart = now;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Marks the end of the frame's JS work (after update + render). Sets `workMs` to the time since
|
|
43
|
+
* {@link beginFrame}. Optional — skip it and `workMs` / `cpuLoad` stay `0`.
|
|
44
|
+
*
|
|
45
|
+
* @param now - Timestamp in ms (default `performance.now()`).
|
|
46
|
+
*/
|
|
47
|
+
export function endFrame(m, now = performance.now()) {
|
|
48
|
+
m.workMs = Math.max(0, now - m.workStart);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Reads the current numbers as a fresh {@link DebugInfo}. Merge game-specific fields via `custom`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* const info = sampleDebug(dbg, { mines: mineCount, level })
|
|
55
|
+
*/
|
|
56
|
+
export function sampleDebug(m, custom = {}) {
|
|
57
|
+
const budgetMs = m.targetFps > 0 ? 1000 / m.targetFps : 0;
|
|
58
|
+
return {
|
|
59
|
+
fps: m.fps,
|
|
60
|
+
frameMs: m.frameMs,
|
|
61
|
+
workMs: m.workMs,
|
|
62
|
+
budgetMs,
|
|
63
|
+
cpuLoad: budgetMs > 0 ? m.workMs / budgetMs : 0,
|
|
64
|
+
custom,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Draws a small Spectrum-style debug overlay: `FPS` + frame ms, then `CPU %` (only when work time
|
|
69
|
+
* was measured), then one line per `custom` field. Lines are `CELL`-spaced down from `(x, y)`.
|
|
70
|
+
*
|
|
71
|
+
* The game owns the toggle key and placement — this is just a convenience renderer over
|
|
72
|
+
* {@link drawText}.
|
|
73
|
+
*
|
|
74
|
+
* @param x - Left edge in game pixels (default `1`)
|
|
75
|
+
* @param y - Top edge in game pixels (default `1`)
|
|
76
|
+
* @param ink - Text colour (default `C.B_YELLOW`)
|
|
77
|
+
* @param paper - Background colour for readability (default `C.BLACK`)
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* if (showDebug) drawDebugOverlay(ctx, sampleDebug(dbg, { mines }))
|
|
81
|
+
*/
|
|
82
|
+
export function drawDebugOverlay(ctx, info, x = 1, y = 1, ink = C.B_YELLOW, paper = C.BLACK) {
|
|
83
|
+
const lines = [`${Math.round(info.fps)} FPS ${info.frameMs.toFixed(1)}ms`];
|
|
84
|
+
if (info.workMs > 0)
|
|
85
|
+
lines.push(`CPU ${Math.round(info.cpuLoad * 100)}%`);
|
|
86
|
+
for (const key of Object.keys(info.custom))
|
|
87
|
+
lines.push(`${key} ${info.custom[key]}`);
|
|
88
|
+
for (let i = 0; i < lines.length; i++)
|
|
89
|
+
drawText(ctx, lines[i], x, y + i * CELL, ink, paper);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA,OAAO,E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GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;AAC7F,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|
package/dist/input.d.ts
CHANGED
|
@@ -5,17 +5,32 @@ export type Direction = 'up' | 'down' | 'left' | 'right';
|
|
|
5
5
|
* Idempotent — safe to call multiple times. Timing params are always updated;
|
|
6
6
|
* listeners are only attached on the first call.
|
|
7
7
|
* Arrow keys drive movement; `F`/`f` = flag; `P`/`p` = pause; `Ctrl+Shift+B` = debug toggle.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* `+`/`=` raise and `-`/`_` lower the master volume (see {@link setVolumeKeys} to
|
|
9
|
+
* remap or disable). Gamepad support is automatic — `tickMovement` polls the
|
|
10
|
+
* Gamepad API each frame. D-pad and left analog stick map to directions;
|
|
11
|
+
* A = flag, Start = pause, Y = debug.
|
|
10
12
|
*
|
|
11
13
|
* @param repeatDelay - Milliseconds before auto-repeat starts after initial press (default `150`)
|
|
12
14
|
* @param repeatInterval - Milliseconds between repeat ticks while key is held (default `80`)
|
|
13
15
|
*
|
|
14
16
|
* @example
|
|
15
|
-
* initInput() // defaults: 150ms delay, 80ms repeat
|
|
17
|
+
* initInput() // defaults: 150ms delay, 80ms repeat, +/- volume
|
|
16
18
|
* initInput(200, 60) // custom timing; safe to call again to reconfigure
|
|
17
19
|
*/
|
|
18
20
|
export declare function initInput(repeatDelay?: number, repeatInterval?: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Overrides the keys that adjust master volume. Optional — `+`/`=` (up) and
|
|
23
|
+
* `-`/`_` (down) stay active if this is never called. Pass empty arrays to
|
|
24
|
+
* disable volume keys entirely.
|
|
25
|
+
*
|
|
26
|
+
* @param up - Key(s) (`KeyboardEvent.key`) that raise volume. A string or array.
|
|
27
|
+
* @param down - Key(s) that lower volume. A string or array.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* setVolumeKeys('9', '8') // numpad-ish remap; +/- no longer touch volume
|
|
31
|
+
* setVolumeKeys([], []) // disable built-in volume keys
|
|
32
|
+
*/
|
|
33
|
+
export declare function setVolumeKeys(up: string | string[], down: string | string[]): void;
|
|
19
34
|
/**
|
|
20
35
|
* Advances the key-repeat timer and returns the movement direction for this frame.
|
|
21
36
|
* Call once per frame with the frame delta in milliseconds.
|
package/dist/input.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAEA,qDAAqD;AACrD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAmHxD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,WAAW,SAAM,EAAE,cAAc,SAAK,GAAG,IAAI,CAuCtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAGlF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,SAAI,GAAG,SAAS,GAAG,IAAI,CA4B7E;AAED,sGAAsG;AACtG,wBAAgB,WAAW,IAAI,OAAO,CAA+D;AAErG,gGAAgG;AAChG,wBAAgB,YAAY,IAAI,OAAO,CAA8D;AAErG,kFAAkF;AAClF,wBAAgB,YAAY,IAAI,OAAO,CAA8D;AAErG;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAA6D;AAErG;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAyB;AAErE;;;;;;;;GAQG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAgBjC"}
|
package/dist/input.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { increaseVolume, decreaseVolume } from './audio.js';
|
|
1
2
|
const DIR_KEYS = {
|
|
2
3
|
ArrowUp: 'up', ArrowDown: 'down', ArrowLeft: 'left', ArrowRight: 'right',
|
|
3
4
|
};
|
|
@@ -16,6 +17,10 @@ let pendingImmediate = null;
|
|
|
16
17
|
let _repeatDelay = 150;
|
|
17
18
|
let _repeatInterval = 80;
|
|
18
19
|
let inputInitialized = false;
|
|
20
|
+
// Volume keys — on by default; zx-kit owning +/- is the owner-approved trade-off.
|
|
21
|
+
// Remap with setVolumeKeys(); disable with empty sets. Drives audio.ts directly.
|
|
22
|
+
let _volumeUpKeys = ['+', '='];
|
|
23
|
+
let _volumeDownKeys = ['-', '_'];
|
|
19
24
|
// ── Gamepad state ──────────────────────────────────────────────────────────────
|
|
20
25
|
const STICK_DEAD = 0.35;
|
|
21
26
|
let padPrevDir = null;
|
|
@@ -109,14 +114,16 @@ function pollGamepad() {
|
|
|
109
114
|
* Idempotent — safe to call multiple times. Timing params are always updated;
|
|
110
115
|
* listeners are only attached on the first call.
|
|
111
116
|
* Arrow keys drive movement; `F`/`f` = flag; `P`/`p` = pause; `Ctrl+Shift+B` = debug toggle.
|
|
112
|
-
*
|
|
113
|
-
*
|
|
117
|
+
* `+`/`=` raise and `-`/`_` lower the master volume (see {@link setVolumeKeys} to
|
|
118
|
+
* remap or disable). Gamepad support is automatic — `tickMovement` polls the
|
|
119
|
+
* Gamepad API each frame. D-pad and left analog stick map to directions;
|
|
120
|
+
* A = flag, Start = pause, Y = debug.
|
|
114
121
|
*
|
|
115
122
|
* @param repeatDelay - Milliseconds before auto-repeat starts after initial press (default `150`)
|
|
116
123
|
* @param repeatInterval - Milliseconds between repeat ticks while key is held (default `80`)
|
|
117
124
|
*
|
|
118
125
|
* @example
|
|
119
|
-
* initInput() // defaults: 150ms delay, 80ms repeat
|
|
126
|
+
* initInput() // defaults: 150ms delay, 80ms repeat, +/- volume
|
|
120
127
|
* initInput(200, 60) // custom timing; safe to call again to reconfigure
|
|
121
128
|
*/
|
|
122
129
|
export function initInput(repeatDelay = 150, repeatInterval = 80) {
|
|
@@ -141,6 +148,10 @@ export function initInput(repeatDelay = 150, repeatInterval = 80) {
|
|
|
141
148
|
pendingFlag = true;
|
|
142
149
|
if (e.key === 'p' || e.key === 'P')
|
|
143
150
|
pendingPause = true;
|
|
151
|
+
if (_volumeUpKeys.includes(e.key))
|
|
152
|
+
increaseVolume();
|
|
153
|
+
if (_volumeDownKeys.includes(e.key))
|
|
154
|
+
decreaseVolume();
|
|
144
155
|
if (e.ctrlKey && e.shiftKey && (e.key === 'b' || e.key === 'B')) {
|
|
145
156
|
pendingDebug = true;
|
|
146
157
|
e.preventDefault();
|
|
@@ -155,6 +166,22 @@ export function initInput(repeatDelay = 150, repeatInterval = 80) {
|
|
|
155
166
|
}
|
|
156
167
|
});
|
|
157
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Overrides the keys that adjust master volume. Optional — `+`/`=` (up) and
|
|
171
|
+
* `-`/`_` (down) stay active if this is never called. Pass empty arrays to
|
|
172
|
+
* disable volume keys entirely.
|
|
173
|
+
*
|
|
174
|
+
* @param up - Key(s) (`KeyboardEvent.key`) that raise volume. A string or array.
|
|
175
|
+
* @param down - Key(s) that lower volume. A string or array.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* setVolumeKeys('9', '8') // numpad-ish remap; +/- no longer touch volume
|
|
179
|
+
* setVolumeKeys([], []) // disable built-in volume keys
|
|
180
|
+
*/
|
|
181
|
+
export function setVolumeKeys(up, down) {
|
|
182
|
+
_volumeUpKeys = Array.isArray(up) ? up : [up];
|
|
183
|
+
_volumeDownKeys = Array.isArray(down) ? down : [down];
|
|
184
|
+
}
|
|
158
185
|
/**
|
|
159
186
|
* Advances the key-repeat timer and returns the movement direction for this frame.
|
|
160
187
|
* Call once per frame with the frame delta in milliseconds.
|
package/dist/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAK3D,MAAM,QAAQ,GAA8B;IAC1C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO;CACzE,CAAA;AAED,MAAM,UAAU,GAA8B;IAC5C,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY;CACzE,CAAA;AAED,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;AAC9B,IAAI,WAAW,GAAG,KAAK,CAAA;AACvB,IAAI,YAAY,GAAG,KAAK,CAAA;AACxB,IAAI,YAAY,GAAG,KAAK,CAAA;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