summaryrefslogtreecommitdiff
path: root/anim/src/map.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-12 11:32:59 -0300
committerGabriel Schneider <[email protected]>2026-11-12 13:19:32 -0300
commiteab50d1c040774351f332a1568fa332c377860bd (patch)
tree0e727f9bf323e49aa6a2f55bb4fabd166aa9a492 /anim/src/map.zig
parent38971edd9b49a802e6e726fb51d162df1bf58b83 (diff)
downloadcomputeranim-eab50d1c040774351f332a1568fa332c377860bd.tar.gz
computeranim-eab50d1c040774351f332a1568fa332c377860bd.zip
canim: the introduction as one video, with a chapter on registers
From the user. One scene, intro, in four chapters: memory, registers, the stack, code and meaning (210 s). The registers chapter builds the panel before the stack needs it: sixteen rows with their chains, rip pinned on the code band and rsp and rbp on the stack's, rdi opened into its parts as mov edi changes one byte, a call to malloc stepped over with its result in rax, the registers a scene never changes folded. The chapters join at seams that say their title and keep it as the clock's label; one recording (from push(9), no agent, the heap from --heap) and one clock. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/map.zig')
-rw-r--r--anim/src/map.zig15
1 files changed, 14 insertions, 1 deletions
diff --git a/anim/src/map.zig b/anim/src/map.zig
index eaec991..2a2077a 100644
--- a/anim/src/map.zig
+++ b/anim/src/map.zig
@@ -1133,6 +1133,19 @@ fn spanOf2(maybe: ?Window, col: *const Column) ?[2]f32 {
/// The map whose columns the strips are (`context` sets it).
/// shortcut: process-wide, as the drawing flags are: one scene drawn at a time.
pub var current: ?*const Map = null;
+/// Every context's map (a scene in chapters has one a context, `context`): a
+/// pane's strip is drawn from its own context's, the one whose working
+/// frame has the pane's box; `current` where none has.
+pub var maps: [8]?*const Map = @splat(null);
+pub var maps_frame: u64 = std.math.maxInt(u64);
+
+fn ownMap(panel: Panel, at: anim.Placed, box: Rect) ?*const Map {
+ for (maps) |maybe| if (maybe) |m| {
+ const b = m.frame.box(at, @enumFromInt(@intFromEnum(panel)));
+ if (@abs(b.x - box.x) < 0.5 and @abs(b.y - box.y) < 0.5 and @abs(b.w - box.w) < 0.5 and @abs(b.h - box.h) < 0.5) return m;
+ };
+ return current;
+}
/// A mark no working window shows, `flash`ing on its pane's strip.
const Flash = struct { panel: Panel, key: u64, ink: u24, p: f32 };
@@ -1220,7 +1233,7 @@ fn stripRect(box: Rect) Rect {
/// pane fading through passes its faded one); drawn last, over its rows.
pub fn strip(panel: Panel, u: ui.Ui, box: Rect) void {
if (ui.mapping) return;
- const m = current orelse return;
+ const m = ownMap(panel, u.at, box) orelse return;
const f = u.f;
if (looking(f)) return;
const slot = slotOf(panel) orelse return;