summaryrefslogtreecommitdiff
path: root/2d/window.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2013-07-21 22:43:54 -0400
committerDavid Thompson <dthompson2@worcester.edu>2013-07-21 22:43:54 -0400
commit3678af541ed14fe679b1e22f7c07c8bfec9c8265 (patch)
tree454b7e53d24cc4239cc7335fd171e65801ede481 /2d/window.scm
parent5ba6eaff39f79ebd8c843b801fde7752e48aca26 (diff)
Add optional resizable paramter to open-window.
Diffstat (limited to '2d/window.scm')
-rw-r--r--2d/window.scm34
1 files changed, 18 insertions, 16 deletions
diff --git a/2d/window.scm b/2d/window.scm
index 5f82df1..334e709 100644
--- a/2d/window.scm
+++ b/2d/window.scm
@@ -37,24 +37,26 @@ the rest of the framework."
;; Enable unicode key events
(SDL:enable-unicode #t))
-(define* (open-window width height #:optional #:key (depth 24) (title "guile-2d"))
+(define* (open-window width height #:optional #:key
+ (depth 24) (title "guile-2d") (resizable #f))
"Creates the game window with the specified dimensions and
initializes OpenGL state."
- ;; Open SDL window in OpenGL mode.
- (SDL:set-video-mode width height depth 'opengl)
- (SDL:set-caption title)
- ;; Initialize OpenGL orthographic view
- (gl-viewport 0 0 width height)
- (set-gl-matrix-mode (matrix-mode projection))
- (gl-load-identity)
- (gl-ortho 0 width height 0 -1 1)
- (set-gl-matrix-mode (matrix-mode modelview))
- (gl-load-identity)
- ;; Enable texturing and alpha blending
- (gl-enable (enable-cap texture-2d))
- (gl-enable (enable-cap blend))
- (set-gl-blend-function (blending-factor-src src-alpha)
- (blending-factor-dest one-minus-src-alpha)))
+ (let ((flags (if resizable '(opengl resizable) 'opengl)))
+ ;; Open SDL window in OpenGL mode.
+ (SDL:set-video-mode width height depth flags)
+ (SDL:set-caption title)
+ ;; Initialize OpenGL orthographic view
+ (gl-viewport 0 0 width height)
+ (set-gl-matrix-mode (matrix-mode projection))
+ (gl-load-identity)
+ (gl-ortho 0 width height 0 -1 1)
+ (set-gl-matrix-mode (matrix-mode modelview))
+ (gl-load-identity)
+ ;; Enable texturing and alpha blending
+ (gl-enable (enable-cap texture-2d))
+ (gl-enable (enable-cap blend))
+ (set-gl-blend-function (blending-factor-src src-alpha)
+ (blending-factor-dest one-minus-src-alpha))))
(define (close-window)
"Closes the game window and cleans up. This procedure is typically