a lot of progress on the screenshot approach.
This commit is contained in:
@@ -9,3 +9,5 @@ Reenable mobile screenshots - Static images for mobile screenshots?
|
||||
Lying down at start of jail
|
||||
Two finger panning?
|
||||
Pinching end is wrong, sometimes clicks
|
||||
|
||||
Improve padding on text so it's more clickable
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 677 KiB After Width: | Height: | Size: 801 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 578 KiB After Width: | Height: | Size: 588 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 413 KiB After Width: | Height: | Size: 1.2 MiB |
@@ -15,4 +15,29 @@
|
||||
:chapter-4 "Tick the Ex-con"
|
||||
:chapter-5 "Slingshot Stew"})
|
||||
|
||||
(defn default-screenshot [state]
|
||||
(let [answers {:inside-house "screenshots/inside-house.png"
|
||||
:inside-stash "screenshots/inside-stash.png"
|
||||
:outside-house {:day "screenshots/outside-house-day.png"
|
||||
:night "screenshots/outside-house-night.png"}
|
||||
:behind-house {:day "screenshots/behind-house-day.png"
|
||||
:night "screenshots/behind-house-night.png"}
|
||||
:cat-tree {:day "screenshots/cat-tree-day.png"
|
||||
:night "screenshots/cat-tree-night.png"}
|
||||
:inside-castle {:day "screenshots/inside-castle-day.png"
|
||||
:night "screenshots/inside-castle-night.png"}
|
||||
:space "screenshots/duel.png"
|
||||
:held "screenshots/held.png"
|
||||
:inside-cafeteria "screenshots/cafeteria.png"
|
||||
:inside-antique "screenshots/inside-antique.png"
|
||||
:inside-jail "screenshots/inside-jail.png"
|
||||
:dream "screenshots/dream.png"
|
||||
:castle-gate "screenshots/castle-gate.png"
|
||||
:outside-jail {:day "screenshots/fountain-day.png"
|
||||
:night "screenshots/fountain-night.png"}
|
||||
:outside-castle {:day "screenshots/outside-castle-day.png"
|
||||
:night "screenshots/outside-castle-night.png"}}]
|
||||
(get-in answers [(:last-room state) (:time state)]
|
||||
(get-in answers [(:last-room state)]))))
|
||||
|
||||
|
||||
|
||||
@@ -1894,14 +1894,14 @@
|
||||
(grow-hud screen entities :save false)))
|
||||
|
||||
entities (or (process-fsm screen entities) entities)]
|
||||
(label! (:fps entities) :set-text (str (game :fps)))
|
||||
#_(label! (:fps entities) :set-text (str (game :fps)))
|
||||
|
||||
|
||||
|
||||
(render! screen [ (if (and hud-interactable? (not (:already-saved? entities)))
|
||||
(:save entities)
|
||||
(assoc (:save entities) :opacity 0.5))
|
||||
(:fps entities)
|
||||
#_(:fps entities)
|
||||
(if hud-interactable?
|
||||
(:inventory entities)
|
||||
(assoc (:inventory entities) :opacity 0.5))
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
(def button-color (Color/valueOf "9b399eff"))
|
||||
(def label-color (color 0.81 0.5 0.0 1.0))
|
||||
(def disabled-label-color (color 0.3 0.3 0.3 1.0))
|
||||
|
||||
(defn style-label [e font mouse-pos]
|
||||
(when (:interactable e)
|
||||
@@ -172,6 +173,8 @@
|
||||
([msg]
|
||||
(make-label msg nil))
|
||||
([msg col]
|
||||
(make-label msg col utils/title-label-scale))
|
||||
([msg col scale]
|
||||
(let [font (utils/get-font "ego/font.fnt")
|
||||
|
||||
p (NinePatchEntity. (skin! (skin "ui/ui.json") :get-patch "ui-bg"))
|
||||
@@ -179,7 +182,7 @@
|
||||
bg (drawable :nine-patch ^NinePatch (:object p))
|
||||
style (style :label font (or col (color 1.0 0.3 0.3 1.0)))
|
||||
#_#__ (set! (.background style) bg)]
|
||||
(-> style .font .getData (.setScale utils/title-label-scale))
|
||||
(-> style .font .getData (.setScale scale))
|
||||
(-> msg
|
||||
(label style)
|
||||
(assoc :x 0 :y 0 :height 40 :origin-x 0 :origin-y 0 :z 8)
|
||||
@@ -202,8 +205,10 @@
|
||||
|
||||
(defn make-max-progress-bar [min max initial-value artificial-max & rest]
|
||||
(let [ui-skin (skin "ui/ui.json")
|
||||
_ (println initial-value)
|
||||
slider (->
|
||||
(max-progress-bar min max 1 false (skin! ui-skin :get "default-horizontal" Slider$SliderStyle) artificial-max)
|
||||
(max-progress-bar min max 1.0 false (skin! ui-skin :get "default-horizontal" Slider$SliderStyle) artificial-max)
|
||||
(doto (#(slider! % :set-value initial-value)))
|
||||
(assoc
|
||||
:hover (skin! ui-skin :get "default-horizontal-hover" Slider$SliderStyle)
|
||||
:default (skin! ui-skin :get "default-horizontal" Slider$SliderStyle)
|
||||
@@ -246,22 +251,29 @@
|
||||
[(make-button "End Quest" :key :end-quest) :height (* utils/ui-scale 56) :width (* utils/ui-scale 250)]])))))
|
||||
|
||||
(defn chapters-menu []
|
||||
(make-table [[(doto
|
||||
(make-label "Our tale's beginning" label-color)
|
||||
(label! :set-name "explanation")) :width (* utils/ui-scale 250) :height 40 :colspan 5]
|
||||
:row
|
||||
[(make-max-progress-bar 0.0 4.0 0.0 3.0 :key :current-chapter) :width (* utils/ui-scale 260) :height (* utils/ui-scale 50) :colspan 5]
|
||||
:row
|
||||
[(make-label "1" label-color) :height (* utils/ui-scale 32) :width 30 :pad-bottom (* utils/ui-scale 8)]
|
||||
[(make-label "2" label-color) :height (* utils/ui-scale 32) :width 30 :pad-bottom (* utils/ui-scale 8)]
|
||||
[(make-label "3" label-color) :height (* utils/ui-scale 32) :width 30 :pad-bottom (* utils/ui-scale 8)]
|
||||
[(make-label "4" label-color) :height (* utils/ui-scale 32) :width 30 :pad-bottom (* utils/ui-scale 8)]
|
||||
[(make-label "5" label-color) :height (* utils/ui-scale 32) :width 30 :pad-bottom (* utils/ui-scale 8)]
|
||||
|
||||
:row
|
||||
[ (make-button "Back" :key :back) :height (* utils/button-scale 56) :width (* utils/button-scale 100) :colspan 2]
|
||||
[ (make-label "") :height (* utils/button-scale 56) ]
|
||||
[ (make-button "Start" :key :back) :height (* utils/button-scale 56) :width (* utils/button-scale 100) :colspan 2]]))
|
||||
(let [_ (println (utils/get-chapters) )
|
||||
chapter-count (->> (utils/get-chapters)
|
||||
(vals)
|
||||
(filter identity)
|
||||
count
|
||||
dec
|
||||
(max 0))
|
||||
selected-title (-> (utils/get-chapters) keys (nth chapter-count) saves/chapter-name )]
|
||||
(make-table (concat [[(doto
|
||||
(make-label selected-title label-color)
|
||||
(label! :set-name "explanation")) :width (* utils/ui-scale 250) :height 40 :colspan 5]
|
||||
:row
|
||||
[(doto (make-max-progress-bar 0.0 4.0 chapter-count chapter-count :key :current-chapter)
|
||||
(slider! :set-name "slider")) :width (* utils/ui-scale 260) :height (* utils/ui-scale 50) :colspan 5]
|
||||
:row]
|
||||
(map (fn [index [chapter v]]
|
||||
[(make-label (str (inc index)) (if v label-color disabled-label-color)) :height (* utils/ui-scale 32) :width 30 :pad-bottom (* utils/ui-scale 8)])
|
||||
(range)
|
||||
(utils/get-chapters))
|
||||
[:row
|
||||
[ (make-button "Back" :key :back) :height (* utils/button-scale 56) :width (* utils/button-scale 100) :colspan 2]
|
||||
[ (make-label "") :height (* utils/button-scale 56) ]
|
||||
[ (make-button "Start" :key :start) :height (* utils/button-scale 56) :width (* utils/button-scale 100) :colspan 2]]))))
|
||||
|
||||
(defn settings-menu []
|
||||
(let [fullscreen-button (make-checkbox "Fullscreen" (utils/is-fullscreen?) :key :toggle-fullscreen)
|
||||
@@ -303,7 +315,8 @@
|
||||
(image-button! :add (doto (Group. )
|
||||
(.setSize (- cell-w 16) (- cell-h 16) )
|
||||
(.setOrigin (/ (- cell-w 16) 2) (/ (- cell-h 16) 2))
|
||||
(.addActor (:object (doto (image (texture screenshot))
|
||||
(.addActor (:object (doto (image
|
||||
screenshot)
|
||||
(image! :set-size (- cell-w 16) (- cell-h 16)))))
|
||||
(.addActor (:object (make-label (str "" (or blurb name)) label-color )))
|
||||
|
||||
@@ -417,7 +430,7 @@
|
||||
:font font
|
||||
:music music
|
||||
:volume 1.0
|
||||
:copyright (->> (make-label (str "© Digital Bounce House 2016 - v" (advent.version/version)) label-color)
|
||||
:copyright (->> (make-label (str "© Digital Bounce House 2016 - v" (advent.version/version)) label-color 0.25)
|
||||
(utils/add-actor-to-stage screen))
|
||||
:tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0
|
||||
:finish #(do
|
||||
@@ -469,10 +482,8 @@
|
||||
|
||||
(= :current-chapter actor-key)
|
||||
(do
|
||||
(println
|
||||
(label! (table! (actor! e :get-parent) :find-actor "explanation")
|
||||
:set-text (saves/chapter-name (nth [:chapter-1 :chapter-2 :chapter-3 :chapter-4 :chapter-5] (int (slider! e :get-value)))))
|
||||
)
|
||||
(label! (table! (actor! e :get-parent) :find-actor "explanation")
|
||||
:set-text (saves/chapter-name (nth [:chapter-1 :chapter-2 :chapter-3 :chapter-4 :chapter-5] (int (slider! e :get-value)))))
|
||||
|
||||
entities)
|
||||
|
||||
@@ -578,8 +589,12 @@
|
||||
(text-button! (-> entities :save-menu :continue-button) :set-disabled true)
|
||||
(text-button! (-> entities :save-menu :delete-button) :set-disabled true))))
|
||||
|
||||
(:chapter e)
|
||||
(start-playing screen entities (:chapter e))
|
||||
(= :start actor-key)
|
||||
(do
|
||||
(println "SELECTED chapter" (nth [:chapter-1 :chapter-2 :chapter-3 :chapter-4 :chapter-5]
|
||||
(int (slider! (table! (actor! e :get-parent) :find-actor "slider") :get-value))))
|
||||
(start-playing screen entities ((utils/get-chapters) (nth [:chapter-1 :chapter-2 :chapter-3 :chapter-4 :chapter-5]
|
||||
(int (slider! (table! (actor! e :get-parent) :find-actor "slider") :get-value))))))
|
||||
|
||||
:else
|
||||
entities))))
|
||||
|
||||
@@ -175,9 +175,9 @@
|
||||
(doall (for [snapshot (snapshot-list)]
|
||||
(assoc-in snapshot [:screenshot]
|
||||
(try (let [bytes (steam/get-bytes (:screenshot snapshot))]
|
||||
(Pixmap. ^bytes bytes 0 (count bytes)))
|
||||
(texture (Pixmap. ^bytes bytes 0 (count bytes))))
|
||||
(catch Exception e
|
||||
(Pixmap. 160 120 Pixmap$Format/RGB888)))))))
|
||||
(get-texture (saves/default-screenshot (:state snapshot)))))))))
|
||||
|
||||
(defn save-chapter [entities chapter]
|
||||
(let [prefs (.getPreferences (Gdx/app) "ticks-tales-saves")
|
||||
@@ -253,7 +253,7 @@
|
||||
|
||||
(log/info "writing save file...")
|
||||
(steam/write-bytes (steam/save-file-name id) (.getBytes (pr-str save) "UTF-8"))
|
||||
#_(on-gl (let [gl-func (fn []
|
||||
(on-gl (let [gl-func (fn []
|
||||
(log/info "Screenshot captured. Publishing for persistence")
|
||||
(put! screenshot-chan [id (publish-screenshot-fn)]))]
|
||||
(try-times gl-func 3)) )))]
|
||||
|
||||
Reference in New Issue
Block a user