aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/assets/asset.lisp
blob: e1b4f57bcffe12132b44b5552886b5f7a66d0bb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
;;;; asset.lisp

(in-package #:wheelwork)

(def:class asset ()
  ((path "Path to asset") :required :ro :prefix
   :type (or pathname string))
  (loadedp :prefix :type boolean :initform nil))

(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)