diff options
author | David Thompson <dave@izanagi> | 2013-06-16 13:16:25 -0400 |
---|---|---|
committer | David Thompson <dave@izanagi> | 2013-06-16 13:16:25 -0400 |
commit | 661912a01d1833f9944950360fc653c12fc03992 (patch) | |
tree | b0cca928ecb3a9891ff18c071367475c9bd61b25 /2d | |
parent | bb6b28fc33fcb2df6f7f903096b707c6e072cf87 (diff) |
Can't use SDL:get-ticks before SDL is initialized.
Diffstat (limited to '2d')
-rw-r--r-- | 2d/game-loop.scm | 12 |
1 files changed, 6 insertions, 6 deletions
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 |