diff options
author | colin <colin@cicadas.surf> | 2024-12-14 08:36:23 -0800 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2024-12-14 08:36:23 -0800 |
commit | 3a2217263d581be9a7f629b10d75aa8e3d581890 (patch) | |
tree | 23f5f0a5449a06473aba2ec7914a3c2193823a10 /src/core/unit.lisp | |
parent | 03cdbb6a15e130a012377ab8d54074b6864e3480 (diff) | |
parent | 8a51ba81c7df6b0b6dab7cf4b35b5ca084b653ba (diff) |
Merge branch 'refactor-with-def'
Diffstat (limited to 'src/core/unit.lisp')
-rw-r--r-- | src/core/unit.lisp | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/core/unit.lisp b/src/core/unit.lisp index 1102f20..308b715 100644 --- a/src/core/unit.lisp +++ b/src/core/unit.lisp @@ -2,15 +2,34 @@ (in-package #:wheelwork) -(defclass/std unit () - ((cached-model cached-projected-matrix cached-rectangle :a) - (visiblep :with :std t) - (in-scene-p :with :a :std nil) - (region :with :std *application* - :doc "The screen region where the unit will be visible.") - (base-width base-height :r :std 1.0 :doc "Determined by content.") - (scale-x scale-y :std 1.0) - (rotation x y :std 0.0))) +(def:class unit () + (cached-model cached-projected-matrix cached-rectangle + :initform nil :documentation "internal caches") + + ((visiblep "Whether or not to render unit") + :prefix :type boolean :initform t) + + ((in-scene-p "Indicates if unit is considered for display & events") + :prefix :type boolean :initform nil) + + ((region "The screen region where this unit will be visible.") + :prefix :type region :initform *application*) + + ((base-height "Content's base height") + (base-width "Content's base width") + :ro :type float :initform 1.0) + + ((scale-x "Factor by which to resize base-width") + (scale-y "Factor by which to resize base-heght") + :type float :initform 1.0) + + ((rotation "Rotation in radians about objects' bounding box center") + (x "X position, → is positive direction") + (y "Y position, ↑ is positive direction") + :type float :initform 0.0) + + :documentation "Fundamental display unit") + (defmethod render :around ((unit unit)) (when (unit-visiblep unit) |