From a3bf97e36510439b714ac53543491f7955497f3d Mon Sep 17 00:00:00 2001 From: jsancho Date: Tue, 6 Dec 2011 13:03:45 +0000 Subject: [PATCH] Gacela as Guile modules. --- src/{gacela_misc.scm => math.scm} | 23 +++++-------------- src/ttf.scm | 5 +++- src/{gacela_widgets.scm => widgets/timer.scm} | 11 ++++++++- 3 files changed, 20 insertions(+), 19 deletions(-) rename src/{gacela_misc.scm => math.scm} (77%) rename src/{gacela_widgets.scm => widgets/timer.scm} (90%) diff --git a/src/gacela_misc.scm b/src/math.scm similarity index 77% rename from src/gacela_misc.scm rename to src/math.scm index 8e8db13..64317dd 100644 --- a/src/gacela_misc.scm +++ b/src/math.scm @@ -15,10 +15,12 @@ ;;; along with this program. If not, see . - -;;; Additional modules - -(use-modules (srfi srfi-1)) +(define-module (gacela math) + #:export (*pi* + degrees-to-radians + radians-to-degrees + distance-between-points + nearest-power-of-two)) ;;; Constants @@ -55,16 +57,3 @@ (cond ((> (* p 2) n) p) (else (power (* p 2) n)))) (power 1 n)) - -;(define-macro (pushnew elem list) -; `(cond ((not (find (lambda (e) (eq? e ,elem)) ,list)) -; (set! ,list (cons ,elem ,list))))) - -(define (assoc-multiple-set! alist . pairs) - (define (amset! alist pairs) - (cond ((< (length pairs) 2) - alist) - (else - (assoc-set! alist (car pairs) (cadr pairs)) - (amset! alist (cddr pairs))))) - (amset! alist pairs)) diff --git a/src/ttf.scm b/src/ttf.scm index 5c02e54..8185eda 100644 --- a/src/ttf.scm +++ b/src/ttf.scm @@ -16,7 +16,10 @@ (define-module (gacela ttf) - #:use-module (gacela ftgl)) + #:use-module (gacela ftgl) + #:use-module (ice-9 optargs) + #:export (load-font + render-text)) (define* (load-font font-file #:key (size 40) (encoding ft_encoding_unicode)) (let* ((key (list font-file)) diff --git a/src/gacela_widgets.scm b/src/widgets/timer.scm similarity index 90% rename from src/gacela_widgets.scm rename to src/widgets/timer.scm index b5ddc47..39899f7 100755 --- a/src/gacela_widgets.scm +++ b/src/widgets/timer.scm @@ -15,7 +15,16 @@ ;;; along with this program. If not, see . -;;; Timers +(define-module (gacela widgets timer) + #:use-module (gacela sdl) + #:export (make-timer + start-timer + stop-timer + get-time + get-state + pause-timer + resume-timer)) + (define (make-timer) (let ((start 0) (paused 0) (state 'stopped)) -- 2.39.5