From 661912a01d1833f9944950360fc653c12fc03992 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 16 Jun 2013 13:16:25 -0400 Subject: Can't use SDL:get-ticks before SDL is initialized. --- 2d/game-loop.scm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to '2d') diff --git a/2d/game-loop.scm b/2d/game-loop.scm index 3182d04..4b097ce 100644 --- a/2d/game-loop.scm +++ b/2d/game-loop.scm @@ -89,7 +89,7 @@ (SDL:gl-swap-buffers)) (define accumulate-fps - (let ((last-time (SDL:get-ticks)) + (let ((last-time 0) (fps 0)) (lambda () "Calculates frames per second." @@ -101,17 +101,17 @@ (set! fps 0)))))) (define update-and-render - (let ((last-update (SDL:get-ticks)) + (let ((last-update 0) (update-interval (/ 1000 target-fps))) (lambda () "Calls update and draw callback when enough time has passed since the last tick." (let ((time (SDL:get-ticks))) (when (>= time (+ last-update update-interval)) - (set! last-update time) - (update-callback) - (accumulate-fps) - (render)))))) + (set! last-update time) + (update-callback) + (accumulate-fps) + (render)))))) ;;; ;;; Game Loop -- cgit v1.2.3