From 82f71b0d13788b1cff9a24c5b652effd11631523 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Wed, 29 Jun 2022 11:54:24 -0500 Subject: [refactor] [structure] modularized project file structure --- src/assets/asset.lisp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/assets/asset.lisp (limited to 'src/assets/asset.lisp') 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) -- cgit v1.2.3