autosave images.
This commit is contained in:
@@ -38,7 +38,7 @@
|
|||||||
[advent.screens.dialogue :refer [talking-screen]]
|
[advent.screens.dialogue :refer [talking-screen]]
|
||||||
[advent.screens.inventory :refer [inventory-screen]]
|
[advent.screens.inventory :refer [inventory-screen]]
|
||||||
[clojure.core.async :refer [put! <! <!! >! chan go thread take! alts!! dropping-buffer]])
|
[clojure.core.async :refer [put! <! <!! >! chan go thread take! alts!! dropping-buffer]])
|
||||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30]
|
(:import [com.badlogic.gdx.graphics Pixmap$Format Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30]
|
||||||
[com.badlogic.gdx.graphics.g2d TextureRegion Animation Batch]
|
[com.badlogic.gdx.graphics.g2d TextureRegion Animation Batch]
|
||||||
[com.badlogic.gdx.math Vector3 Matrix4]
|
[com.badlogic.gdx.math Vector3 Matrix4]
|
||||||
[com.badlogic.gdx.utils.viewport FitViewport]
|
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||||
@@ -1245,9 +1245,10 @@ void main ()
|
|||||||
|
|
||||||
:on-show-inventory (fn [screen [entities]]
|
:on-show-inventory (fn [screen [entities]]
|
||||||
(click-inventory screen entities))
|
(click-inventory screen entities))
|
||||||
:on-menu (fn [screen [entities]]
|
:on-menu (fn [{:keys [viewport] :as screen} [entities]]
|
||||||
(when-not (or (get-in entities [:tweens :fade-out])
|
(when-not (or (get-in entities [:tweens :fade-out])
|
||||||
(get-in entities [:tweens :fade-in]))
|
(get-in entities [:tweens :fade-in]))
|
||||||
|
|
||||||
(input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
|
(input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
|
||||||
(-> entities
|
(-> entities
|
||||||
(assoc-in [:closing? :value] true)
|
(assoc-in [:closing? :value] true)
|
||||||
|
|||||||
@@ -10,9 +10,12 @@
|
|||||||
[clojure.edn :as edn]
|
[clojure.edn :as edn]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
[advent.saves :as saves])
|
[advent.saves :as saves])
|
||||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Blending Pixmap$Filter Texture Texture$TextureFilter]
|
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Format Pixmap$Blending Pixmap$Filter Texture Texture$TextureFilter]
|
||||||
[com.badlogic.gdx.graphics.g2d TextureRegion Animation]
|
[com.badlogic.gdx.graphics.g2d TextureRegion Animation]
|
||||||
[com.badlogic.gdx.utils.viewport FitViewport]
|
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||||
|
[com.badlogic.gdx.utils ScreenUtils]
|
||||||
|
[com.badlogic.gdx.files FileHandle]
|
||||||
|
[com.badlogic.gdx.graphics PixmapIO$PNG]
|
||||||
[com.badlogic.gdx.scenes.scene2d Actor Stage]
|
[com.badlogic.gdx.scenes.scene2d Actor Stage]
|
||||||
[com.badlogic.gdx.math CatmullRomSpline]
|
[com.badlogic.gdx.math CatmullRomSpline]
|
||||||
[com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
|
[com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
|
||||||
@@ -73,7 +76,19 @@
|
|||||||
(cons (saves/saves name)
|
(cons (saves/saves name)
|
||||||
(filter (complement #{(saves/saves name)})
|
(filter (complement #{(saves/saves name)})
|
||||||
(snapshot-list))))))
|
(snapshot-list))))))
|
||||||
.flush))
|
.flush)
|
||||||
|
(on-gl (let [f (FileHandle. (str "screenshot-" (clojure.core/name name) ".png" ))
|
||||||
|
_ (Pixmap/setFilter Pixmap$Filter/BiLinear)
|
||||||
|
#_#_[x y w h g-l g-r] [(.getScreenX viewport) (.getScreenY viewport) (.getScreenWidth viewport) (.getScreenHeight viewport)]
|
||||||
|
[x y w h] [0 0 1400 900]
|
||||||
|
pm (ScreenUtils/getFrameBufferPixmap x y w h)
|
||||||
|
|
||||||
|
resized (Pixmap. 128 96 Pixmap$Format/RGB888)
|
||||||
|
_ (.drawPixmap resized pm 0 0 w h 0 0 128 96)
|
||||||
|
png (PixmapIO$PNG. (* w h 1.5))]
|
||||||
|
(.write png f resized)
|
||||||
|
(.dispose png)
|
||||||
|
)))
|
||||||
|
|
||||||
(defn save [entities]
|
(defn save [entities]
|
||||||
(snapshot-state entities :autosave))
|
(snapshot-state entities :autosave))
|
||||||
|
|||||||
Reference in New Issue
Block a user