diff options
Diffstat (limited to 'src/core/affine.lisp')
-rw-r--r-- | src/core/affine.lisp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/affine.lisp b/src/core/affine.lisp index cabe17c..4585a81 100644 --- a/src/core/affine.lisp +++ b/src/core/affine.lisp @@ -15,7 +15,9 @@ (setf (cached-model affine) nil (cached-projected-matrix affine) nil)))) -(defun scale-by (affine amount) + + +(defmethod scale-by ((affine affine) amount) (with-slots (scale-x scale-y) affine (setf scale-x (* amount scale-x) scale-y (* amount scale-y)))) @@ -26,19 +28,19 @@ (defun set-height-preserve-aspect (affine new-height) (scale-by affine (/ new-height (height affine) ))) -(defun width (affine) +(defmethod width ((affine affine)) (with-slots (scale-x base-width) affine (* scale-x base-width))) -(defun height (affine) +(defmethod height ((affine affine)) (with-slots (scale-y base-height) affine (* scale-y base-height))) -(defun (setf width) (newval affine) +(defmethod (setf width) (newval (affine affine)) (with-slots (scale-x base-width) affine (setf scale-x (coerce (/ newval base-width) 'single-float)))) -(defun (setf height) (newval affine) +(defmethod (setf height) (newval (affine affine)) (with-slots (scale-y base-height) affine (setf scale-y (coerce (/ newval base-height) 'single-float)))) |