moving everyone.
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
[clojure.core.async :refer [put! <! <!! >! chan go thread take! alts!!]])
|
[clojure.core.async :refer [put! <! <!! >! chan go thread take! alts!!]])
|
||||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30]
|
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30]
|
||||||
[com.badlogic.gdx.graphics.g2d TextureRegion Animation]
|
[com.badlogic.gdx.graphics.g2d TextureRegion Animation]
|
||||||
|
[com.badlogic.gdx.math Vector3 Matrix4]
|
||||||
[com.badlogic.gdx.utils.viewport FitViewport]
|
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||||
[com.badlogic.gdx.scenes.scene2d Actor Stage]
|
[com.badlogic.gdx.scenes.scene2d Actor Stage]
|
||||||
[java.lang Object]
|
[java.lang Object]
|
||||||
@@ -431,6 +432,27 @@
|
|||||||
(update-fn screen entities)
|
(update-fn screen entities)
|
||||||
entities))
|
entities))
|
||||||
|
|
||||||
|
(defn render-foreground [{:keys [camera renderer] :as screen} foreground]
|
||||||
|
(let [tmp (Vector3.)
|
||||||
|
tmp2 (Vector3.)
|
||||||
|
parallax-view (Matrix4.)
|
||||||
|
parallax-combined (Matrix4.)]
|
||||||
|
(.update camera)
|
||||||
|
(.set tmp (.position camera))
|
||||||
|
(set! (.x tmp) (* (.x tmp) 2))
|
||||||
|
(set! (.y tmp) (* (.y tmp) 2))
|
||||||
|
(.setToLookAt parallax-view tmp (-> tmp2
|
||||||
|
(.set tmp)
|
||||||
|
(.add (.direction camera))
|
||||||
|
( .up camera)))
|
||||||
|
(.set parallax-combined (.projection camera))
|
||||||
|
(Matrix4/mul (.val parallax-combined) (.val parallax-view))
|
||||||
|
(.setProjectionMatrix camera parallax-combined)
|
||||||
|
(let [batch (.getBatch renderer)]
|
||||||
|
(.begin batch)
|
||||||
|
(draw! (:tex foreground) screen batch)
|
||||||
|
(.end batch))))
|
||||||
|
|
||||||
|
|
||||||
(defscreen scene
|
(defscreen scene
|
||||||
:on-timer
|
:on-timer
|
||||||
@@ -497,6 +519,8 @@
|
|||||||
:last :main
|
:last :main
|
||||||
:override nil
|
:override nil
|
||||||
:last-pos [0 0]}
|
:last-pos [0 0]}
|
||||||
|
:foreground {:object nil
|
||||||
|
:tex (assoc (texture "outsidehouse/foreground.png") :x 0 :y 0 :baseline 1000)}
|
||||||
|
|
||||||
:all-items (assoc items/items :object nil)
|
:all-items (assoc items/items :object nil)
|
||||||
:started? {:value false
|
:started? {:value false
|
||||||
@@ -567,6 +591,7 @@
|
|||||||
(when m
|
(when m
|
||||||
(music! m :set-volume (get-in entities [:volume :value]))))
|
(music! m :set-volume (get-in entities [:volume :value]))))
|
||||||
(render! screen (sort-by :baseline all-entities))
|
(render! screen (sort-by :baseline all-entities))
|
||||||
|
(render-foreground screen (:foreground entities))
|
||||||
entities))
|
entities))
|
||||||
|
|
||||||
:on-resize (fn [{:keys [viewport width height]} [entities]]
|
:on-resize (fn [{:keys [viewport width height]} [entities]]
|
||||||
|
|||||||
Reference in New Issue
Block a user