creates saves order list.

This commit is contained in:
Bryce Covert
2015-10-04 13:46:53 -07:00
parent 27021ac281
commit b52e8caa0d
3 changed files with 14 additions and 5 deletions

View File

@@ -58,9 +58,17 @@
atlas (texture-atlas "packed/pack.atlas")]
(texture (texture-atlas! atlas :find-region atlas-name))))
(defn snapshot-list []
(let [prefs (.getPreferences (Gdx/app) "ticks-tales-saves")]
(if (.contains prefs "snapshot-list")
(edn/read-string (.getString prefs "snapshot-list"))
[])))
(defn snapshot-state [entities name]
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
(.putString (saves/saves name) (pr-str (entities :state)))
(.putString "snapshot-list" (pr-str (cons (saves/saves name) (filter (complement #{(saves/saves name)}) (snapshot-list)))))
.flush))
(defn save [entities]