summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2020-12-15 17:59:09 -0500
committerDavid Thompson <dthompson2@worcester.edu>2020-12-15 17:59:09 -0500
commit8726cc42e3e7e5e6f34f7328898e35ed207bfb08 (patch)
treef2599a60f404b086c1054befa07106c3f6d1320d /chickadee.scm
parent11cf5c63610e8bb858fa21ecea37196d9c8f17e4 (diff)
Switch to high resolution timer.
Diffstat (limited to 'chickadee.scm')
-rw-r--r--chickadee.scm9
1 files changed, 5 insertions, 4 deletions
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)