things are faster, hopefully.
This commit is contained in:
@@ -9,9 +9,10 @@
|
||||
[clojure.edn :as edn]
|
||||
[clojure.string :as str])
|
||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Blending Pixmap$Filter Texture Texture$TextureFilter]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion Animation]
|
||||
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||
[com.badlogic.gdx.scenes.scene2d Actor Stage]
|
||||
[com.badlogic.gdx.math CatmullRomSpline]
|
||||
[com.badlogic.gdx Application Audio Files Game Gdx Graphics Input
|
||||
InputMultiplexer InputProcessor Net Preferences Screen]
|
||||
[java.lang Object]))
|
||||
@@ -79,7 +80,7 @@
|
||||
(let [font (bitmap-font filename)
|
||||
tr (bitmap-font! font :get-region)
|
||||
tx (.getTexture tr)]
|
||||
(texture! tx :set-filter Texture$TextureFilter/Linear Texture$TextureFilter/Linear)
|
||||
(call! ^Texture tx :set-filter Texture$TextureFilter/Linear Texture$TextureFilter/Linear)
|
||||
font))
|
||||
|
||||
(def +screen-width+ 320)
|
||||
@@ -126,12 +127,12 @@
|
||||
(Math/sqrt (+ (* dx dx) (* dy dy)))))
|
||||
|
||||
|
||||
(defn flip [anim]
|
||||
(defn flip [^Animation anim]
|
||||
(animation (animation! anim :get-frame-duration)
|
||||
(for [src-frame (animation! anim :get-key-frames)
|
||||
:let [frame (texture (texture! src-frame :get-texture))]]
|
||||
(do
|
||||
(texture! frame :set-region src-frame)
|
||||
(texture! frame :set-region ^TextureRegion src-frame)
|
||||
(texture! frame :flip true false)
|
||||
frame))))
|
||||
|
||||
@@ -161,7 +162,7 @@
|
||||
(let [speed 0.05
|
||||
pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed)))
|
||||
v (vector-2 0 0)
|
||||
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
|
||||
a (catmull-rom-spline! ^CatmullRomSpline (:path entity) :value-at v pos-f)]
|
||||
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))))
|
||||
|
||||
(defn path-point [speed screen entities entity]
|
||||
@@ -172,7 +173,7 @@
|
||||
(if (:path entity)
|
||||
(let [pos-f (- (path-point speed screen entities entity) (int (* (- (:total-time screen) (:path-start-time entity 0.0)) speed)))
|
||||
v (vector-2 0 0)
|
||||
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
|
||||
a (catmull-rom-spline! ^CatmullRomSpline (:path entity) :value-at v pos-f)]
|
||||
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))
|
||||
entity))
|
||||
|
||||
@@ -217,8 +218,8 @@
|
||||
|
||||
(defn intersects? [e [x y]]
|
||||
(and (:object e)
|
||||
(< (:x e) x (+ (:x e) (or (:width e) (.getWidth (:object e)))))
|
||||
(< (:y e) y (+ (:y e) (or (:height e) (.getHeight (:object e)))))))
|
||||
(< (:x e) x (+ (:x e) (or (:width e) (.getWidth ^Actor (:object e)))))
|
||||
(< (:y e) y (+ (:y e) (or (:height e) (.getHeight ^Actor (:object e)))))))
|
||||
|
||||
(defn get-current-music [entities]
|
||||
(let [time (get-in entities [:state :time])
|
||||
@@ -263,7 +264,7 @@
|
||||
(and is-script-running
|
||||
(= :none (get-in entities [:actions :last-skip-type])))))
|
||||
|
||||
(defn update-override [{:keys [viewport] :as screen} entities]
|
||||
(defn update-override [{:keys [^FitViewport viewport] :as screen} entities]
|
||||
(let [raw-pos (get-in entities [:cursor :last-pos])
|
||||
last-pos (unproject screen raw-pos)
|
||||
mouse-override (find-override entities last-pos)
|
||||
|
||||
Reference in New Issue
Block a user