diff options
author | rodri <rgl@antares-labs.eu> | 2024-02-03 14:33:56 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-02-03 14:33:56 +0000 |
commit | f8bc128e71751443550965141789cdc7c17add0e (patch) | |
tree | 66e479020b194d460ba3ee05c96ccdfef8dfec4f | |
parent | 1aacac5b602d1f09b9b8ae74ca02a8060b75c406 (diff) | |
download | 3dee-f8bc128e71751443550965141789cdc7c17add0e.tar.gz 3dee-f8bc128e71751443550965141789cdc7c17add0e.tar.bz2 3dee-f8bc128e71751443550965141789cdc7c17add0e.zip |
issue screen redrawings at a fixed step.
-rw-r--r-- | main.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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; + } } } |