#:use-module (gacela video)
#:use-module (gacela audio)
#:use-module (ice-9 optargs)
- #:export (load-texture
- load-font
- *title*
+ #:export (*title*
*width-screen*
*height-screen*
*bpp-screen*
3d-mode?))
-;;; Resources Cache
-
-(define resources-cache (make-weak-value-hash-table))
-
-(define (from-cache key)
- (hash-ref resources-cache key))
-
-(define (into-cache key res)
- (hash-set! resources-cache key res))
-
-(define-macro (use-cache-with module proc)
- (let ((pwc (string->symbol (string-concatenate (list (symbol->string proc) "-without-cache")))))
- `(begin
- (define ,pwc (@ ,module ,proc))
- (define (,proc . param)
- (let* ((key param)
- (res (from-cache key)))
- (cond (res
- res)
- (else
- (set! res (apply ,pwc param))
- (into-cache key res)
- res)))))))
-
-(use-cache-with (gacela video) load-texture)
-(use-cache-with (gacela video) load-font)
-
-
;;; Main Loop
(define loop-flag #f)
(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