diff options
author | Colin Okay <colin@cicadas.surf> | 2022-06-30 07:45:23 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-06-30 07:45:23 -0500 |
commit | 099c3f927c11fe7ae4d12933d6f72abc0b53e973 (patch) | |
tree | b8d497bcffd98459e6b510d2b2541269218df6b5 /src/core-units/affine.lisp | |
parent | e0fc8f0f7a8b4756226cfb5e1c7581e411420228 (diff) |
[modify] changed unit-width/height to just width/height. made defun
Diffstat (limited to 'src/core-units/affine.lisp')
-rw-r--r-- | src/core-units/affine.lisp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core-units/affine.lisp b/src/core-units/affine.lisp index e4db874..cabe17c 100644 --- a/src/core-units/affine.lisp +++ b/src/core-units/affine.lisp @@ -21,29 +21,27 @@ scale-y (* amount scale-y)))) (defun set-width-preserve-aspect (affine new-width) - (scale-by affine (/ new-width (unit-width affine)))) + (scale-by affine (/ new-width (width affine)))) (defun set-height-preserve-aspect (affine new-height) - (scale-by affine (/ new-height (unit-height affine) ))) + (scale-by affine (/ new-height (height affine) ))) -(defmethod unit-width ((affine affine)) +(defun width (affine) (with-slots (scale-x base-width) affine (* scale-x base-width))) -(defmethod unit-height ((affine affine)) +(defun height (affine) (with-slots (scale-y base-height) affine (* scale-y base-height))) -(defmethod (setf unit-width) (newval (affine affine)) +(defun (setf width) (newval affine) (with-slots (scale-x base-width) affine (setf scale-x (coerce (/ newval base-width) 'single-float)))) -(defmethod (setf unit-height) (newval (affine affine)) +(defun (setf height) (newval affine) (with-slots (scale-y base-height) affine (setf scale-y (coerce (/ newval base-height) 'single-float)))) - - (defmethod model-matrix :around ((u affine)) (or (cached-model u) (setf (cached-model u) |