diff options
Diffstat (limited to 'src/sketch/root.zig')
| -rw-r--r-- | src/sketch/root.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sketch/root.zig b/src/sketch/root.zig index 01aa977..81ebad5 100644 --- a/src/sketch/root.zig +++ b/src/sketch/root.zig @@ -152,6 +152,14 @@ pub const Frame = struct { pub fn textIn(f: *Frame, face: Face, x: f32, y: f32, scale: f32, bytes: []const u8, color: anytype) void { f.emit(.{ .text = .{ .x = x, .y = y, .scale = scale, .color = paint(color), .bytes = f.keep(u8, bytes), .face = face } }); } + /// `textIn` laid out and rasterized at `raster` and drawn at `scale`, + /// its position not snapped to a pixel: for text under a moving + /// camera. Rasterize at the scale the move ends on (or the larger of + /// its two ends): the letters keep their places against each other + /// all the way, and one texture serves every frame of the move. + pub fn textScaled(f: *Frame, face: Face, x: f32, y: f32, scale: f32, raster: f32, bytes: []const u8, color: anytype) void { + f.emit(.{ .text = .{ .x = x, .y = y, .scale = scale, .color = paint(color), .bytes = f.keep(u8, bytes), .face = face, .raster = raster } }); + } pub fn print(f: *Frame, x: f32, y: f32, scale: f32, color: anytype, comptime fmt: []const u8, args: anytype) void { f.emit(.{ .text = .{ .x = x, .y = y, .scale = scale, .color = paint(color), .bytes = f.format(fmt, args) } }); } |
