From 8726cc42e3e7e5e6f34f7328898e35ed207bfb08 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 15 Dec 2020 17:59:09 -0500 Subject: Switch to high resolution timer. --- examples/particles.scm | 2 +- examples/path.scm | 6 +++--- examples/sprite-batch.scm | 2 +- examples/tiled.scm | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/particles.scm b/examples/particles.scm index 97cdb1d..abefd94 100644 --- a/examples/particles.scm +++ b/examples/particles.scm @@ -49,7 +49,7 @@ (sleep 60) (set! stats-text (format #f "particles: ~d fps: ~1,2f" (particles-size particles) - (/ 1000.0 avg-frame-time)))))) + (/ 1.0 avg-frame-time)))))) (define stats-text-pos (vec2 4.0 (- window-height 16.0))) (define sprite-position (vec2 (center-x 128.0) (center-y 128.0))) diff --git a/examples/path.scm b/examples/path.scm index 0223864..7bad91b 100644 --- a/examples/path.scm +++ b/examples/path.scm @@ -10,9 +10,9 @@ (define (stats-message) (format #f "fps: ~1,2f" - (/ 1000.0 avg-frame-time))) + (/ 1.0 avg-frame-time))) (define start-time 0.0) -(define avg-frame-time 16) +(define avg-frame-time 0.0) (define stats-text (stats-message)) (define stats-text-pos (vec2 4.0 464.0)) (define last-update start-time) @@ -67,7 +67,7 @@ (+ (* (- current-time start-time) 0.1) (* avg-frame-time 0.9))) (set! start-time current-time) - (when (>= (- current-time last-update) 1000) + (when (>= (- current-time last-update) 1.0) (set! stats-text (stats-message)) (set! last-update current-time)))) diff --git a/examples/sprite-batch.scm b/examples/sprite-batch.scm index 4b8d433..3aad219 100644 --- a/examples/sprite-batch.scm +++ b/examples/sprite-batch.scm @@ -31,7 +31,7 @@ (define (stats-message) (format #f "sprites: ~d fps: ~1,2f" num-sprites - (/ 1000.0 avg-frame-time))) + (/ 1.0 avg-frame-time))) (define stats-text (stats-message)) diff --git a/examples/tiled.scm b/examples/tiled.scm index 0f7c4fa..c528f74 100644 --- a/examples/tiled.scm +++ b/examples/tiled.scm @@ -16,7 +16,7 @@ (define text "0, 0") (define (stats-message) (format #f "fps: ~1,2f" - (/ 1000.0 avg-frame-time))) + (/ 1.0 avg-frame-time))) (define start-time 0.0) (define avg-frame-time 16) (define stats-text (stats-message)) -- cgit v1.2.3