summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2013-07-17 19:09:24 -0400
committerDavid Thompson <dthompson2@worcester.edu>2013-07-17 19:09:24 -0400
commitc1a07c0d2692499e3a6a049ed26967271a83d801 (patch)
tree2b37caa22775c219aeaf7434de9dfe11ed1df96c
parent9d8fa39f051dcf079cfeb3209efb53a34ca7f52e (diff)
Move initialization to it's own procedure.
-rw-r--r--2d/window.scm18
1 files changed, 12 insertions, 6 deletions
diff --git a/2d/window.scm b/2d/window.scm
index 5675910..f3ce293 100644
--- a/2d/window.scm
+++ b/2d/window.scm
@@ -24,17 +24,23 @@
(define-module (2d window)
#:use-module (figl gl)
#:use-module ((sdl sdl) #:prefix SDL:)
- #:export (open-window
+ #:export (init-2d
+ open-window
close-window))
-(define* (open-window width height #:optional (depth 24))
+(define (init-2d)
+ "Initializes guile-2d. This procedure must be called before using
+the rest of the framework."
+ (SDL:init '(SDL_INIT_EVERYTHING))
+ ;; Enable unicode key events
+ (SDL:enable-unicode #t))
+
+(define* (open-window width height #:optional #:key (depth 24) (title "guile-2d"))
"Creates the game window with the specified dimensions and
initializes OpenGL state."
- (SDL:init '(SDL_INIT_VIDEO))
- ;; Enable unicode key events
- (SDL:enable-unicode #t)
;; Open SDL window in OpenGL mode.
- (SDL:set-video-mode width height 24 '(SDL_OPENGL))
+ (SDL:set-video-mode width height depth '(SDL_OPENGL))
+ (SDL:set-caption title)
;; Initialize OpenGL orthographic view
(gl-viewport 0 0 width height)
(set-gl-matrix-mode (matrix-mode projection))