From b23e7776be3b410c0771715f5624aa6b7190bda4 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 2 Sep 2013 09:06:36 -0400 Subject: 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. --- 2d/window.scm | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to '2d') 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)) -- cgit v1.2.3