summaryrefslogtreecommitdiff
path: root/sdl2
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2016-01-09 08:47:39 -0500
committerDavid Thompson <dthompson2@worcester.edu>2016-01-09 08:47:39 -0500
commit65c8e4d0b0ec62f6d9bc4ea5618535ed13b2101b (patch)
treeca8545f85511f5260ce857e43e1ae00570b5c087 /sdl2
parent20524b26a638983d2d6dea80b6ea772cbecd944c (diff)
video: Add SDL_SetWindowFullscreen binding.
* sdl2/bindings.scm (sdl-set-window-fullscreen): New procedure. * sdl2/video.scm (set-window-fullscreen!): New procedure.
Diffstat (limited to 'sdl2')
-rw-r--r--sdl2/bindings.scm3
-rw-r--r--sdl2/video.scm15
2 files changed, 18 insertions, 0 deletions
diff --git a/sdl2/bindings.scm b/sdl2/bindings.scm
index b6f9431..e394586 100644
--- a/sdl2/bindings.scm
+++ b/sdl2/bindings.scm
@@ -165,6 +165,9 @@ RETURN-TYPE and accept arguments of ARG-TYPES."
(define-foreign sdl-set-window-size
void "SDL_SetWindowSize" (list '* int int))
+(define-foreign sdl-set-window-fullscreen
+ int "SDL_SetWindowFullscreen" (list '* uint32))
+
(define-foreign sdl-gl-create-context
'* "SDL_GL_CreateContext" '(*))
diff --git a/sdl2/video.scm b/sdl2/video.scm
index 8340308..187a5bc 100644
--- a/sdl2/video.scm
+++ b/sdl2/video.scm
@@ -50,6 +50,7 @@
set-window-title!
set-window-position!
set-window-size!
+ set-window-fullscreen!
make-gl-context
gl-context?
@@ -230,6 +231,20 @@ of (width,height) coordinates measured in pixels."
((width height)
(ffi:sdl-set-window-size (unwrap-window window) width height))))
+(define* (set-window-fullscreen! window fullscreen? #:key desktop?)
+ "Toggle fullscreen mode on/off for WINDOW. If FULLSCREEN?,
+fullscreen mode is activated, otherwise it is deactivated. If
+FULLSCREEN? and DESKTOP?, a special \"fake\" fullscreen mode is used
+that takes the size of the desktop."
+ (let ((flag (cond
+ ((and fullscreen? desktop?)
+ ffi:SDL_WINDOW_FULLSCREEN_DESKTOP)
+ (fullscreen?
+ ffi:SDL_WINDOW_FULLSCREEN)
+ (else 0))))
+ (unless (zero? (ffi:sdl-set-window-fullscreen (unwrap-window window) flag))
+ (sdl-error "set-window-fullscreen!" "failed to change fullscreen mode"))))
+
;;;
;;; OpenGL