diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-16 21:28:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-16 21:28:20 -0300 |
| commit | 6933f99ddb2d7103515d26838496309a807bba26 (patch) | |
| tree | 991c2fe7d4a57957222876e190fa4d16a0fb889c /README.md | |
| parent | 82fca5c9f29124f37f6dcd08e73e6999ce44a69d (diff) | |
| download | sketchbook-6933f99ddb2d7103515d26838496309a807bba26.tar.gz sketchbook-6933f99ddb2d7103515d26838496309a807bba26.zip | |
Move standalone sketches into sketchbook examples
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -22,6 +22,18 @@ pub fn draw(s: *const State, f: *sk.Frame) void { } ``` +## Examples + +The standalone example packages live in [`examples/`](examples/): + +- [`noc`](examples/noc/): 21 Nature of Code sketches. Select one with `-Dsketch=flocking`. +- [`shaders`](examples/shaders/): five shader examples in both Zig and GLSL. +- [`vecanim`](examples/vecanim/): vector animation scenes. Select one with `-Dscene=scenes/live.zig`. + +Run `zig build run` inside a package, with `zig build lib --watch` in a second +terminal for hot reload. `zig build test` runs its headless checks; +`zig build web` builds the selected example for the browser. + ## An app An app is an ordinary module. Every declaration is optional: @@ -371,7 +383,7 @@ cases, by who needs the data: document): Store. The timeline then needs nothing more: a seek changes the key like an -update does (`sketches/noc`: `koch`, `lsystem`, `quadtree`). +update does (`examples/noc`: `koch`, `lsystem`, `quadtree`). **Sound scopes**, in the `scope` module (import `sb.modules.scope`): a `scope.Scope` kept in Session takes samples with `push` and, once a frame, @@ -771,8 +783,8 @@ and Zig shaders all reach the second library. The script plays, checks State, runs `load {v2}`, checks the same State, and compares screenshots (`expect-different-screenshot a.png b.png [x y w h]`). Pausing a replay first (`record`, `play`, `pause`) keeps the State still, so the two -screenshots differ only by the edit. `sketches/shaders` and -`sketches/noc` (bouncing_ball) have one each. +screenshots differ only by the edit. `examples/shaders` and +`examples/noc` (bouncing_ball) have one each. Shaders: @@ -812,7 +824,7 @@ and naga's reader does not; and naga translates the result for the web as for GLSL. Shader code cannot use table-driven `std.math` (`atan2`: call GLSL.std.450 through inline assembly), and a uniform struct shared with the CPU needs a vec2 that is `@Vector(2, f32)` only on SPIR-V and `[2]f32` -elsewhere. `sketches/shaders` has five Book of Shaders examples in both +elsewhere. `examples/shaders` has five Book of Shaders examples in both languages. Tools: `glslc` (shaderc, or the Vulkan SDK's) for shaders, for web builds |
