moving everyone.

This commit is contained in:
2015-03-01 17:33:23 -08:00
parent 96fb9015ce
commit 1733fa81c7

View File

@@ -36,6 +36,7 @@
[clojure.core.async :refer [put! <! <!! >! chan go thread take! alts!!]])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30]
[com.badlogic.gdx.graphics.g2d TextureRegion Animation]
[com.badlogic.gdx.math Vector3 Matrix4]
[com.badlogic.gdx.utils.viewport FitViewport]
[com.badlogic.gdx.scenes.scene2d Actor Stage]
[java.lang Object]
@@ -431,6 +432,27 @@
(update-fn screen 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
:on-timer
@@ -497,6 +519,8 @@
:last :main
:override nil
: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)
:started? {:value false
@@ -567,6 +591,7 @@
(when m
(music! m :set-volume (get-in entities [:volume :value]))))
(render! screen (sort-by :baseline all-entities))
(render-foreground screen (:foreground entities))
entities))
:on-resize (fn [{:keys [viewport width height]} [entities]]