diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 09:38:16 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | aecc0e8e8979f9afb5cadb7e509bb0cd9b211d0a (patch) | |
| tree | 89361fad9ce8ebc68e62f09fe74d8a6305fe9281 /examples | |
| parent | 3373059db38e3b0bbf6105e91180300a4f1c6ead (diff) | |
| download | sketchbook-aecc0e8e8979f9afb5cadb7e509bb0cd9b211d0a.tar.gz sketchbook-aecc0e8e8979f9afb5cadb7e509bb0cd9b211d0a.zip | |
examples/live: the README's editor lines, and a press the larger name moved
The README says the grammar also sizes the name each line defines (its
query's `(definition name: (name))`, 1.2 times the rest), that the code
is one sketchbook paragraph whose ranges, carets and marks sit where
sk.text.places lays their bytes out, the press found by the same places,
that the canvas is the window's pixels and the picture at most 720 rows
scaled to it. test/live.script presses where 220 began when every
character was 10 pixels, now the space before it: nothing drags (with
the press at 190 it does, and the script fails).
zig build test: 92 of 92 steps.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/live/README.md | 20 | ||||
| -rw-r--r-- | examples/live/test/live.script | 6 |
2 files changed, 20 insertions, 6 deletions
diff --git a/examples/live/README.md b/examples/live/README.md index ea62cec..781fc7a 100644 --- a/examples/live/README.md +++ b/examples/live/README.md @@ -1,7 +1,8 @@ # live A program typed over its own picture, and heard, in pardes's editor -(helix's keys, the language's grammar colouring it). Each line names an +(helix's keys, the language's grammar colouring it and drawing the name +each line defines a size larger). Each line names an expression; the `out` line is what you hear (-1..1), the `color` line what you see. At every keystroke that leaves a program that parses, the program is compiled into two tapes of at most 128 instructions, and one @@ -110,14 +111,21 @@ i; State keeps the editor's value (pardes-editor: 39 KiB of plain data, 4 KiB of text), both tapes, the probe's, the problem, the drag and the time. grammar/grammar.js, generated into the committed grammar/src/parser.c, is the same language for tree-sitter: its parse colours the text -(queries/highlights.scm, in pardes's orchard theme), gives Alt-o its -nodes and a new line its indent (queries/indents.scm). The tapes +(queries/highlights.scm, in pardes's orchard theme) and sizes a +definition's name (that query's `(definition name: (name))`, 1.2 times +the rest), gives Alt-o its nodes and a new line its indent +(queries/indents.scm). The code is one sketchbook paragraph (`f.paragraph`, +a span a run of one class), and every range, caret and mark sits where +`sk.text.places` lays its byte out; `update` finds the number under a +press with the same places, so a mixed size moves nothing out of step. +The canvas is the window's pixels, so the text is never scaled. The tapes go to the GPU as data: the color tape as picture.frag's uniforms, the out tape (with the one it replaces, for the crossfade) in a storage buffer for synth.comp, both including shaders/vm.glsl, a loop over the tape with a switch per op. No shader is compiled after the first frame, so typing -never stalls one. A color tape over 64 instructions is drawn at half -resolution: on an RTX 3050, 128 instructions took 2.7 ms at 1280x720 and -0.85 at half; 60 took 1.4 at full. The sound is `pub const audio_pull = +never stalls one. The picture is drawn at most 720 rows high and scaled +to the window, and a color tape over 64 instructions at half that: on an +RTX 3050, 128 instructions took 2.7 ms at 1280x720 and 0.85 at half; 60 +took 1.4 at full. The sound is `pub const audio_pull = 256` and a block a frame, as much as keeps the host's lead queued: a change is heard a pull or so after the frame that made it. diff --git a/examples/live/test/live.script b/examples/live/test/live.script index 0d4b0c2..f39275d 100644 --- a/examples/live/test/live.script +++ b/examples/live/test/live.script @@ -85,6 +85,12 @@ expect probe.len 0 # 10 pixels a character, the name `out` a step larger at 12, its line 26 # high) pressed and dragged 40 pixels right is 230, then 12 left of where # it was pressed is 217; the program follows; the drag is one step to undo. +# Pressed 6 pixels left, where 220 began when every character was 10 +# pixels, it is the space before it: nothing drags. +down 181 27 +move 221 27 +up 221 27 +expect out.code[1].a 1130102784 down 187 27 move 207 27 move 227 27 |
