diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-09-28 08:58:00 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-09-28 08:58:00 -0400 |
commit | fab6610fb1f75c9de02a2c1676a19ba845df5185 (patch) | |
tree | 6754be17857affc29a83ed029e096b97cfaae91f | |
parent | 7b43d56367d18cfb64ddc73dc7a9f31446fe7c9c (diff) |
math: rect: Add custom record type printer.
-rw-r--r-- | chickadee/math/rect.scm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chickadee/math/rect.scm b/chickadee/math/rect.scm index 3ccaf97..690d779 100644 --- a/chickadee/math/rect.scm +++ b/chickadee/math/rect.scm @@ -16,9 +16,11 @@ ;;; <http://www.gnu.org/licenses/>. (define-module (chickadee math rect) + #:use-module (ice-9 format) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-4) #:use-module (srfi srfi-9) + #:use-module (srfi srfi-9 gnu) #:use-module (chickadee math) #:use-module (chickadee math vector) #:export (make-rect @@ -81,6 +83,12 @@ rect? (bv unwrap-rect)) +(define (display-rect rect port) + (format port "#<rect x: ~f y: ~f width: ~f height: ~f>" + (rect-x rect) (rect-y rect) (rect-width rect) (rect-height rect))) + +(set-record-type-printer! <rect> display-rect) + (define (make-null-rect) (wrap-rect (make-f32vector 4 0.0))) |