diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-24 13:53:53 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-24 20:59:59 -0300 |
| commit | c07af484b6f2688a64e850562d1f804c76c5ac52 (patch) | |
| tree | cb1e553288097d5f415e67cc8040895e762a751d /src/draw.zig | |
| parent | 3b9ad2f510267d7be7280386cc95bb41a6e71308 (diff) | |
| download | pardes-c07af484b6f2688a64e850562d1f804c76c5ac52.tar.gz pardes-c07af484b6f2688a64e850562d1f804c76c5ac52.zip | |
anim 1: a game's frame probe, FrameStats: every drawn frame's update, render and present times, the gap since the last, jank and over-budget counters, in the Debug box and dumped by PARDES_FRAMES; PARDES_FRAMES_DEMO runs a scroll timedemo in the GUI
Diffstat (limited to 'src/draw.zig')
| -rw-r--r-- | src/draw.zig | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/draw.zig b/src/draw.zig index 5c1844bb..b4fc3a2c 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -742,16 +742,21 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { } const effective_font = p.settings.font.effective_name.get(); const font_name = if (effective_font.len == 0) "default" else effective_font; - var ov_buf: [256]u8 = undefined; + var ov_buf: [384]u8 = undefined; + // The probe's last second (FrameStats); under a virtual clock its + // real-time numbers would make every golden of this box differ. + var frames_buf: [96]u8 = undefined; + const virtual = !pardes.hosted or std.c.getenv("PARDES_TEST_CLOCK") != null; + const timings = if (virtual) "frame virtual clock\n" else p.frames.summary(&frames_buf); const text = std.fmt.bufPrint( &ov_buf, - "pardes resizes={d}\ntheme {s}\nfont {s}\nterms {d} cols {d}\nactive #{d} {d}x{d}\nscroll {d}/{d}\npinch {d:6.4}\ntscroll {d:7.4}", - .{ p.resize_count, p.theme().name, font_name[0..@min(font_name.len, 64)], nlive, p.ncol, p.active, at.cols, at.rows, sb_off, sb_total, p.ov_pinch_scale, p.ov_touch_scroll_delta }, + "pardes resizes={d}\ntheme {s}\nfont {s}\nterms {d} cols {d}\nactive #{d} {d}x{d}\nscroll {d}/{d}\npinch {d:6.4}\ntscroll {d:7.4}\n{s}", + .{ p.resize_count, p.theme().name, font_name[0..@min(font_name.len, 64)], nlive, p.ncol, p.active, at.cols, at.rows, sb_off, sb_total, p.ov_pinch_scale, p.ov_touch_scroll_delta, timings }, ) catch ""; // wide enough for the longest theme name compiled in, which is the // only row here whose width is not ours to choose const ow: u16 = 38; - const oh: u16 = 10; + const oh: u16 = 12; const ox: u16 = if (s.cols > ow) s.cols - ow else 0; if (ox + ow <= s.cols and p.topBarHeight() + oh <= s.rows) { s.addRegion(.{ .kind = .debug, .rect = .{ .x = ox, .y = p.topBarHeight(), .w = ow, .h = oh } }); |
