diff options
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 |