summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2d/fps.scm7
1 files changed, 3 insertions, 4 deletions
diff --git a/2d/fps.scm b/2d/fps.scm
index 58c7a86..4419928 100644
--- a/2d/fps.scm
+++ b/2d/fps.scm
@@ -23,22 +23,21 @@
(define-module (2d fps)
#:use-module (2d game)
+ #:use-module (2d signal)
#:export (fps))
;; Current frames per second
-(define fps (make-parameter 0))
+(define-signal fps (make-signal 0))
(define accumulate-fps!
(let* ((elapsed-time 0)
(fps-counter 0))
(lambda (dt alpha)
- "Increment the frames-per-second counter. Resets to 0 every
-second."
(let ((new-time (+ elapsed-time dt))
(new-fps (1+ fps-counter)))
(if (>= new-time 1000)
(begin
- (fps new-fps)
+ (signal-set! fps new-fps)
(set! fps-counter 0)
(set! elapsed-time 0))
(begin