zx-kit 0.19.1 → 0.21.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/i18n.d.ts +43 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +48 -0
- package/dist/i18n.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/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/dist/i18n.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* i18n.ts — locale selection helper.
|
|
3
|
+
*
|
|
4
|
+
* A tiny, dependency-free utility for picking a string pack at runtime
|
|
5
|
+
* based on a language code. Designed so any zx-kit game can ship with
|
|
6
|
+
* multiple translations and switch them via a single config flag.
|
|
7
|
+
*
|
|
8
|
+
* USAGE
|
|
9
|
+
* ─────
|
|
10
|
+
* Each locale exports the same shape — usually as named string constants
|
|
11
|
+
* and template functions (e.g. `STR_DEPTH = (m) => \`D:${m}M\``).
|
|
12
|
+
* Import each locale module as a namespace and hand them to `pickLocale`:
|
|
13
|
+
*
|
|
14
|
+
* import * as en from './strings.ts' // default English
|
|
15
|
+
* import * as sk from './strings.sk.ts' // Slovak
|
|
16
|
+
* import * as ru from './strings.ru.ts' // Russian
|
|
17
|
+
* import { LANGUAGE_CODE } from './config.ts'
|
|
18
|
+
*
|
|
19
|
+
* export const L = pickLocale(en, { sk, ru }, LANGUAGE_CODE)
|
|
20
|
+
*
|
|
21
|
+
* Consumers then read `L.STR_DEPTH(120)` etc. — same name, swapped values.
|
|
22
|
+
*
|
|
23
|
+
* SELECTION RULES
|
|
24
|
+
* ───────────────
|
|
25
|
+
* - `code` null / undefined / empty → returns `defaultLocale`
|
|
26
|
+
* - `code` matches a key in `locales` → returns that locale
|
|
27
|
+
* (case-insensitive: 'SK' === 'sk')
|
|
28
|
+
* - `code` doesn't match anything → returns `defaultLocale`
|
|
29
|
+
*
|
|
30
|
+
* The default key (typically 'en') doesn't need to live in the `locales`
|
|
31
|
+
* map — passing 'en' simply falls through to `defaultLocale`. This keeps
|
|
32
|
+
* the English source-of-truth file at the conventional `strings.ts` path
|
|
33
|
+
* without forcing a `strings.en.ts` rename.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Pick a locale object from a map by code, with fallback to a default.
|
|
37
|
+
*
|
|
38
|
+
* Generic over `T` so every entry in `locales` is type-checked against the
|
|
39
|
+
* shape of `defaultLocale` — adding a new translation that misses a key
|
|
40
|
+
* (or has a wrong signature) becomes a compile error.
|
|
41
|
+
*/
|
|
42
|
+
export function pickLocale(defaultLocale, locales, code) {
|
|
43
|
+
if (!code)
|
|
44
|
+
return defaultLocale;
|
|
45
|
+
const normalised = code.toLowerCase();
|
|
46
|
+
return locales[normalised] ?? defaultLocale;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=i18n.js.map
|
package/dist/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,aAAgB,EAChB,OAA0B,EAC1B,IAA+B;IAE/B,IAAI,CAAC,IAAI;QAAE,OAAO,aAAa,CAAA;IAC/B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;IACrC,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,aAAa,CAAA;AAC7C,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,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,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,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,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,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,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,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"}
|
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;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;CAC3B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IAEX,2CAA2C;IAC3C,CAAC,EAAE,MAAM,CAAA;IAET,0CAA0C;IAC1C,CAAC,EAAE,MAAM,CAAA;IAET;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;IAEb,sDAAsD;IACtD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