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. --- chickadee.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'chickadee.scm') diff --git a/chickadee.scm b/chickadee.scm index e00b2b1..611674a 100644 --- a/chickadee.scm +++ b/chickadee.scm @@ -77,10 +77,11 @@ run-game) #:re-export (abort-game)) +(define %time-freq (exact->inexact (sdl-performance-frequency))) + (define (elapsed-time) - "Return the number of milliseconds that have passed since the game -loop was started." - (sdl-ticks)) + "Return the current value of the system timer in seconds." + (/ (sdl-performance-counter) %time-freq)) (define (key-pressed? key) "Return #t if KEY is currently being pressed." @@ -390,7 +391,7 @@ border is disabled, otherwise it is enabled.") (run-game* #:update update-sdl #:render render-sdl-opengl #:error error - #:time sdl-ticks + #:time elapsed-time #:update-hz update-hz))) (lambda () (quit-audio) -- cgit v1.2.3