From: jsancho Date: Tue, 16 Aug 2011 15:55:25 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=770c0935d07abeb28578e236ef8966aed0a31b21;p=gacela.git --- diff --git a/src/gacela_widgets.scm b/src/gacela_widgets.scm index 9d6cea4..b5ddc47 100755 --- a/src/gacela_widgets.scm +++ b/src/gacela_widgets.scm @@ -20,30 +20,31 @@ (define (make-timer) (let ((start 0) (paused 0) (state 'stopped)) (lambda (op) - (cond ((eq? op 'start-timer) - (set! start (SDL_GetTicks)) - (set! state 'running)) + (case op + ((start-timer) + (set! start (SDL_GetTicks)) + (set! state 'running)) - ((eq? op 'stop-timer) - (set! state 'stopped)) + ((stop-timer) + (set! state 'stopped)) - ((eq? op 'get-time) - (cond ((eq? state 'stopped) 0) - ((eq? state 'paused) paused) - (else (- (SDL_GetTicks) start)))) + ((get-time) + (cond ((eq? state 'stopped) 0) + ((eq? state 'paused) paused) + (else (- (SDL_GetTicks) start)))) - ((eq? op 'get-state) - state) + ((get-state) + state) - ((eq? op 'pause-timer) - (cond ((eq? state 'running) - (set! paused (- (SDL_GetTicks) start)) - (set! state 'paused)))) + ((pause-timer) + (cond ((eq? state 'running) + (set! paused (- (SDL_GetTicks) start)) + (set! state 'paused)))) - ((eq? op 'resume-timer) - (cond ((eq? state 'paused) - (set! start (- (SDL_GetTicks) paused)) - (set! state 'running)))))))) + ((resume-timer) + (cond ((eq? state 'paused) + (set! start (- (SDL_GetTicks) paused)) + (set! state 'running)))))))) (define (start-timer timer) (timer 'start-timer))