summaryrefslogtreecommitdiff
path: root/2d/window.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-09-02 09:06:36 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-09-06 00:09:29 -0400
commitb23e7776be3b410c0771715f5624aa6b7190bda4 (patch)
tree6a8544603fdf5852cea0564a52dcdd04d4819a6a /2d/window.scm
parentf55eda46158010a533f7d69f63caa206ba408de1 (diff)
Change window module API.
Users will no longer have to interface directly with this module. They will simply specify window parameters when creating game objects.
Diffstat (limited to '2d/window.scm')
-rw-r--r--2d/window.scm29
1 files changed, 10 insertions, 19 deletions
diff --git a/2d/window.scm b/2d/window.scm
index 9c863f6..5ff41dc 100644
--- a/2d/window.scm
+++ b/2d/window.scm
@@ -24,22 +24,21 @@
(define-module (2d window)
#:use-module (figl gl)
#:use-module ((sdl sdl) #:prefix SDL:)
+ #:use-module (2d vector2)
#:export (open-window
- close-window
- window-title
- set-window-title!))
+ close-window))
-;; Initialize everything
-(SDL:enable-unicode #t)
-(SDL:init 'everything)
-
-(define* (open-window width height #:optional #:key
- (depth 24) (title "guile-2d") (resizable #f))
+(define* (open-window title resolution fullscreen)
"Creates the game window with the specified dimensions and
initializes OpenGL state."
- (let ((flags (if resizable '(opengl resizable) 'opengl)))
+ (let ((flags (if fullscreen '(opengl fullscreen) 'opengl))
+ (width (vx resolution))
+ (height (vy resolution)))
+ ;; Initialize everything
+ (SDL:enable-unicode #t)
+ (SDL:init 'everything)
;; Open SDL window in OpenGL mode.
- (SDL:set-video-mode width height depth flags)
+ (SDL:set-video-mode width height 24 flags)
(SDL:set-caption title)
;; Initialize OpenGL orthographic view
(gl-viewport 0 0 width height)
@@ -58,11 +57,3 @@ initializes OpenGL state."
"Closes the game window and cleans up. This procedure is typically
called just before calling (quit)."
(SDL:quit))
-
-(define (window-title)
- "Returns the window title string."
- (SDL:get-caption))
-
-(define (set-window-title! title)
- "Sets the window title string"
- (SDL:set-caption title))