Read from steam or local file.
This commit is contained in:
@@ -1 +1 @@
|
|||||||
16
|
17
|
||||||
|
|||||||
@@ -82,14 +82,13 @@
|
|||||||
(.put bb# bytes#)
|
(.put bb# bytes#)
|
||||||
(.fileWrite rs# ~filename bb# (count bytes#))))))
|
(.fileWrite rs# ~filename bb# (count bytes#))))))
|
||||||
|
|
||||||
(defn download-screenshot [filename]
|
(defn get-screenshot-bytes [filename]
|
||||||
(when (and has-steam? (not (.exists (files! :local filename))))
|
(if has-steam?
|
||||||
(eval `(let [rs# (SteamRemoteStorage. nil)
|
(eval `(let [rs# (SteamRemoteStorage. nil)
|
||||||
len# (.getFileSize rs# ~filename)
|
len# (.getFileSize rs# ~filename)
|
||||||
bb# (ByteBuffer/allocateDirect len#)
|
bb# (ByteBuffer/allocateDirect len#)
|
||||||
bytes# (make-array Byte/TYPE len#)]
|
bytes# (make-array Byte/TYPE len#)]
|
||||||
(do (.fileRead rs# ~filename bb# len#)
|
(do (.fileRead rs# ~filename bb# len#)
|
||||||
(.get bb# bytes#)
|
(.get bb# bytes#)
|
||||||
(.writeBytes (files! :local ~filename)
|
bytes#)))
|
||||||
bytes#
|
(.readBytes (files! :local filename))))
|
||||||
false))))))
|
|
||||||
|
|||||||
@@ -74,12 +74,11 @@
|
|||||||
|
|
||||||
(defn snapshot-screenshots []
|
(defn snapshot-screenshots []
|
||||||
(doall (for [snapshot (snapshot-list)]
|
(doall (for [snapshot (snapshot-list)]
|
||||||
(do
|
(assoc-in snapshot [:screenshot]
|
||||||
(steam/download-screenshot (:screenshot snapshot))
|
(try (let [bytes (steam/get-screenshot-bytes (:screenshot snapshot))]
|
||||||
(update-in snapshot [:screenshot]
|
(Pixmap. bytes 0 (count bytes)))
|
||||||
#(try (Pixmap. (files! :local %) )
|
(catch Exception e
|
||||||
(catch Exception e
|
(Pixmap. 160 120 Pixmap$Format/RGB888)))))))
|
||||||
(Pixmap. 160 120 Pixmap$Format/RGB888))))))))
|
|
||||||
|
|
||||||
(defn save-chapter [entities chapter]
|
(defn save-chapter [entities chapter]
|
||||||
(let [prefs (.getPreferences (Gdx/app) "ticks-tales-saves")
|
(let [prefs (.getPreferences (Gdx/app) "ticks-tales-saves")
|
||||||
|
|||||||
Reference in New Issue
Block a user