@lewismoten/gamemaker-sandbox-tools 0.0.0-stage → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/LICENSE +24 -0
- package/NOTICE.md +121 -0
- package/README.md +362 -2
- package/dist/audio-files.js +82 -0
- package/dist/audio.js +25 -0
- package/dist/block-merge.js +43 -0
- package/dist/color-reduce.js +44 -0
- package/dist/colors.js +87 -0
- package/dist/delta.js +75 -0
- package/dist/disk-diff.js +220 -0
- package/dist/drawing.js +85 -0
- package/dist/embroidery/compile.js +85 -0
- package/dist/embroidery/dst.js +79 -0
- package/dist/embroidery/exp.js +26 -0
- package/dist/embroidery/fill.js +49 -0
- package/dist/embroidery/geom.js +82 -0
- package/dist/embroidery/pes.js +79 -0
- package/dist/embroidery/satin.js +29 -0
- package/dist/embroidery/simulate.js +30 -0
- package/dist/embroidery/strokeFont.js +253 -0
- package/dist/embroidery/svg.js +24 -0
- package/dist/embroidery/types.js +13 -0
- package/dist/embroidery/units.js +26 -0
- package/dist/embroidery/validate.js +15 -0
- package/dist/formats/blocks.js +1 -0
- package/dist/formats/character.js +1 -0
- package/dist/formats/cmf.js +1 -0
- package/dist/formats/fli.js +1 -0
- package/dist/formats/fliLimits.js +1 -0
- package/dist/formats/game.js +1 -0
- package/dist/formats/gif.js +1 -0
- package/dist/formats/graphicScripts.js +1 -0
- package/dist/formats/map.js +1 -0
- package/dist/formats/monster.js +1 -0
- package/dist/formats/palette.js +1 -0
- package/dist/formats/recording.js +1 -0
- package/dist/formats/sound.js +1 -0
- package/dist/formats/voc.js +1 -0
- package/dist/gif-shrink.js +56 -0
- package/dist/image/png.js +42 -0
- package/dist/images.js +88 -0
- package/dist/kit/actors.js +19 -0
- package/dist/kit/align.js +204 -0
- package/dist/kit/blit.js +45 -0
- package/dist/kit/blockRoles.js +97 -0
- package/dist/kit/clips.js +40 -0
- package/dist/kit/coverPaint.js +18 -0
- package/dist/kit/disk.js +76 -0
- package/dist/kit/fadeOut.js +13 -0
- package/dist/kit/fliClips.js +133 -0
- package/dist/kit/fliShrink.js +277 -0
- package/dist/kit/gameSim.js +235 -0
- package/dist/kit/hopBot.js +142 -0
- package/dist/kit/levelGen.js +1423 -0
- package/dist/kit/levelGrid.js +33 -0
- package/dist/kit/levelPicture.js +27 -0
- package/dist/kit/menuVersion.js +19 -0
- package/dist/kit/microText.js +35 -0
- package/dist/kit/mumble.js +74 -0
- package/dist/kit/music.js +8 -0
- package/dist/kit/palRamps.js +32 -0
- package/dist/kit/palette.js +49 -0
- package/dist/kit/pcText.js +72 -0
- package/dist/kit/photo.js +150 -0
- package/dist/kit/pixels.js +79 -0
- package/dist/kit/png.js +40 -0
- package/dist/kit/quantize.js +72 -0
- package/dist/kit/raytrace.js +379 -0
- package/dist/kit/recordedDemo.js +10 -0
- package/dist/kit/reel.js +77 -0
- package/dist/kit/road3d.js +67 -0
- package/dist/kit/routeChecks.js +8 -0
- package/dist/kit/saveSlots.js +11 -0
- package/dist/kit/sceneInit.js +13 -0
- package/dist/kit/sceneSim.js +112 -0
- package/dist/kit/screenText.js +15 -0
- package/dist/kit/sdftext.js +237 -0
- package/dist/kit/shading.js +69 -0
- package/dist/kit/song.js +251 -0
- package/dist/kit/songFx.js +179 -0
- package/dist/kit/sound.js +52 -0
- package/dist/kit/synthParts.js +20 -0
- package/dist/kit/tar.js +53 -0
- package/dist/kit/textBounds.js +84 -0
- package/dist/kit/textfit.js +246 -0
- package/dist/kit/transforms.js +57 -0
- package/dist/kit/tune.js +21 -0
- package/dist/look-alike.js +50 -0
- package/dist/menu-version.js +4 -0
- package/dist/mesh/colorBodies.js +137 -0
- package/dist/mesh/decimate.js +207 -0
- package/dist/mesh/meshCheck.js +51 -0
- package/dist/mesh/overhang.js +41 -0
- package/dist/mesh/sampledField.js +12 -0
- package/dist/mesh/stl.js +36 -0
- package/dist/mesh/surfaceNets.js +79 -0
- package/dist/mesh/tetraMesh.js +62 -0
- package/dist/mesh/threeMf.js +58 -0
- package/dist/mesh/zipFile.js +52 -0
- package/dist/microFont.js +101 -0
- package/dist/music/compose.js +72 -0
- package/dist/pack/meshPack.js +198 -0
- package/dist/pack/threeMfPack.js +92 -0
- package/dist/palette-reserve.js +116 -0
- package/dist/palettes.js +138 -0
- package/dist/release-notes.js +40 -0
- package/dist/simulation.js +18 -0
- package/dist/text.js +74 -0
- package/dist/types/audio.d.ts +4 -0
- package/dist/types/audioFiles.d.ts +22 -0
- package/dist/types/audioWav.d.ts +4 -0
- package/dist/types/blockMerge.d.ts +24 -0
- package/dist/types/colorReduce.d.ts +23 -0
- package/dist/types/colors.d.ts +26 -0
- package/dist/types/delta.d.ts +32 -0
- package/dist/types/diskDiff.d.ts +47 -0
- package/dist/types/drawing.d.ts +15 -0
- package/dist/types/embroidery/compile.d.ts +3 -0
- package/dist/types/embroidery/dst.d.ts +13 -0
- package/dist/types/embroidery/exp.d.ts +8 -0
- package/dist/types/embroidery/fill.d.ts +6 -0
- package/dist/types/embroidery/geom.d.ts +19 -0
- package/dist/types/embroidery/pes.d.ts +10 -0
- package/dist/types/embroidery/satin.d.ts +11 -0
- package/dist/types/embroidery/simulate.d.ts +19 -0
- package/dist/types/embroidery/strokeFont.d.ts +20 -0
- package/dist/types/embroidery/svg.d.ts +3 -0
- package/dist/types/embroidery/types.d.ts +70 -0
- package/dist/types/embroidery/units.d.ts +10 -0
- package/dist/types/embroidery/validate.d.ts +22 -0
- package/dist/types/formats/blocks.d.ts +1 -0
- package/dist/types/formats/character.d.ts +1 -0
- package/dist/types/formats/cmf.d.ts +1 -0
- package/dist/types/formats/fli.d.ts +1 -0
- package/dist/types/formats/fliLimits.d.ts +1 -0
- package/dist/types/formats/game.d.ts +1 -0
- package/dist/types/formats/gif.d.ts +1 -0
- package/dist/types/formats/graphicScripts.d.ts +1 -0
- package/dist/types/formats/map.d.ts +1 -0
- package/dist/types/formats/monster.d.ts +1 -0
- package/dist/types/formats/palette.d.ts +1 -0
- package/dist/types/formats/recording.d.ts +1 -0
- package/dist/types/formats/sound.d.ts +1 -0
- package/dist/types/formats/voc.d.ts +1 -0
- package/dist/types/gifShrink.d.ts +8 -0
- package/dist/types/image/animatedGif.d.ts +9 -0
- package/dist/types/image/png.d.ts +10 -0
- package/dist/types/image/surface.d.ts +26 -0
- package/dist/types/images.d.ts +13 -0
- package/dist/types/kit/actors.d.ts +7 -0
- package/dist/types/kit/align.d.ts +93 -0
- package/dist/types/kit/audioEvents.d.ts +26 -0
- package/dist/types/kit/blit.d.ts +20 -0
- package/dist/types/kit/blockRoles.d.ts +243 -0
- package/dist/types/kit/clips.d.ts +36 -0
- package/dist/types/kit/coverPaint.d.ts +7 -0
- package/dist/types/kit/disk.d.ts +15 -0
- package/dist/types/kit/fadeOut.d.ts +12 -0
- package/dist/types/kit/fliClips.d.ts +32 -0
- package/dist/types/kit/fliShrink.d.ts +149 -0
- package/dist/types/kit/gameSim.d.ts +112 -0
- package/dist/types/kit/hopBot.d.ts +72 -0
- package/dist/types/kit/laserClearance.d.ts +16 -0
- package/dist/types/kit/laserJoints.d.ts +39 -0
- package/dist/types/kit/laserLayout.d.ts +54 -0
- package/dist/types/kit/laserPixels.d.ts +52 -0
- package/dist/types/kit/laserPreview.d.ts +9 -0
- package/dist/types/kit/laserSvg.d.ts +35 -0
- package/dist/types/kit/levelGen/castle.d.ts +17 -0
- package/dist/types/kit/levelGen/dungeon.d.ts +11 -0
- package/dist/types/kit/levelGen/forest.d.ts +17 -0
- package/dist/types/kit/levelGen/furnish.d.ts +31 -0
- package/dist/types/kit/levelGen/grid.d.ts +46 -0
- package/dist/types/kit/levelGen/index.d.ts +138 -0
- package/dist/types/kit/levelGen/interior.d.ts +18 -0
- package/dist/types/kit/levelGen/jumpModel.d.ts +78 -0
- package/dist/types/kit/levelGen/needs.d.ts +44 -0
- package/dist/types/kit/levelGen/overworld.d.ts +21 -0
- package/dist/types/kit/levelGen/platform.d.ts +59 -0
- package/dist/types/kit/levelGen/platformCap.d.ts +13 -0
- package/dist/types/kit/levelGen/platformReach.d.ts +37 -0
- package/dist/types/kit/levelGen/props.d.ts +37 -0
- package/dist/types/kit/levelGen/town.d.ts +24 -0
- package/dist/types/kit/levelGrid.d.ts +16 -0
- package/dist/types/kit/levelPicture.d.ts +9 -0
- package/dist/types/kit/menuVersion.d.ts +7 -0
- package/dist/types/kit/microText.d.ts +18 -0
- package/dist/types/kit/mumble.d.ts +41 -0
- package/dist/types/kit/music.d.ts +1 -0
- package/dist/types/kit/palMerge.d.ts +10 -0
- package/dist/types/kit/palRamps.d.ts +28 -0
- package/dist/types/kit/palette.d.ts +16 -0
- package/dist/types/kit/pcText.d.ts +19 -0
- package/dist/types/kit/photo.d.ts +69 -0
- package/dist/types/kit/pixels.d.ts +26 -0
- package/dist/types/kit/png.d.ts +7 -0
- package/dist/types/kit/quantize.d.ts +20 -0
- package/dist/types/kit/raytrace.d.ts +169 -0
- package/dist/types/kit/recordedDemo.d.ts +1 -0
- package/dist/types/kit/reel.d.ts +34 -0
- package/dist/types/kit/road3d.d.ts +71 -0
- package/dist/types/kit/routeChecks.d.ts +6 -0
- package/dist/types/kit/saveSlots.d.ts +17 -0
- package/dist/types/kit/sceneInit.d.ts +11 -0
- package/dist/types/kit/sceneSim.d.ts +84 -0
- package/dist/types/kit/screenText.d.ts +3 -0
- package/dist/types/kit/sdftext.d.ts +34 -0
- package/dist/types/kit/shading.d.ts +23 -0
- package/dist/types/kit/shareBlocks.d.ts +20 -0
- package/dist/types/kit/song.d.ts +89 -0
- package/dist/types/kit/songFx.d.ts +99 -0
- package/dist/types/kit/sound.d.ts +29 -0
- package/dist/types/kit/synthParts.d.ts +7 -0
- package/dist/types/kit/tar.d.ts +13 -0
- package/dist/types/kit/textBounds.d.ts +51 -0
- package/dist/types/kit/textfit.d.ts +74 -0
- package/dist/types/kit/transforms.d.ts +8 -0
- package/dist/types/kit/tune.d.ts +6 -0
- package/dist/types/lookAlike.d.ts +31 -0
- package/dist/types/menuVersionEntry.d.ts +1 -0
- package/dist/types/mesh/colorBodies.d.ts +18 -0
- package/dist/types/mesh/decimate.d.ts +10 -0
- package/dist/types/mesh/fieldTrinket.d.ts +40 -0
- package/dist/types/mesh/figureShapes.d.ts +24 -0
- package/dist/types/mesh/mesh.d.ts +9 -0
- package/dist/types/mesh/meshCheck.d.ts +22 -0
- package/dist/types/mesh/overhang.d.ts +24 -0
- package/dist/types/mesh/pixelFigure.d.ts +41 -0
- package/dist/types/mesh/sampledField.d.ts +3 -0
- package/dist/types/mesh/sdfShapes.d.ts +20 -0
- package/dist/types/mesh/stl.d.ts +9 -0
- package/dist/types/mesh/strokeText.d.ts +8 -0
- package/dist/types/mesh/surfaceNets.d.ts +14 -0
- package/dist/types/mesh/tetraMesh.d.ts +4 -0
- package/dist/types/mesh/threeMf.d.ts +12 -0
- package/dist/types/mesh/trinketKinds.d.ts +72 -0
- package/dist/types/mesh/trinketTool.d.ts +26 -0
- package/dist/types/mesh/voxel.d.ts +10 -0
- package/dist/types/mesh/zipFile.d.ts +13 -0
- package/dist/types/microFont.d.ts +6 -0
- package/dist/types/music/compose.d.ts +51 -0
- package/dist/types/pack/meshPack.d.ts +26 -0
- package/dist/types/pack/threeMfPack.d.ts +11 -0
- package/dist/types/palettePresetData.d.ts +4 -0
- package/dist/types/palettePresets.d.ts +12 -0
- package/dist/types/paletteReserve.d.ts +52 -0
- package/dist/types/palettes.d.ts +4 -0
- package/dist/types/releaseNotes.d.ts +3 -0
- package/dist/types/simulation.d.ts +6 -0
- package/dist/types/text.d.ts +41 -0
- package/package.json +190 -4
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type DiskFiles = ReadonlyMap<string, Uint8Array>;
|
|
2
|
+
export interface ChangedFile {
|
|
3
|
+
name: string;
|
|
4
|
+
kind: string;
|
|
5
|
+
before: number;
|
|
6
|
+
after: number;
|
|
7
|
+
summary: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface DiskDiff {
|
|
10
|
+
added: {
|
|
11
|
+
name: string;
|
|
12
|
+
kind: string;
|
|
13
|
+
size: number;
|
|
14
|
+
}[];
|
|
15
|
+
removed: {
|
|
16
|
+
name: string;
|
|
17
|
+
kind: string;
|
|
18
|
+
size: number;
|
|
19
|
+
}[];
|
|
20
|
+
changed: ChangedFile[];
|
|
21
|
+
unchanged: number;
|
|
22
|
+
}
|
|
23
|
+
/** What a file is, by its first bytes when they say, else by its extension. */
|
|
24
|
+
export declare function sniffKind(name: string, bytes: Uint8Array): string;
|
|
25
|
+
/** Numbers as ranges: 3,4,5,9 -> "3-5, 9". Long lists are cut. */
|
|
26
|
+
export declare function ranges(nums: number[], max?: number): string;
|
|
27
|
+
/** Lines added and removed: shared head and tail dropped, then a longest-common-subsequence. */
|
|
28
|
+
export declare function lineDiff(a: string[], b: string[]): {
|
|
29
|
+
added: number;
|
|
30
|
+
removed: number;
|
|
31
|
+
};
|
|
32
|
+
/** Changed map cells grouped into clusters (cells within 3 of each other), as bounding boxes. */
|
|
33
|
+
export declare function cellClusters(cells: number[], width: number): {
|
|
34
|
+
count: number;
|
|
35
|
+
x0: number;
|
|
36
|
+
y0: number;
|
|
37
|
+
x1: number;
|
|
38
|
+
y1: number;
|
|
39
|
+
}[];
|
|
40
|
+
/** A short plain-text summary of how one file changed; a parse failure falls back to bytes. */
|
|
41
|
+
export declare function summarizeChange(name: string, a: Uint8Array, b: Uint8Array): {
|
|
42
|
+
kind: string;
|
|
43
|
+
summary: string[];
|
|
44
|
+
};
|
|
45
|
+
export declare function diffDisks(a: DiskFiles, b: DiskFiles): DiskDiff;
|
|
46
|
+
/** The plain-text report: counts, then added, removed, and changed files with their summaries. */
|
|
47
|
+
export declare function formatDiff(d: DiskDiff): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './kit/pixels.js';
|
|
2
|
+
export * from './kit/palette.js';
|
|
3
|
+
export * from './kit/pcText.js';
|
|
4
|
+
export * from './kit/blit.js';
|
|
5
|
+
export * from './kit/shading.js';
|
|
6
|
+
export * from './kit/textBounds.js';
|
|
7
|
+
export * from './kit/reel.js';
|
|
8
|
+
export { FONT8X8 } from '@lewismoten/gamemaker-sandbox-engine/gfx/font8x8';
|
|
9
|
+
export * from './text.js';
|
|
10
|
+
export * from './colors.js';
|
|
11
|
+
export * from './kit/microText.js';
|
|
12
|
+
export { microGlyphs, type MicroGlyphs } from './microFont.js';
|
|
13
|
+
export * from './kit/transforms.js';
|
|
14
|
+
export * from './kit/coverPaint.js';
|
|
15
|
+
export * from './kit/palRamps.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Pattern, Stitch } from './types.js';
|
|
2
|
+
/** The DST file for a pattern. */
|
|
3
|
+
export declare function writeDst(pattern: Pattern): Uint8Array;
|
|
4
|
+
/** Reads a DST back into absolute stitches in mm (jumps and color changes included; the header counts are checked by the caller). */
|
|
5
|
+
export declare function readDst(bytes: Uint8Array): {
|
|
6
|
+
stitches: Stitch[];
|
|
7
|
+
colorChanges: number;
|
|
8
|
+
label: string;
|
|
9
|
+
declared: {
|
|
10
|
+
stitches: number;
|
|
11
|
+
colors: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Pattern, Stitch } from './types.js';
|
|
2
|
+
/** The EXP file for a pattern. */
|
|
3
|
+
export declare function writeExp(pattern: Pattern): Uint8Array;
|
|
4
|
+
/** Reads an EXP back into absolute stitches in mm; the end is where the data stops. */
|
|
5
|
+
export declare function readExp(bytes: Uint8Array): {
|
|
6
|
+
stitches: Stitch[];
|
|
7
|
+
colorChanges: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Poly, Pt } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The chains of needle points that fill the outlines with rows at `angle` degrees. Each chain is sewn in order; moving
|
|
4
|
+
* between chains is the caller's job.
|
|
5
|
+
*/
|
|
6
|
+
export declare function tatami(polys: Poly[], angle: number, spacing: number, len: number): Pt[][];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Poly, Pt } from './types.js';
|
|
2
|
+
export declare const dist: (a: Pt, b: Pt) => number;
|
|
3
|
+
/** A circle as a polygon of `n` points, counter-clockwise from the right. */
|
|
4
|
+
export declare function circle(cx: number, cy: number, r: number, n?: number): Poly;
|
|
5
|
+
/** A star with `points` tips (first tip at `start` radians) between an inner and an outer radius. */
|
|
6
|
+
export declare function star(cx: number, cy: number, inner: number, outer: number, points: number, start?: number): Poly;
|
|
7
|
+
/** Points on an elliptical arc from angle a0 to a1 (radians), `n` segments. */
|
|
8
|
+
export declare function arc(cx: number, cy: number, rx: number, ry: number, a0: number, a1: number, n?: number): Pt[];
|
|
9
|
+
/** Signed area (positive when counter-clockwise). */
|
|
10
|
+
export declare function area(p: Poly): number;
|
|
11
|
+
/** The outline moved `d` mm inward (outward when negative), mitered at the corners with the miter length capped. */
|
|
12
|
+
export declare function inset(p: Poly, d: number): Poly;
|
|
13
|
+
/** Even-odd containment in any of the outlines. */
|
|
14
|
+
export declare function inside(polys: Poly[], pt: Pt): boolean;
|
|
15
|
+
/** The path cut into points about `step` mm apart along it (its corners are kept). Closed paths return to the start. */
|
|
16
|
+
export declare function resample(path: Pt[], step: number, closed?: boolean): Pt[];
|
|
17
|
+
/** The path cut at even spacing by arc length (corners are not kept), for satin. */
|
|
18
|
+
export declare function evenly(path: Pt[], step: number, closed?: boolean): Pt[];
|
|
19
|
+
export declare const rotate: (p: Pt, a: number) => Pt;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Pattern, Stitch } from './types.js';
|
|
2
|
+
/** The PES file for a pattern. */
|
|
3
|
+
export declare function writePes(pattern: Pattern): Uint8Array;
|
|
4
|
+
/** Reads a PES back (the PEC section) into absolute stitches in mm. */
|
|
5
|
+
export declare function readPes(bytes: Uint8Array): {
|
|
6
|
+
stitches: Stitch[];
|
|
7
|
+
colorChanges: number;
|
|
8
|
+
threads: number;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Pt } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The needle points of a satin column along `path` (closed paths end where they began).
|
|
4
|
+
* Each lane is one list; a column up to `maxWidth` is a single lane.
|
|
5
|
+
*/
|
|
6
|
+
export declare function satin(path: Pt[], width: number, density: number, closed: boolean, maxWidth: number): Pt[][];
|
|
7
|
+
/**
|
|
8
|
+
* Underlay for a satin column: a walk down its center, and a loose zigzag a little narrower than the column when it is
|
|
9
|
+
* wide enough to need one.
|
|
10
|
+
*/
|
|
11
|
+
export declare function satinUnderlay(path: Pt[], width: number, run: number, closed: boolean): Pt[][];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Pattern, RGB } from './types.js';
|
|
2
|
+
export interface Picture {
|
|
3
|
+
w: number;
|
|
4
|
+
h: number;
|
|
5
|
+
rgb: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
export interface SimOptions {
|
|
8
|
+
/** Picture size in mm (square), centered on 0,0. */
|
|
9
|
+
size: number;
|
|
10
|
+
pxPerMm: number;
|
|
11
|
+
/** Thread width, mm (about 0.4 for 40 weight thread, drawn a little heavier to read at small size). */
|
|
12
|
+
thread?: number;
|
|
13
|
+
/** Backing fabric color. */
|
|
14
|
+
backing?: RGB;
|
|
15
|
+
/** The mm point at the middle of the picture (default 0,0), to look closely at one part. */
|
|
16
|
+
center?: [number, number];
|
|
17
|
+
}
|
|
18
|
+
/** Draws the pattern. */
|
|
19
|
+
export declare function simulate(pattern: Pattern, o: SimOptions): Picture;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Pt } from './types.js';
|
|
2
|
+
export interface ArcTextOptions {
|
|
3
|
+
/** Center of the circle. */
|
|
4
|
+
cx: number;
|
|
5
|
+
cy: number;
|
|
6
|
+
/** Radius of the letters' baselines (their feet), mm; the stroke centers run from here out (top) or in (bottom). */
|
|
7
|
+
baseline: number;
|
|
8
|
+
/** Height of the letters in mm (stroke center to stroke center). */
|
|
9
|
+
height: number;
|
|
10
|
+
/** Gap between letters, mm. */
|
|
11
|
+
gap: number;
|
|
12
|
+
/** 'top' reads left to right over the top with feet toward the center; 'bottom' reads left to right under the bottom with heads toward the center. */
|
|
13
|
+
side: 'top' | 'bottom';
|
|
14
|
+
/** Stretches the letters sideways (1 = as drawn). */
|
|
15
|
+
stretch?: number;
|
|
16
|
+
/** Where the middle of the word sits, radians (default: straight up for top, straight down for bottom). */
|
|
17
|
+
center?: number;
|
|
18
|
+
}
|
|
19
|
+
/** The strokes (as paths of points, mm) that spell `text` bent around the circle. */
|
|
20
|
+
export declare function arcText(text: string, o: ArcTextOptions): Pt[][];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export type Pt = [number, number];
|
|
2
|
+
/** A closed outline (the last point joins the first). */
|
|
3
|
+
export type Poly = Pt[];
|
|
4
|
+
export type RGB = [number, number, number];
|
|
5
|
+
export interface Thread {
|
|
6
|
+
/** A generic color name ("midnight navy"), not a brand. */
|
|
7
|
+
name: string;
|
|
8
|
+
rgb: RGB;
|
|
9
|
+
/** Brother PEC thread-chart index (1-64) for the PES file; the machine shows its own color for it. */
|
|
10
|
+
pec?: number;
|
|
11
|
+
}
|
|
12
|
+
/** What the needle does next: sew to the point, move without sewing, cut the thread then move, change thread, or finish. */
|
|
13
|
+
export type Cmd = 'stitch' | 'jump' | 'trim' | 'color' | 'end';
|
|
14
|
+
export interface Stitch {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
cmd: Cmd;
|
|
18
|
+
}
|
|
19
|
+
export interface Pattern {
|
|
20
|
+
name: string;
|
|
21
|
+
threads: Thread[];
|
|
22
|
+
stitches: Stitch[];
|
|
23
|
+
}
|
|
24
|
+
/** A shape filled with tatami (rows of stitches), under an optional underlay. */
|
|
25
|
+
export interface FillItem {
|
|
26
|
+
kind: 'fill';
|
|
27
|
+
polys: Poly[];
|
|
28
|
+
/** Direction of the rows, degrees. Regions should alternate it. */
|
|
29
|
+
angle: number;
|
|
30
|
+
}
|
|
31
|
+
/** A column of satin zigzag along a line, `width` mm wide (split into lanes beyond 7 mm). */
|
|
32
|
+
export interface SatinItem {
|
|
33
|
+
kind: 'satin';
|
|
34
|
+
path: Pt[];
|
|
35
|
+
width: number;
|
|
36
|
+
closed?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** A plain line of running stitches. */
|
|
39
|
+
export interface RunItem {
|
|
40
|
+
kind: 'run';
|
|
41
|
+
path: Pt[];
|
|
42
|
+
closed?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export type Item = FillItem | SatinItem | RunItem;
|
|
45
|
+
/** Everything sewn in one thread, in order; a color change comes between blocks. */
|
|
46
|
+
export interface Block {
|
|
47
|
+
thread: Thread;
|
|
48
|
+
items: Item[];
|
|
49
|
+
}
|
|
50
|
+
export interface Design {
|
|
51
|
+
name: string;
|
|
52
|
+
/** The hoop's sewing field in mm. */
|
|
53
|
+
hoop: [number, number];
|
|
54
|
+
/** Blocks in sewing order. */
|
|
55
|
+
blocks: Block[];
|
|
56
|
+
}
|
|
57
|
+
/** The tuning numbers of the generator, in mm. */
|
|
58
|
+
export interface Params {
|
|
59
|
+
fillSpacing: number;
|
|
60
|
+
fillLength: number;
|
|
61
|
+
satinDensity: number;
|
|
62
|
+
/** Extra satin width (total) so the thread draws in and still covers its shape. */
|
|
63
|
+
pullComp: number;
|
|
64
|
+
/** Outline growth of fills for the same reason. */
|
|
65
|
+
fillGrow: number;
|
|
66
|
+
maxStitch: number;
|
|
67
|
+
underlayRun: number;
|
|
68
|
+
maxSatin: number;
|
|
69
|
+
}
|
|
70
|
+
export declare const DEFAULTS: Params;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Cmd, Pattern } from './types.js';
|
|
2
|
+
export interface Move {
|
|
3
|
+
dx: number;
|
|
4
|
+
dy: number;
|
|
5
|
+
cmd: Cmd;
|
|
6
|
+
}
|
|
7
|
+
/** Cut-off for one record's move in either direction, in tenths of a millimeter (Tajima DST's limit; EXP and PES take more). */
|
|
8
|
+
export declare const MAX_MOVE = 121;
|
|
9
|
+
/** The pattern's records. Positions are rounded as absolute tenths, so rounding never builds up along a long run. */
|
|
10
|
+
export declare function toRecords(pattern: Pattern, maxMove?: number): Move[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Stitch } from './types.js';
|
|
2
|
+
export interface Report {
|
|
3
|
+
stitches: number;
|
|
4
|
+
jumps: number;
|
|
5
|
+
colorChanges: number;
|
|
6
|
+
/** Longest sewn stitch and longest single jump record, mm. */
|
|
7
|
+
maxStitch: number;
|
|
8
|
+
maxJump: number;
|
|
9
|
+
/** Extents of every needle position, mm: [minX, minY, maxX, maxY]. */
|
|
10
|
+
extents: [number, number, number, number];
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
problems: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface Expect {
|
|
16
|
+
hoop: [number, number];
|
|
17
|
+
/** Number of thread colors; the file must change color this many minus one times. */
|
|
18
|
+
colors: number;
|
|
19
|
+
/** The longest single record the format allows, mm (12.1 for DST). */
|
|
20
|
+
maxRecord: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function validate(list: Stitch[], want: Expect): Report;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/blocks';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/character';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/cmf';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/fli';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/fliLimits';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/game';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/gif';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/graphicScripts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/map';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/monster';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/palette';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/recording';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/sound';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@lewismoten/gamemaker-sandbox-engine/formats/voc';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface GifShrink {
|
|
2
|
+
bytes: Uint8Array;
|
|
3
|
+
/** Table size before and after. */
|
|
4
|
+
from: number;
|
|
5
|
+
to: number;
|
|
6
|
+
}
|
|
7
|
+
/** The smaller file, or undefined when the table can't shrink without changing what PLAYGAME shows. */
|
|
8
|
+
export declare function shrinkGif(bytes: Uint8Array): GifShrink | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AnimatedFrame {
|
|
2
|
+
/** width * height palette indexes. */
|
|
3
|
+
pixels: Uint8Array;
|
|
4
|
+
/** 768 bytes, 6 bits per channel. */
|
|
5
|
+
palette: Uint8Array;
|
|
6
|
+
/** Hundredths of a second this frame shows. */
|
|
7
|
+
delay: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function encodeAnimatedGif(width: number, height: number, frames: AnimatedFrame[]): Uint8Array;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IndexedPicture {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
pixels: Uint8Array;
|
|
5
|
+
/** 256 colors x 3 levels of 0-63. */
|
|
6
|
+
palette: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
export declare function encodePng(pic: IndexedPicture, scale?: number): Promise<Uint8Array>;
|
|
9
|
+
/** Bytes as base64 (an MCP image block's data). */
|
|
10
|
+
export declare function base64(bytes: Uint8Array): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Pixels } from '../kit/pixels.js';
|
|
2
|
+
export type SurfaceMirror = 'none' | 'h' | 'v' | 'both';
|
|
3
|
+
/** The pixel and its mirror images across the whole picture, without repeats. */
|
|
4
|
+
export declare function mirrorAll(x: number, y: number, w: number, h: number, mirror: SurfaceMirror): [number, number][];
|
|
5
|
+
type Plot = (x: number, y: number) => void;
|
|
6
|
+
/** Every pixel of a straight line from a to b. */
|
|
7
|
+
export declare function line(a: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}, b: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}, plot: Plot): void;
|
|
14
|
+
/** The outline of the box with corners a and b. */
|
|
15
|
+
export declare function box(a: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}, b: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}, plot: Plot): void;
|
|
22
|
+
/** Fills one four-connected color region. A mask and writer can preserve missing or shared tiles. */
|
|
23
|
+
export declare function floodFill(px: Uint8Array, w: number, h: number, x: number, y: number, v: number, allowed?: (x: number, y: number) => boolean, paint?: (x: number, y: number, value: number) => void): void;
|
|
24
|
+
/** Move indexed pixels with wrapping at each edge; the input is unchanged. */
|
|
25
|
+
export declare function shiftPixels(src: Pixels, dx: number, dy: number): Pixels;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { encodePng, type IndexedPicture } from './image/png.js';
|
|
2
|
+
export { crc32 } from '@lewismoten/gamemaker-sandbox-archives/zip';
|
|
3
|
+
export { Pixels } from './kit/pixels.js';
|
|
4
|
+
export { flipX, flipY, turn90, turn180 } from './kit/transforms.js';
|
|
5
|
+
export { mirrorAll, line, box, floodFill, shiftPixels, type SurfaceMirror } from './image/surface.js';
|
|
6
|
+
/** Portable RGBA pixels; accepts ImageData without requiring canvas or a DOM. RGB is treated as opaque. */
|
|
7
|
+
export interface RgbaPixels {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
data: ArrayLike<number>;
|
|
11
|
+
}
|
|
12
|
+
/** Median cut over the given RGBA images: up to `colors` 8-bit colors. */
|
|
13
|
+
export declare function medianCutRgba(images: readonly RgbaPixels[], colors?: number): [number, number, number][];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Frame, type Sequence } from '@lewismoten/gamemaker-sandbox-engine/formats/character';
|
|
2
|
+
import { type March, type Monster } from '@lewismoten/gamemaker-sandbox-engine/formats/monster';
|
|
3
|
+
export declare function set(s: Sequence, frames: Frame[], o?: Partial<Omit<Sequence, 'frames'>>): void;
|
|
4
|
+
export declare function mon(pics: [number, number][], o: Partial<Monster>, path?: March[]): Monster;
|
|
5
|
+
export declare const corner: (x: number, y: number, speed: number, orient?: number) => March;
|
|
6
|
+
/** Back and forth `run` blocks (to the right first) at `speed`, facing the way it goes. */
|
|
7
|
+
export declare const pace: (run: number, speed: number, dy?: number) => March[];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type Block } from '@lewismoten/gamemaker-sandbox-engine/formats/blocks';
|
|
2
|
+
/** What a map cell holds, by block name ('' or undefined for unnamed). */
|
|
3
|
+
export type NameAt = (x: number, y: number) => string | undefined;
|
|
4
|
+
/** A wanted part: its name, or a test (a RegExp, or { test, toString } for the report). */
|
|
5
|
+
type Want = string | {
|
|
6
|
+
test(got: string): boolean;
|
|
7
|
+
toString(): string;
|
|
8
|
+
};
|
|
9
|
+
/** Where a part wants its neighbors: [dx, dy, wanted]. */
|
|
10
|
+
export type Need = [number, number, Want][];
|
|
11
|
+
/** A part and the parts that must sit beside it. `need` may be a function of the part's regex
|
|
12
|
+
* match; with several needs (a part that can stand in more than one place of its object) one
|
|
13
|
+
* of them must hold. */
|
|
14
|
+
export interface PartRule {
|
|
15
|
+
part: string | {
|
|
16
|
+
test(name: string): boolean;
|
|
17
|
+
};
|
|
18
|
+
need: Need | Need[] | ((m: RegExpExecArray) => Need);
|
|
19
|
+
/** Name for the report (default: the part's name). */
|
|
20
|
+
what?: string;
|
|
21
|
+
/** false: the neighbors it checks are not parts of its object (no art join to measure). */
|
|
22
|
+
joins?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Every part whose neighbors are wrong: "name at x,y: wanted W at dx,dy, found G". Parts must
|
|
25
|
+
* not run off the map's edge either (playgame's maps wrap, so the other side is wrong too).
|
|
26
|
+
* Right-hand and lower neighbors that are right go into `joined` (JSON [left or upper, right or
|
|
27
|
+
* lower, 'h' or 'v']), the pairs whose art must join up. */
|
|
28
|
+
export declare function checkParts(at: NameAt, rules: PartRule[], w?: number, h?: number, joined?: Set<string>): string[];
|
|
29
|
+
/** Rules for objects whose parts are named by column and row (house:0,1 or cat12): every part
|
|
30
|
+
* wants every other part of its object. `sizes` gives each object's columns and rows; `name`
|
|
31
|
+
* turns object, column and row back into a part name. `alias` lets an animation frame stand
|
|
32
|
+
* in for a part. */
|
|
33
|
+
export declare function gridParts(re: RegExp, sizes: Map<string, [number, number]>, name: (obj: string, c: number, r: number) => string, alias?: (got: string) => string): PartRule;
|
|
34
|
+
/** Rules for an object drawn as rows of parts (null: any block): each part wants every other
|
|
35
|
+
* part of the object at its place (a part found at several places: at one of them). */
|
|
36
|
+
export declare function shape(what: string, rows: (Want | null)[][]): PartRule[];
|
|
37
|
+
/** Pairs: every `a` has a `b` at dx, dy and every `b` an `a` the other way. */
|
|
38
|
+
export declare const pair: (what: string, a: Want, b: Want, dx: number, dy: number) => PartRule[];
|
|
39
|
+
/** Rules read off the maps themselves, for a game whose objects are numbered parts (sign0
|
|
40
|
+
* sign1 sign2, or sign00 sign01 down a column): where part n mostly stands (`share` of the
|
|
41
|
+
* time) with part n+1 just right of it (or just below it), that is how the object goes
|
|
42
|
+
* together, and every part n and n+1 must be so. Numbered animation frames and patterns don't
|
|
43
|
+
* stand that way, so they get no rule.
|
|
44
|
+
* `skip` leaves out stems that only look like objects. */
|
|
45
|
+
export declare function autoParts(maps: NameAt[], names: Iterable<string>, skip?: RegExp, share?: number): PartRule[];
|
|
46
|
+
/** A block book's names by block number. */
|
|
47
|
+
export declare function namesOf(index: Map<string, number>): string[];
|
|
48
|
+
/** Object sizes (columns, rows) from a block set's part names matched by `re` (object, col, row). */
|
|
49
|
+
export declare function sizesOf(names: Iterable<string>, re: RegExp): Map<string, [number, number]>;
|
|
50
|
+
/** A block's picture: palette index at x, y (0..19). */
|
|
51
|
+
type Pic = (x: number, y: number) => number;
|
|
52
|
+
interface Seam {
|
|
53
|
+
a: string;
|
|
54
|
+
b: string;
|
|
55
|
+
dir: 'h' | 'v';
|
|
56
|
+
/** Mean color distance across the shared edge. */
|
|
57
|
+
across: number;
|
|
58
|
+
/** Draws the pair joined (scaled up) into a PNG, for a look. */
|
|
59
|
+
draw?: (file: string, s?: number) => void;
|
|
60
|
+
/** Mean color distance one pixel in from the edge, on the busier side (the art's own texture,
|
|
61
|
+
* so a pattern with a line on its edge, like tile grout, is not a break). */
|
|
62
|
+
within: number;
|
|
63
|
+
}
|
|
64
|
+
/** How sharply each joined pair's art changes across its shared edge ('h': b right of a,
|
|
65
|
+
* 'v': b below a), next to how much it changes one pixel either side of the edge. A seam
|
|
66
|
+
* whose `across` is far above `within` is where the art breaks (an outline, a jump). */
|
|
67
|
+
export declare function seams(pic: (name: string) => Pic, pal: Uint8Array, pairs: [string, string, 'h' | 'v'][]): Seam[];
|
|
68
|
+
/** Seams that look broken: the colors jump across the edge much more than beside it. */
|
|
69
|
+
export declare function brokenSeams(s: Seam[], factor?: number, floor?: number): Seam[];
|
|
70
|
+
/** One adventure scene of a built disk: its name, palette, map and background blocks. */
|
|
71
|
+
export interface DiskScene {
|
|
72
|
+
desc: string;
|
|
73
|
+
map: string;
|
|
74
|
+
pal: Uint8Array;
|
|
75
|
+
blocks: Uint8Array;
|
|
76
|
+
bbl: Block[];
|
|
77
|
+
}
|
|
78
|
+
/** Every adventure scene on a built disk (the .gam's scenes, by their files). */
|
|
79
|
+
export declare function diskScenes(disk: string): DiskScene[];
|
|
80
|
+
/** A PNG of map cells x..x+w, y..y+h of a disk scene (wrapping like playgame), scaled `s`
|
|
81
|
+
* times; `blocks` overrides the scene's block pictures (to show art before a fix). */
|
|
82
|
+
export declare function writeArea(file: string, sc: DiskScene, x: number, y: number, w: number, h: number, s?: number, blocks?: Block[]): void;
|
|
83
|
+
/** Checks a built disk: every map's multi-block objects (names: each map file's block names by
|
|
84
|
+
* number, undefined to skip the map) by the rules (or each map's own rules), and the art of every pair the maps join. */
|
|
85
|
+
export declare function auditDisk(disk: string, names: (map: string) => string[] | undefined, rules: PartRule[] | ((map: string) => PartRule[]), opts?: {
|
|
86
|
+
factor?: number;
|
|
87
|
+
floor?: number;
|
|
88
|
+
}): {
|
|
89
|
+
maps: [string, string[]][];
|
|
90
|
+
seams: Seam[];
|
|
91
|
+
broken: Seam[];
|
|
92
|
+
};
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type AudioEvent = {
|
|
2
|
+
t: number;
|
|
3
|
+
kind: 'song';
|
|
4
|
+
bytes?: Uint8Array;
|
|
5
|
+
} | {
|
|
6
|
+
t: number;
|
|
7
|
+
kind: 'stopSong';
|
|
8
|
+
} | {
|
|
9
|
+
t: number;
|
|
10
|
+
kind: 'pause';
|
|
11
|
+
paused: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
t: number;
|
|
14
|
+
kind: 'speaker';
|
|
15
|
+
freqs: ArrayLike<number>;
|
|
16
|
+
} | {
|
|
17
|
+
t: number;
|
|
18
|
+
kind: 'stopSpeaker';
|
|
19
|
+
} | {
|
|
20
|
+
t: number;
|
|
21
|
+
kind: 'voc';
|
|
22
|
+
bytes?: Uint8Array;
|
|
23
|
+
} | {
|
|
24
|
+
t: number;
|
|
25
|
+
kind: 'stopVoc';
|
|
26
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Pixels } from './pixels.js';
|
|
2
|
+
export declare const CLEAR = 255;
|
|
3
|
+
/** Copies src over dst, skipping clear pixels. */
|
|
4
|
+
export declare function over(dst: Pixels, src: Pixels, x?: number, y?: number): Pixels;
|
|
5
|
+
/** Recolors every pixel through a lookup (palette swaps for variants and hurt flashes). */
|
|
6
|
+
export declare function recolor(src: Pixels, fn: (c: number) => number): Pixels;
|
|
7
|
+
/** Nearest-neighbor scaled copy (for big sprites on screens). */
|
|
8
|
+
export declare function scaleBlit(dst: Pixels, src: Pixels, x: number, y: number, s: number, flip?: boolean, transparent?: number): void;
|
|
9
|
+
/** Adds a 1 pixel outline in `ink` around every opaque pixel. */
|
|
10
|
+
export declare function outline(src: Pixels, ink: number, options?: {
|
|
11
|
+
transparent?: number;
|
|
12
|
+
ignoreInk?: boolean;
|
|
13
|
+
}): Pixels;
|
|
14
|
+
export declare function asciiSprite(rows: string[], key: Record<string, number>, dx?: number, dy?: number, w?: number, h?: number): Pixels;
|
|
15
|
+
/** Draw ASCII art through the indexed canvas. */
|
|
16
|
+
export declare const asciiArt: (p: Pixels, x: number, y: number, rows: string[], key: Record<string, number>) => Pixels;
|
|
17
|
+
/** Scale with an explicit transparent color and no mirroring. */
|
|
18
|
+
export declare const scaleBlitTransparent: (dst: Pixels, src: Pixels, x: number, y: number, scale: number, transparent?: number) => void;
|
|
19
|
+
/** In-place variant for existing sprite canvases. */
|
|
20
|
+
export declare function outlineInPlace(p: Pixels, ink: number, transparent?: number): Pixels;
|