resizing is well on its way to working.
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
[clojure.edn :as edn])
|
||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion]
|
||||
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||
[com.badlogic.gdx.scenes.scene2d Actor Stage]
|
||||
[java.lang Object]))
|
||||
|
||||
(defn log-coords [screen entities]
|
||||
@@ -148,3 +150,21 @@
|
||||
current-time-music (musics (get-in entities [:room :music time]))]
|
||||
(or override-music current-music current-time-music)))
|
||||
|
||||
|
||||
(defn setup-viewport [screen width height]
|
||||
(let [cam (orthographic)
|
||||
viewport (FitViewport. width height cam)
|
||||
stage (Stage. viewport)]
|
||||
(update! screen :renderer stage :viewport viewport :camera cam)
|
||||
(.apply viewport)
|
||||
[cam viewport stage]))
|
||||
|
||||
(defn unproject [screen]
|
||||
(let [pj (.unproject (:viewport screen) (vector-2 (:input-x screen) (:input-y screen)))
|
||||
x (.x pj)
|
||||
y (.y pj)]
|
||||
[x y]))
|
||||
|
||||
(defn contains? [x1 y1 width height x y]
|
||||
(and (< x1 x (+ x1 width))
|
||||
(< y1 y (+ y1 height))))
|
||||
|
||||
Reference in New Issue
Block a user