From f8bc128e71751443550965141789cdc7c17add0e Mon Sep 17 00:00:00 2001 From: rodri Date: Sat, 3 Feb 2024 14:33:56 +0000 Subject: issue screen redrawings at a fixed step. --- main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index adb3e14..bb9937f 100644 --- a/main.c +++ b/main.c @@ -321,11 +321,18 @@ redraw(void) void drawproc(void *) { + uvlong t0, Δt; + threadsetname("drawproc"); + t0 = nsec(); for(;;){ shootcamera(maincam, model, modeltex, shader); - nbsend(drawc, nil); + Δt = nsec() - t0; + if(Δt > HZ2MS(60)*1000000ULL){ + nbsend(drawc, nil); + t0 += Δt; + } } } -- cgit v1.2.3