fairly accurate text positioning.

This commit is contained in:
=
2014-09-08 18:58:51 -07:00
parent dbae4fd0f7
commit 9b4efb8fc7
2 changed files with 22 additions and 21 deletions

View File

@@ -8,7 +8,7 @@
[advent.actions :as actions]
[advent.screens.dialogue :as dialogue])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
[com.badlogic.gdx.graphics.g2d TextureRegion] ))
[com.badlogic.gdx.graphics.g2d TextureRegion]))
(defn jump-to [screen entities entity [x y]]
(let [scale-fn (-> entities :background :scale-fn)
@@ -58,9 +58,14 @@
(defn talk [target-id text]
(fn [screen entities]
(run! dialogue/talking-screen :on-talk :text text
:x (get-in entities [target-id :x]) :y (+ (get-in entities [target-id :y]) 35)
:target-id target-id)
(-> entities
(update-in [target-id :actions] rest)
(assoc-in [target-id :anim] (get-in entities [target-id :talk])))))
(let [target-y (get-in entities [target-id :y])
scale-fn (get-in entities [:background :scale-fn])
scale (scale-fn target-y)
height (* scale 36)]
(run! dialogue/talking-screen :on-talk :text text
:x (get-in entities [target-id :x]) :y (+ (get-in entities [target-id :y]) height)
:target-id target-id
:scale scale)
(-> entities
(update-in [target-id :actions] rest)
(assoc-in [target-id :anim] (get-in entities [target-id :talk]))))))