diff --git a/examples/continuous.zig b/examples/continuous.zig index 965c194..800a86c 100644 --- a/examples/continuous.zig +++ b/examples/continuous.zig @@ -176,7 +176,7 @@ pub fn main() !void { if (now_ms >= next_frame_ms) { next_frame_ms = now_ms + tick_ms; } else { - time.sleep((next_frame_ms - now_ms) * time.ns_per_ms); + std.Thread.sleep((next_frame_ms - now_ms) * time.ns_per_ms); next_frame_ms += tick_ms; } diff --git a/examples/elements/progress.zig b/examples/elements/progress.zig index bc36cf3..e4026bb 100644 --- a/examples/elements/progress.zig +++ b/examples/elements/progress.zig @@ -67,7 +67,7 @@ pub fn main() !void { if (now_ms >= next_frame_ms) { next_frame_ms = now_ms + tick_ms; } else { - time.sleep((next_frame_ms - now_ms) * time.ns_per_ms); + std.Thread.sleep((next_frame_ms - now_ms) * time.ns_per_ms); next_frame_ms += tick_ms; } diff --git a/src/app.zig b/src/app.zig index 3fcaa68..1ff5035 100644 --- a/src/app.zig +++ b/src/app.zig @@ -33,7 +33,7 @@ pub fn App(comptime E: type) type { // global variable for the registered handler for WINCH var handler_ctx: *anyopaque = undefined; /// registered WINCH handler to report resize events - fn handleWinch(_: c_int) callconv(.C) void { + fn handleWinch(_: c_int) callconv(.c) void { const this: *@This() = @ptrCast(@alignCast(handler_ctx)); // NOTE this does not have to be done if in-band resize events are supported // -> the signal might not work correctly when hosting the application over ssh! diff --git a/src/terminal.zig b/src/terminal.zig index 2a02a6d..751326c 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -62,19 +62,18 @@ pub fn write(buf: []const u8) !usize { return try posix.write(posix.STDIN_FILENO, buf); } -fn contextWrite(context: @This(), data: []const u8) anyerror!usize { +fn contextWrite(context: *const anyopaque, data: []const u8) anyerror!usize { _ = context; return try posix.write(posix.STDOUT_FILENO, data); } -const Writer = std.io.Writer( - @This(), - anyerror, - contextWrite, -); +const Writer = std.io.AnyWriter; pub fn writer() Writer { - return .{ .context = .{} }; + return .{ + .context = &.{}, + .writeFn = contextWrite, + }; } pub fn setCursorPosition(pos: Point) !void {