diff options
-rw-r--r-- | examples/font.scm | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/examples/font.scm b/examples/font.scm index 91acfc0..5087b1c 100644 --- a/examples/font.scm +++ b/examples/font.scm @@ -11,14 +11,15 @@ (load "common.scm") (define font (load-default-font 18)) -(define label (make-label font "The quick brown fox jumped over the lazy dog." - (vector2 320 240) #:anchor 'center)) +(define label + (make-label font "The quick brown fox jumped over the lazy dog." + (vector2 320 240) #:anchor 'center)) (define-signal fps-label (signal-map (lambda (fps) (let ((text (format #f "FPS: ~d" fps))) (make-label font text (vector2 0 0)))) - (signal-sample game-agenda 60 fps))) + fps)) (define-signal mouse-label (signal-map (lambda (p) @@ -26,25 +27,10 @@ (make-label font text (vector2 0 20)))) (signal-throttle game-agenda 5 mouse-position))) -(define-signal gc-counter (make-signal 0)) -(define-signal gc-label - (signal-map (lambda (counter) - (let ((text (format #f "GCs: ~d" counter))) - (make-label font text (vector2 0 40)))) - gc-counter)) - -(add-hook! after-gc-hook - (lambda () - (schedule game-agenda - (lambda () - (signal-set! gc-counter - (1+ (signal-ref gc-counter))))))) - (add-hook! draw-hook (lambda (dt alpha) (draw-label label) (draw-label (signal-ref fps-label)) - (draw-label (signal-ref mouse-label)) - (draw-label (signal-ref gc-label)))) + (draw-label (signal-ref mouse-label)))) (with-window (make-window #:title "Fonts") (run-game-loop)) |