summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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