summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2d/rect.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/2d/rect.scm b/2d/rect.scm
index 6d3594c..e3584d3 100644
--- a/2d/rect.scm
+++ b/2d/rect.scm
@@ -64,13 +64,21 @@
;; immutable.
(define-record-type <rect>
- (make-rect x y width height)
+ (%make-rect x y width height)
rect?
(x rect-x)
(y rect-y)
(width rect-width)
(height rect-height))
+(define make-rect
+ (case-lambda
+ ((x y width height)
+ (%make-rect x y width height))
+ ((position size)
+ (%make-rect (vx position) (vy position)
+ (vx size) (vy size)))))
+
(define null-rect (make-rect 0 0 0 0))
(define (rect-right rect)