diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-16 22:51:49 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 64a816dbe194c05e089729ac1fdc15061afdd903 (patch) | |
| tree | 5b424f1eee653a5c607a41262a04bf843c262054 /build.zig | |
| parent | 1cb36ee39a8bbc2cf61c28003670d760841d6d3e (diff) | |
| download | sketchbook-64a816dbe194c05e089729ac1fdc15061afdd903.tar.gz sketchbook-64a816dbe194c05e089729ac1fdc15061afdd903.zip | |
anim: talks: gates that let time run on, pause, beside, loop, clear, slides and the Deck
A talk is a live scene re-run from the top every frame, a function of its
time and of the gates opened so far. Frame.gate(open) waits while time runs
on and records the value it opened with; pause() is the presenter's click.
beside and loop are the sub-animations, slide() the second navigation
level, clear() the end of a slide. anim.Deck is the playhead and the gate
log as plain data for any sketch's State: update() takes an Ask (next,
back, next_slide, back_slide, to, end) and runs the talk with the app
mutable, shot() runs it read-only for drawing. A click during a step
finishes it; back cuts to the picture held before the last click; an edit
that moves the last opened gate moves t with it; exported, every gate
holds Deck.hold. Live takes a namespace or a tuple of them (sources) and
exposes frame. Builder.pause, Instant.clock and Frame.clock are gone: t
runs through gates. A test-anim step runs the module's tests and the
player's scenes.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -164,13 +164,17 @@ pub fn build(b: *Build) void { for ([_]*Build.Module{ b.createModule(.{ .root_source_file = b.path("src/vector/root.zig"), .target = target, .optimize = optimize, .imports = vector_imports }), b.createModule(.{ .root_source_file = b.path("src/scope/root.zig"), .target = target, .optimize = optimize, .imports = scope_imports }), - b.createModule(.{ .root_source_file = b.path("src/anim/root.zig"), .target = target, .optimize = optimize, .imports = anim_imports }), b.createModule(.{ .root_source_file = b.path("src/glsl.zig"), .target = target, .optimize = optimize }), b.createModule(.{ .root_source_file = b.path("src/abi.zig"), .target = target, .optimize = optimize }), b.createModule(.{ .root_source_file = b.path("src/sketch/root.zig"), .target = target, .optimize = optimize, .imports = sketch_imports }), b.createModule(.{ .root_source_file = b.path("src/math/root.zig"), .target = target, .optimize = optimize }), b.createModule(.{ .root_source_file = b.path("src/host/root.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "abi", .module = abi }, .{ .name = "c", .module = c }, .{ .name = "gpu", .module = gpu }, .{ .name = "tracy", .module = tracy }, .{ .name = "cloud9", .module = cloud9 } } }), }) |module| test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = module })).step); + // The anim module alone: its unit tests, and below the player's scenes. + const test_anim = b.step("test-anim", "Test the anim module: its unit tests and the player on its test scenes"); + const anim_tests = b.addRunArtifact(b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path("src/anim/root.zig"), .target = target, .optimize = optimize, .imports = anim_imports }) })); + test_anim.dependOn(&anim_tests.step); + test_step.dependOn(&anim_tests.step); // The noise tests again on wasm32 as the web builds it, under Node's // WASI: the golden bits must come out the same in the browser as @@ -234,13 +238,16 @@ pub fn build(b: *Build) void { // custom object between vector objects, and a compiled one, which is // also exported, at half size. const live = sb.addScene(.{ .root_source_file = b.path("test/scene_live.zig") }); - test_step.dependOn(&live.app.addScript(live.app.addExecutable(), b.path("test/scene_live.script"), .{}).step); + const live_script = live.app.addScript(live.app.addExecutable(), b.path("test/scene_live.script"), .{}); + test_step.dependOn(&live_script.step); + test_anim.dependOn(&live_script.step); const compiled = sb.addScene(.{ .root_source_file = b.path("test/scene_compiled.zig") }); const compiled_exe = compiled.app.addExecutable(); const compiled_script = compiled.app.addScript(compiled_exe, b.path("test/scene_compiled.script"), .{}); compiled_script.addArg("--define"); compiled_script.addPrefixedDirectoryArg("frames=", compiled.app.addExport(compiled_exe, .{ .fps = 30, .size = .{ 640, 360 }, .frames = 200 }).frames); test_step.dependOn(&compiled_script.step); + test_anim.dependOn(&compiled_script.step); // Both vector renderers against resvg, through the host (tools/svgdiff.py). const svgview = sb.app(.{ .name = "svgview", .root_source_file = b.path("test/svgview.zig"), .imports = &.{.{ .name = "vector", .module = sb.modules.vector }} }); |
