This commit is contained in:
2015-03-01 21:11:57 -08:00
parent 1733fa81c7
commit 9022ddc741
4 changed files with 18 additions and 11 deletions

View File

@@ -35,12 +35,16 @@
[advent.screens.inventory :refer [inventory-screen]]
[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.graphics.g2d TextureRegion Animation Batch]
[com.badlogic.gdx.math Vector3 Matrix4]
[com.badlogic.gdx.utils.viewport FitViewport]
[com.badlogic.gdx.scenes.scene2d Actor Stage]
[java.lang Object]
[com.badlogic.gdx Gdx]))
[com.badlogic.gdx Gdx]
[com.badlogic.gdx.graphics Camera Color GL20 OrthographicCamera
PerspectiveCamera Pixmap Pixmap$Format PixmapIO Texture
VertexAttributes$Usage]
[com.badlogic.gdx.scenes.scene2d Actor Stage]))
(declare hud)
@@ -432,25 +436,28 @@
(update-fn screen entities)
entities))
(defn render-foreground [{:keys [camera renderer] :as screen} foreground]
(defn render-foreground [{:keys [^OrthographicCamera camera ^Stage renderer] :as screen} foreground]
#_(println camera)
(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))
(set! (.x tmp) (* (.x tmp) 1.5))
(set! (.y tmp) (* (.y tmp) 1.5))
(.setToLookAt parallax-view tmp (-> tmp2
(.set tmp)
(.add (.direction camera))
( .up camera)))
(.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)]
(let [^Batch batch (.getBatch renderer)]
(.begin batch)
(draw! (:tex foreground) screen batch)
(.setProjectionMatrix batch parallax-combined)
(entities/draw! (:tex foreground) screen batch)
(.end batch))))
@@ -520,7 +527,7 @@
:override nil
:last-pos [0 0]}
:foreground {:object nil
:tex (assoc (texture "outsidehouse/foreground.png") :x 0 :y 0 :baseline 1000)}
:tex (assoc (texture "outsidehouse/fg1.png") :x 75 :y 57 :baseline 1000)}
:all-items (assoc items/items :object nil)
:started? {:value false