diff options
Diffstat (limited to 'sly/game.scm')
-rw-r--r-- | sly/game.scm | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sly/game.scm b/sly/game.scm index b114ada..5f1a1ec 100644 --- a/sly/game.scm +++ b/sly/game.scm @@ -26,7 +26,8 @@ #:use-module (srfi srfi-9) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) - #:use-module ((sdl sdl) #:prefix SDL:) + #:use-module (sdl2) + #:use-module ((sdl2 video) #:prefix sdl2:) #:use-module (gl) #:use-module (sly agenda) #:use-module (sly event) @@ -84,7 +85,7 @@ instead of becoming completely unresponsive and possibly crashing." (gl-clear (clear-buffer-mask color-buffer depth-buffer)) (run-hook draw-hook dt alpha) (with-graphics gfx ((signal-ref scene) gfx)) - (SDL:gl-swap-buffers)) + (swap-window)) (define (update lag) "Call the update callback. The update callback will be called as @@ -108,7 +109,7 @@ leftover frame time LAG." (define (frame-sleep time) "Sleep for the remainder of the frame that started at TIME." (let ((t (- (+ time frame-interval) - (SDL:get-ticks)))) + (sdl-ticks)))) (usleep (max 0 (* t 1000))))) (define (process-frame previous-time lag) @@ -117,7 +118,7 @@ PREVIOUS-TIME to the current time, and updating using a game tick accumulator initialized to LAG. Returns a timestamp to be used as the starting point of the next delta time calculation and the leftover time in the game tick accumulator." - (let* ((current-time (SDL:get-ticks)) + (let* ((current-time (sdl-ticks)) (dt (- current-time previous-time))) (catch #t (lambda () @@ -134,7 +135,7 @@ time in the game tick accumulator." (run-hook after-game-loop-error-hook) ;; An unknown amount of time has passed since running the ;; hook, so let's start with a fresh timer. - (values (SDL:get-ticks) 0)))) + (values (sdl-ticks) 0)))) (lambda (key . args) ;; Strip out 3 stack frames to get to the frame where the ;; error happened. The stripped frames include the throw @@ -156,7 +157,7 @@ milliseconds of the last iteration of the game loop." (lambda (signum) (stop-game-loop))) ;; Let's play! - (game-loop (SDL:get-ticks) 0)) + (game-loop (sdl-ticks) 0)) (lambda (cont callback) (when (procedure? callback) (callback cont)))))) |