summaryrefslogtreecommitdiff
path: root/anim/src/root.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/root.zig')
-rw-r--r--anim/src/root.zig30
1 files changed, 29 insertions, 1 deletions
diff --git a/anim/src/root.zig b/anim/src/root.zig
index d68b99c..d8c2c76 100644
--- a/anim/src/root.zig
+++ b/anim/src/root.zig
@@ -44,6 +44,7 @@ const tying = @import("ties.zig");
pub const Ties = tying.Ties;
pub const Place = tying.Place;
pub const Array = @import("array.zig").Array;
+pub const Loupe = @import("loupe.zig").Loupe;
pub const syscalls = @import("syscalls.zig");
pub const Crossing = syscalls.Crossing;
pub const Timeline = syscalls.Timeline;
@@ -206,8 +207,13 @@ pub const Camera = struct {
/// the program column (the whole source in a window, the disassembly at
/// the pc), the ties between them, and the clock. A scene adds its lens in
/// the band (`stage`): a lens is never shown instead of the machine.
+pub const map = @import("map.zig");
+
pub const Context = struct {
stage: *Stage,
+ /// The working frame unfolded (`map.Map`): its panels, on a stage of its
+ /// own; drawn small as the minimap. A lens adds its drawing with `map.add`.
+ map: *map.Map,
clock: anim.Obj,
source: anim.Obj,
disasm: anim.Obj,
@@ -259,8 +265,17 @@ pub fn context(s: *anim.Frame, cursor_: Cursor, options: Context.Options) Contex
const stage = Stage.init(s, options.split);
var at = cursor_;
at.levels.crossings = options.syscalls;
+ // The map first: while it fills the frame or falls to the minimap it is under the panels diving out of it.
+ const whole = s.new(map.Map{ .stage = Stage.init(s, map.split(at.rec, options.split.band.h > 0)), .frame = stage, .t = s.value(map.diving.land + map.diving.still) });
+ whole.obj = s.custom(whole, .{ .x = -640, .y = -360, .scale = ui.scale });
+ whole.add(s, Source{ .cursor = at, .stage = whole.stage });
+ whole.add(s, Disasm{ .cursor = at, .stage = whole.stage });
+ whole.add(s, Registers{ .cursor = at, .stage = whole.stage, .syscalls = options.syscalls, .quiet = options.quiet });
+ whole.add(s, Stack{ .cursor = at, .stage = whole.stage, .above = theme.map.stack_above });
+ whole.add(s, Backtrace{ .cursor = at, .stage = whole.stage });
return .{
.stage = stage,
+ .map = whole,
.cursor = at,
.quiet = options.quiet,
.source = add(s, Source{ .cursor = at, .stage = stage }),
@@ -268,7 +283,7 @@ pub fn context(s: *anim.Frame, cursor_: Cursor, options: Context.Options) Contex
.registers = add(s, Registers{ .cursor = at, .stage = stage, .syscalls = options.syscalls, .quiet = options.quiet }),
.stack = add(s, Stack{ .cursor = at, .stage = stage }),
.backtrace = add(s, Backtrace{ .cursor = at, .stage = stage, .lens = options.backtrace }),
- .clock = add(s, Clock{ .cursor = at }),
+ .clock = add(s, Clock{ .cursor = at, .map = whole }),
};
}
@@ -295,6 +310,17 @@ pub fn crossing(s: *anim.Frame, options: Crossing) anim.Obj {
pub fn timeline(s: *anim.Frame, options: Timeline) anim.Obj {
return add(s, options);
}
+/// A `loupe`, shut until its `open`: add it after the panels and the lens,
+/// a deeper one after the loupe it hangs from, and the ties after them.
+pub fn loupe(s: *anim.Frame, options: Loupe) *Loupe {
+ var l = options;
+ l.opening = s.value(0);
+ l.closing = s.value(0);
+ const made = s.new(l);
+ const o = s.custom(made, .{ .x = -640, .y = -360, .scale = ui.scale });
+ s.play(.{o.fadeIn()}, .{ .seconds = 0 });
+ return made;
+}
pub fn caption(s: *anim.Frame, text: []const u8) anim.Obj {
return add(s, Caption{ .text = text });
}
@@ -323,6 +349,8 @@ test {
_ = calls;
_ = @import("nodes.zig");
_ = @import("array.zig");
+ _ = @import("loupe.zig");
+ _ = map;
_ = @import("syscalls.zig");
_ = objects;
_ = words;