Explorar o código

Add info for assets loading

Lily Carpenter %!s(int64=8) %!d(string=hai) anos
pai
achega
9691f43543
Modificáronse 1 ficheiros con 30 adicións e 0 borrados
  1. 30 0
      docs/roadmap.org

+ 30 - 0
docs/roadmap.org

@@ -26,6 +26,36 @@ Each version will be tagged upon being considered complete
26 26
 :PROPERTIES:
27 27
 :Effort:   20
28 28
 :END:
29
+* Code Snippets (for future use)
30
+** How to get a path to executable or project depending on which you are running as:
31
+from([[https://github.com/mfiano/gamebox/blob/master/src/utils/utils.lisp]])
32
+#+BEGIN_SRC lisp
33
+(in-package :gbx.util)
34
+
35
+(defun path (context dir &optional file)
36
+  (let ((path (format nil "~A/~@[~A~]" dir file)))
37
+    (with-slots (user) context
38
+      (if uiop/image:*image-dumped-p*
39
+          (truename
40
+           (uiop/pathname:merge-pathnames*
41
+            path
42
+            (uiop:pathname-directory-pathname (uiop:argv0))))
43
+          (asdf/system:system-relative-pathname user path)))))
44
+
45
+(defun read-file (context file)
46
+  (let ((path (path context "." file)))
47
+    (when (and (or (pathnamep path) (stringp path))
48
+               (uiop/filesystem:file-exists-p path))
49
+      (with-open-file (in path)
50
+        (let ((*read-eval* nil))
51
+          (read in))))))
52
+
53
+(defun flatten-floats (sequence)
54
+  (let ((sequence (mapcar #'float (flatten sequence))))
55
+    (make-array (length sequence)
56
+                :element-type 'single-float
57
+:initial-contents sequence)))
58
+#+END_SRC
29 59
 * Versions
30 60
 ** 0.0
31 61
 *** DONE Ask #lispgames for feedback on this roadmap.           :realworld: