settings uses preferences.
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
{:sound-volume 94.0, :music-volume 37.0}
|
|
||||||
@@ -49,16 +49,16 @@
|
|||||||
|
|
||||||
resized ))
|
resized ))
|
||||||
|
|
||||||
(defn save [entities]
|
|
||||||
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
|
|
||||||
(.putString "save-1" (pr-str (entities :state)))
|
|
||||||
.flush))
|
|
||||||
|
|
||||||
(defn get-texture [path]
|
(defn get-texture [path]
|
||||||
(let [atlas-name (str/replace path #".png" "")
|
(let [atlas-name (str/replace path #".png" "")
|
||||||
atlas (texture-atlas "packed/pack.atlas")]
|
atlas (texture-atlas "packed/pack.atlas")]
|
||||||
(texture (texture-atlas! atlas :find-region atlas-name))))
|
(texture (texture-atlas! atlas :find-region atlas-name))))
|
||||||
|
|
||||||
|
(defn save [entities]
|
||||||
|
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
|
||||||
|
(.putString "save-1" (pr-str (entities :state)))
|
||||||
|
.flush))
|
||||||
|
|
||||||
(defn has-save? []
|
(defn has-save? []
|
||||||
(-> (.getPreferences (Gdx/app) "ticks-tales-saves")
|
(-> (.getPreferences (Gdx/app) "ticks-tales-saves")
|
||||||
(.contains "save-1")))
|
(.contains "save-1")))
|
||||||
@@ -69,6 +69,22 @@
|
|||||||
edn/read-string
|
edn/read-string
|
||||||
(assoc :active? true)))
|
(assoc :active? true)))
|
||||||
|
|
||||||
|
(defn save-settings [entities]
|
||||||
|
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
|
||||||
|
(.putString "settings" (pr-str @settings))
|
||||||
|
.flush))
|
||||||
|
|
||||||
|
(defn has-saved-settings? []
|
||||||
|
(-> (.getPreferences (Gdx/app) "ticks-tales-saves")
|
||||||
|
(.contains "settings")))
|
||||||
|
|
||||||
|
(defn load-settings []
|
||||||
|
(reset! settings
|
||||||
|
(-> (.getPreferences (Gdx/app) "ticks-tales-saves")
|
||||||
|
(.getString "settings")
|
||||||
|
edn/read-string)))
|
||||||
|
|
||||||
|
|
||||||
(defn load-settings! []
|
(defn load-settings! []
|
||||||
(when (.exists (io/file "settings.edn"))
|
(when (.exists (io/file "settings.edn"))
|
||||||
(reset! settings (edn/read-string (slurp "settings.edn")))))
|
(reset! settings (edn/read-string (slurp "settings.edn")))))
|
||||||
|
|||||||
Reference in New Issue
Block a user