ref: f8bc128e71751443550965141789cdc7c17add0e
parent: 1aacac5b602d1f09b9b8ae74ca02a8060b75c406
author: rodri <rgl@antares-labs.eu>
date: Sat Feb 3 09:33:56 EST 2024
issue screen redrawings at a fixed step.
--- a/main.c
+++ b/main.c
@@ -321,11 +321,18 @@
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;
+ }
}
}