+
+(define (close-window)
+ (sdl2:hide-window! %sdl-window)
+ (sdl2:sdl-quit))
+
+(define (resize-window width height)
+ (gl-viewport 0 0 width height)
+ (set-gl-matrix-mode (matrix-mode projection))
+ (gl-load-identity)
+ (let ((w (/ width 2))
+ (h (/ height 2)))
+ (gl-ortho (- w) w (- h) h 0 1))
+ (set-gl-matrix-mode (matrix-mode modelview))
+ (gl-clear (clear-buffer-mask color-buffer depth-buffer))
+ (gl-load-identity))
+
+(define* (start-game scene #:key
+ (title "Untitled")
+ (resolution '(640 480))
+ (fullscreen? #f)
+ (when-quit (lambda () (stop-game))))
+ (init-window)
+ (open-window title resolution fullscreen?)
+ (run-game-loop scene #:when-quit when-quit)
+ (close-window))
+
+(define (stop-game)
+ (stop-game-loop))