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 | |
parent | e0fc8f0f7a8b4756226cfb5e1c7581e411420228 (diff) |
[modify] changed unit-width/height to just width/height. made defun
Diffstat (limited to 'src')
-rw-r--r-- | src/core-units/affine.lisp | 14 | ||||
-rw-r--r-- | src/protocol.lisp | 5 | ||||
-rw-r--r-- | src/wheelwork.lisp | 2 |
3 files changed, 7 insertions, 14 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) diff --git a/src/protocol.lisp b/src/protocol.lisp index 24a34c2..f8386a6 100644 --- a/src/protocol.lisp +++ b/src/protocol.lisp @@ -23,11 +23,6 @@ (:documentation "Adds a unit to a container, removing it from its current container first, if necessary.")) -(defgeneric unit-width (unit)) -(defgeneric unit-height (unit)) -(defgeneric (setf unit-width) (newval unit)) -(defgeneric (setf unit-height) (newval unit)) - (defgeneric render (thing) (:documentation "Renders thing for visual display.")) diff --git a/src/wheelwork.lisp b/src/wheelwork.lisp index 885ae1e..849e2c7 100644 --- a/src/wheelwork.lisp +++ b/src/wheelwork.lisp @@ -66,7 +66,7 @@ TARGET is FOCUSABLEP" (defun get-rect (unit) "Returns a list of vectors representing the path of the smallest rectangle that encloses the unit. The rectangle is scaled and rotated." - (with-accessors ((x x) (y y) (w unit-width) (h unit-height) (r rotation)) unit + (with-accessors ((x x) (y y) (w width) (h height) (r rotation)) unit (let ((m (mat:meye 4)) (tr |