diff options
Diffstat (limited to 'src/assets/asset.lisp')
-rw-r--r-- | src/assets/asset.lisp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/assets/asset.lisp b/src/assets/asset.lisp new file mode 100644 index 0000000..5f847da --- /dev/null +++ b/src/assets/asset.lisp @@ -0,0 +1,18 @@ +;;;; asset.lisp + +(in-package #:wheelwork) + +(defclass/std asset () + ((path :with :ri :std (error "An asset requires a path")) + (loadedp :with :a))) + +(defmethod cleanup :around ((asset asset)) + (when (asset-loadedp asset) + (call-next-method)) + (setf (asset-loadedp asset) nil)) + +(defmethod ensure-loaded :around ((thing asset)) + (unless (asset-loadedp thing) + (call-next-method) + (setf (asset-loadedp thing) t)) + thing) |