(define *bpp-screen* 32)
(define *frames-per-second* 20)
(define *mode* '2d)
+(define *fullscreen* 'off)
-(define* (set-game-properties! #:key title width height bpp fps mode)
+(define* (set-game-properties! #:key title width height bpp fps mode fullscreen)
(if title
(set-screen-title! title))
(if bpp
(set-frames-per-second! fps))
(if mode
(if (eq? mode '3d) (set-3d-mode) (set-2d-mode)))
+ (if fullscreen
+ (set-fullscreen! fullscreen))
(get-game-properties))
(define (get-game-properties)
- `((title . ,(get-screen-title)) (width . ,(get-screen-width)) (height . ,(get-screen-height)) (bpp . ,(get-screen-bpp)) (fps . ,(get-frames-per-second)) (mode . ,(if (3d-mode?) '3d '2d))))
+ `((title . ,(get-screen-title)) (width . ,(get-screen-width)) (height . ,(get-screen-height)) (bpp . ,(get-screen-bpp)) (fps . ,(get-frames-per-second)) (mode . ,(if (3d-mode?) '3d '2d)) (fullscreen . ,(get-fullscreen))))
;;; Mobs Factory
return SCM_UNSPECIFIED;
}
+SCM
+gacela_SDL_WM_ToggleFullScreen(SCM surface)
+{
+ return scm_from_int (SDL_WM_ToggleFullScreen (get_surface_address (surface)));
+}
+
SCM
gacela_SDL_Flip (SCM screen)
{
scm_c_define_gsubr ("SDL_SetVideoMode", 4, 0, 0, gacela_SDL_SetVideoMode);
scm_c_define_gsubr ("SDL_FreeSurface", 1, 0, 0, gacela_SDL_FreeSurface);
scm_c_define_gsubr ("SDL_WM_SetCaption", 2, 0, 0, gacela_SDL_WM_SetCaption);
+ scm_c_define_gsubr ("SDL_WM_ToggleFullScreen", 1, 0, 0, gacela_SDL_WM_ToggleFullScreen);
scm_c_define_gsubr ("SDL_Flip", 1, 0, 0, gacela_SDL_Flip);
scm_c_define_gsubr ("SDL_Delay", 1, 0, 0, gacela_SDL_Delay);
scm_c_define_gsubr ("SDL_GetTicks", 0, 0, 0, gacela_SDL_GetTicks);
3d-mode?
get-frames-per-second
set-frames-per-second!
+ get-fullscreen
+ set-fullscreen!
init-frame-time
get-frame-time
delay-frame
(define screen #f)
(define flags 0)
-(define* (init-video width height bpp #:key (mode '2d) (title "") (fps 20))
+(define* (init-video width height bpp #:key (mode '2d) (title "") (fps 20) (fullscreen 'off))
(SDL_Init SDL_INIT_VIDEO)
(let ((info (SDL_GetVideoInfo)))
(SDL_GL_SetAttribute SDL_GL_DOUBLEBUFFER 1)
(set! flags (+ SDL_OPENGL SDL_GL_DOUBLEBUFFER SDL_HWPALETTE SDL_RESIZABLE
(if (= (assoc-ref info 'hw_available) 0) SDL_SWSURFACE SDL_HWSURFACE)
- (if (= (assoc-ref info 'blit_hw) 0) 0 SDL_HWACCEL)))
+ (if (= (assoc-ref info 'blit_hw) 0) 0 SDL_HWACCEL)
+ (if (eq? fullscreen 'on) SDL_FULLSCREEN 0)))
(set! screen (SDL_SetVideoMode width height bpp flags))
(set-screen-title! title)
(set-frames-per-second! fps)
+ (set-fullscreen! fullscreen #f)
(init-gl)
(if (eq? mode '3d) (set-3d-mode) (set-2d-mode))))
(define (set-screen-bpp! bpp)
(cond (screen
- (set! screen (SDL_SetVideoMode (get-screen-width) (get-screen-height) bpp flags)))))
+ (set! screen (SDL_SetVideoMode (get-screen-width) (get-screen-height) (get-screen-bpp) flags)))))
(define (resize-screen width height)
(cond (screen
(eq? mode '3d))
+(define fullscreen 'off)
+
+(define* (set-fullscreen! fs #:optional (toggle #t))
+ (cond ((or (and (eq? fullscreen 'on) (eq? fs 'off))
+ (and (eq? fullscreen 'off) (eq? fs 'on)))
+ (set! fullscreen fs)
+ (cond (toggle
+ (SDL_WM_ToggleFullScreen screen))))))
+
+(define (get-fullscreen)
+ fullscreen)
+
+
(define (init-gl)
(glShadeModel GL_SMOOTH)
(glClearColor 0 0 0 0)