fix: examples should now have correct game loop structure with accumulator

This commit is contained in:
2026-04-11 21:27:36 -04:00
parent 5aaecdeac6
commit a3728bed78
2 changed files with 13 additions and 19 deletions
+5 -5
View File
@@ -13,9 +13,7 @@ static void on_signal(void) { running = 0; }
int main(int argc, char *argv[])
{
skele_video_config_t video_cfg;
uint64_t last;
uint64_t now;
uint64_t elapsed;
uint64_t last, now, elapsed, accum = 0;
skele_clock_init(on_signal);
@@ -49,10 +47,12 @@ int main(int argc, char *argv[])
now = skele_time_ns();
elapsed = now - last;
accum += elapsed;
last = now;
if (elapsed >= skele_tick_ns) {
while (accum >= skele_tick_ns) {
skele_tick();
last = now;
accum -= skele_tick_ns;
}
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);