summaryrefslogtreecommitdiff
path: root/src/host/Console.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-25 21:53:00 -0300
committerGabriel Schneider <[email protected]>2026-09-25 21:54:39 -0300
commit2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702 (patch)
tree32a8bbb55226721834fd5675e7bafc163508dd1e /src/host/Console.zig
parent50f4ee716aeafa13118cbcfa0f5cb37f7d3940a4 (diff)
downloadsketchbook-2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702.tar.gz
sketchbook-2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702.zip
sketchbook: what the game's review needed
- input.started: true on the first update of a run, never after a reload, for a sketch to stop what should not resume from saved state. - A console line that errors fails its script. Sketch commands answer unknown, done or failed (abi.Outcome) instead of a bool that hid errors. - addScript also takes the hot-reloadable library, run through the generic host, so scripts can reload a real build. - Sounds that do not load are .none, not an empty clip. - sk_tag reads an enum field's tag name from the web build, for tests.
Diffstat (limited to 'src/host/Console.zig')
-rw-r--r--src/host/Console.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/host/Console.zig b/src/host/Console.zig
index d9aa469..e6be2f0 100644
--- a/src/host/Console.zig
+++ b/src/host/Console.zig
@@ -135,7 +135,7 @@ pub fn execute(self: *Console, host: *Host, line: []const u8, now: u64) ![]const
if (eq(command, "help")) {
self.log("save|load [1..7] snapshot N | record|play [0..15] recording N | stop | pause | step N | seek start|end|<ms>");
self.log("diff [N] | reset | get <field> | set <field> <value> | overlay memory|sound | quit");
- if (!host.forward(self, line, now)) self.log("Backtick hides the console. Tab completes.");
+ if (host.forward(self, line, now) == .unknown) self.log("Backtick hides the console. Tab completes.");
return &.{};
}
if (eq(command, "overlay")) {
@@ -210,7 +210,11 @@ pub fn execute(self: *Console, host: *Host, line: []const u8, now: u64) ![]const
} else {
// Sketch commands edit state outside the recorded input.
h.stop(now);
- if (!host.forward(self, line, now)) return error.UnknownCommand;
+ switch (host.forward(self, line, now)) {
+ .unknown => return error.UnknownCommand,
+ .failed => return error.CommandFailed,
+ .done => {},
+ }
}
return &.{};
}