#:use-module (ice-9 optargs)
#:export (load-texture
load-font
+ set-game-properties!
+ get-game-properties
init-gacela
quit-gacela
game-loop
render-text))
-;;; Default values for Gacela
-
-(define *title* "Gacela")
-(define *width-screen* 640)
-(define *height-screen* 480)
-(define *bpp-screen* 32)
-(define *frames-per-second* 20)
-(define *mode* '2d)
-
-
;;; Resources Cache
(define resources-cache (make-weak-value-hash-table))
;;; Game Properties
-(define set-game-properties! #f)
-(define get-game-properties #f)
-
-;; (let ((ptitle *title*) (pwidth *width-screen*) (pheight *height-screen*) (pbpp *bpp-screen*) (pfps *frames-per-second*) (pmode *mode*))
-;; (set! set-game-properties!
-;; (lambda* (#:key title width height bpp fps mode)
-;; ; (init-video-mode)
-;; (if title
-;; (begin
-;; (set! ptitle title)
-;; (if (video-mode-on?) (SDL_WM_SetCaption title ""))))
-;; (if (or width height bpp)
-;; (begin
-;; (if width (set! pwidth width))
-;; (if height (set! pheight height))
-;; (if bpp (set! pbpp bpp))
-;; (if (video-mode-on?) (resize-screen pwidth pheight pbpp))))
-;; (if fps
-;; (begin
-;; (set! pfps fps)
-;; (set-frames-per-second fps)))
-;; (if mode
-;; (begin
-;; (set! pmode mode)
-;; (if (video-mode-on?)
-;; (if (eq? mode '3d) (set-3d-mode) (set-2d-mode)))))
-;; (get-game-properties)))
-
-;; (set! get-game-properties
-;; (lambda ()
-;; `((title . ,ptitle) (width . ,pwidth) (height . ,pheight) (bpp . ,pbpp) (fps . ,pfps) (mode . ,pmode)))))
+(define title "Gacela")
+(define width-screen 640)
+(define height-screen 480)
+(define bpp-screen 32)
+(define frames-per-second 20)
+(define mode '2d)
+
+(define* (set-game-properties! #:key title width height bpp fps mode)
+ (if title
+ (set-screen-title! title))
+ (if bpp
+ (set-screen-bpp! bpp))
+ (if (or width height)
+ (begin
+ (if (not width) (set! width (get-screen-width)))
+ (if (not height) (set! height (get-screen-height)))
+ (resize-screen width height)))
+ (if fps
+ (set-frames-per-second fps))
+ (if mode
+ (if (eq? mode '3d) (set-3d-mode) (set-2d-mode)))
+ (get-game-properties))
+
+(define (get-game-properties)
+ `((title . ,(get-screen-title)) (width . ,(get-screen-width)) (height . ,(get-screen-height)) (bpp . ,(get-screen-bpp)) (fps . ,pfps) (mode . ,pmode)))
;;; Main Loop
get-screen-height
get-screen-width
get-screen-bpp
+ set-screen-bpp!
resize-screen
quit-video
clear-screen
flip-screen
+ set-screen-title!
+ get-screen-title
set-2d-mode
set-3d-mode
3d-mode?
(if (= (assoc-ref info 'hw_available) 0) SDL_SWSURFACE SDL_HWSURFACE)
(if (= (assoc-ref info 'blit_hw) 0) 0 SDL_HWACCEL)))
(set! screen (SDL_SetVideoMode width height bpp flags))
- (SDL_WM_SetCaption title "")
+ (set-screen-title! title)
(init-gl)
(if (eq? mode '3d) (set-3d-mode) (set-2d-mode))))))
(define (get-screen-bpp)
(surface-format-BytesPerPixel screen))
+(define (set-screen-bpp! bpp)
+ (cond (screen
+ (set! screen (SDL_SetVideoMode (get-screen-width) (get-screen-height) bpp flags)))))
+
(define (resize-screen width height)
(cond (screen
(set! screen (SDL_SetVideoMode width height (get-screen-bpp) flags))
(SDL_GL_SwapBuffers))
+(define screen-title "")
+
+(define (set-screen-title! title)
+ (set! screen-title title)
+ (SDL_WM_SetCaption title ""))
+
+(define (get-screen-title)
+ screen-title)
+
+
(define mode '2d)
(define (set-2d-mode)