perf improvements, mobile working on i4s
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
[play-clj.ui :refer :all]
|
||||
[play-clj.utils :refer :all]
|
||||
[play-clj.g2d :refer :all]
|
||||
[clojure.tools.logging :as log]
|
||||
[clojure.set :as set]
|
||||
[advent.pathfind]
|
||||
[advent.tween :as tween]
|
||||
@@ -322,6 +323,7 @@
|
||||
(and utils/mobile? action-cursor (not item-cursor) (not= :main action-cursor))
|
||||
(assoc-in [:action-icon]
|
||||
(assoc
|
||||
;; todo reflection here
|
||||
(texture (aget all-icons 0 (.indexOf utils/+all-cursors+ (or item-cursor action-cursor))))
|
||||
:x (* utils/ui-scale 32 4) :y (* utils/ui-scale 4)
|
||||
:width (* 18 4 utils/ui-scale) :height (* 16 4 utils/ui-scale)))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
(ns advent.screens.rooms
|
||||
(:require [advent.zone :as zone])
|
||||
(:require [advent.zone :as zone]
|
||||
[advent.utils :as utils])
|
||||
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion]
|
||||
[com.badlogic.gdx.utils.viewport FitViewport]
|
||||
@@ -10,20 +11,21 @@
|
||||
(merge entity
|
||||
{:id id
|
||||
:mouse-in? (fn [entities x y]
|
||||
(if-let [box (get-in entities [:room :entities id :box])]
|
||||
((apply zone/box box) x y)
|
||||
(let [{entity-x :x entity-y :y width :width scale-x :scale-x scale-y :scale-y origin-x :origin-x origin-y :origin-y height :height region :object} (get-in entities [:room :entities id])
|
||||
|
||||
width (or width (if (instance? TextureRegion region ) (.getRegionWidth ^TextureRegion region) 0))
|
||||
height (or height (if (instance? TextureRegion region ) (.getRegionHeight ^TextureRegion region) 0))
|
||||
entity-x (- entity-x (* (or origin-x 0)
|
||||
(or scale-x 1)))
|
||||
entity-y (- entity-y (* (or origin-y 0)
|
||||
(or scale-y 1)))]
|
||||
|
||||
((zone/box entity-x entity-y
|
||||
(+ entity-x (* width (or scale-x 1)))
|
||||
(+ entity-y (* height (or scale-y 1)))) x y))))}
|
||||
(let [e (utils/get-entity entities id)]
|
||||
(if-let [[bx1 by1 bx2 by2] (:box e)]
|
||||
(zone/within bx1 by1 bx2 by2 x y)
|
||||
(let [{entity-x :x entity-y :y width :width scale-x :scale-x scale-y :scale-y origin-x :origin-x origin-y :origin-y height :height region :object} (get-in entities [:room :entities id])
|
||||
|
||||
width (or width (if (instance? TextureRegion region ) (.getRegionWidth ^TextureRegion region) 0))
|
||||
height (or height (if (instance? TextureRegion region ) (.getRegionHeight ^TextureRegion region) 0))
|
||||
entity-x (unchecked-add (float entity-x) (unchecked-multiply (float (or origin-x 0))
|
||||
(float (or scale-x 1))))
|
||||
entity-y (unchecked-add (float entity-y) (unchecked-multiply (float (or origin-y 0))
|
||||
(float (or scale-y 1))))]
|
||||
|
||||
(zone/within entity-x entity-y
|
||||
(unchecked-add (float entity-x) (unchecked-multiply (float width) (float (or scale-x 1))))
|
||||
(unchecked-add (float entity-y) (unchecked-multiply (float height) (float (or scale-y 1)))) x y)))))}
|
||||
(when (or script scripts only-script)
|
||||
{:get-script (fn [cursor [x y]]
|
||||
(cond only-script
|
||||
@@ -43,7 +45,8 @@
|
||||
(merge spec
|
||||
(when box
|
||||
{:mouse-in? (fn [_ x y]
|
||||
((apply zone/box box) x y))})
|
||||
(let [[bx1 by1 bx2 by2] box]
|
||||
(zone/within bx1 by1 bx2 by2 x y)))})
|
||||
(when (or script scripts only-script)
|
||||
{:get-script (fn [cursor [x y]]
|
||||
(cond only-script
|
||||
@@ -61,7 +64,6 @@
|
||||
{:id id}))
|
||||
entities (into {} (for [[id entity] entities]
|
||||
[id (make-entity id entity)]))]
|
||||
(println "MAKING")
|
||||
(merge params {:collision (advent.pathfind/map-from-resource collision)
|
||||
:interactions interactions-as-list
|
||||
:entities entities})))
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
[advent.screens.dialogue :refer [talking-screen toast-screen tooltip-screen]]
|
||||
[advent.screens.inventory :refer [inventory-screen]]
|
||||
|
||||
[clojure.core.async :refer [put! <! <!! >! chan go thread take! alts!! dropping-buffer]])
|
||||
[clojure.core.async :refer [put! poll! <! <!! >! chan go thread take! alts!! dropping-buffer]])
|
||||
(:import [com.badlogic.gdx.graphics Pixmap$Format Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30]
|
||||
[com.badlogic.gdx.graphics.g2d TextureRegion Animation Batch]
|
||||
[com.badlogic.gdx.math Vector3 Matrix4]
|
||||
@@ -773,7 +773,7 @@
|
||||
(let [{{:keys [script-running? script-chan]} key} entities]
|
||||
(if script-running?
|
||||
entities
|
||||
(let [next-script (<! script-chan)]
|
||||
(let [next-script (poll! script-chan)]
|
||||
(if next-script
|
||||
(do
|
||||
(next-script entities)
|
||||
@@ -795,7 +795,7 @@
|
||||
(update-in terminated [key] assoc :current nil :started? false)
|
||||
key))
|
||||
(assoc-in entities [key :started?] true)))
|
||||
(let [current (<! channel)]
|
||||
(let [current (poll! channel)]
|
||||
|
||||
(-> entities
|
||||
(assoc-in [key :started?] false)
|
||||
@@ -861,17 +861,17 @@
|
||||
(if (and (= current-frame-index (:current-frame-index entity) (:previous-frame-index entity))
|
||||
(not (:force-rerender entity)))
|
||||
entity
|
||||
(merge (assoc entity
|
||||
:object (.getKeyFrame ^Animation anim (- total-time anim-start) anim-loop?)
|
||||
:force-rerender nil
|
||||
:current-frame-index current-frame-index
|
||||
:previous-frame-index previous-frame-index
|
||||
:origin-x (or (-> entity :anim-origins (get anim) (nth 0))
|
||||
(:base-origin-x entity)
|
||||
(:origin-x entity))
|
||||
:origin-y (or (-> entity :anim-origins (get anim) (nth 1))
|
||||
(:base-origin-y entity)
|
||||
(:origin-y entity)))
|
||||
(merge (-> entity
|
||||
(assoc :object (.getKeyFrame ^Animation anim (- total-time anim-start) anim-loop?))
|
||||
(assoc :force-rerender nil)
|
||||
(assoc :current-frame-index current-frame-index)
|
||||
(assoc :previous-frame-index previous-frame-index)
|
||||
(assoc :origin-x (or (-> entity :anim-origins (get anim) (nth 0))
|
||||
(:base-origin-x entity)
|
||||
(:origin-x entity)))
|
||||
(assoc :origin-y (or (-> entity :anim-origins (get anim) (nth 1))
|
||||
(:base-origin-y entity)
|
||||
(:origin-y entity))))
|
||||
(or (-> entity :anim-merges (get anim))
|
||||
(-> entity :anim-merges :default))))))
|
||||
|
||||
@@ -986,6 +986,8 @@
|
||||
(Matrix4/mul (.val parallax-combined) (.val parallax-view))
|
||||
|
||||
|
||||
;; todo turn this into a thing that overrides projection matrices
|
||||
;; and renders using regular render
|
||||
(let [^Batch batch (.getBatch renderer)]
|
||||
|
||||
|
||||
@@ -1068,6 +1070,120 @@
|
||||
(defn remove-cam-tweens [entities]
|
||||
(update-in entities [:tweens] dissoc :cam-x :cam-y :cam-zoom))
|
||||
|
||||
(defn render [{:keys [^OrthographicCamera camera ^FitViewport viewport ^Stage renderer] :as screen} {{:keys [last-pos ] [cursor-offset-x cursor-offset-y] :offset} :cursor :keys [tweens] :as entities} options]
|
||||
#_(steam/update)
|
||||
(.apply viewport)
|
||||
|
||||
(if (get-in entities [:closing? :value])
|
||||
|
||||
(let [entities (utils/apply-tweens screen entities tweens)
|
||||
entities (update-current-sound-vols! entities)
|
||||
entities (remove-ended-sounds screen entities)
|
||||
get-rendered (partial get-rendered entities)
|
||||
entities (loop [entities entities
|
||||
[[k e] & rest] (seq (get-in entities [:room :entities]))]
|
||||
(if k
|
||||
(recur (update-in entities [:room :entities k] get-rendered) rest)
|
||||
entities))
|
||||
entities (grab-layers entities)
|
||||
layers (get-in entities [:room :current-layers])
|
||||
all-entities (-> layers (into (vals (get-in entities [:room :entities]))) (conj (:white-fade entities)))]
|
||||
(screen! fade-screen :update-fade {:opacity (get-in entities [:fade :opacity])})
|
||||
(doseq [m (vals (get-in entities [:musics]))]
|
||||
(when m
|
||||
(music! m :set-volume (utils/current-music-volume (get-in entities [:volume :value])))))
|
||||
|
||||
(clear!)
|
||||
(doseq [e (sort-by :baseline all-entities)]
|
||||
(if (:parallax e)
|
||||
(render-parallax screen e)
|
||||
(render! screen [e])))
|
||||
entities)
|
||||
(let [entities (fade-in-first-time-if-necessary screen entities)
|
||||
entities (utils/apply-tweens screen entities tweens)
|
||||
entities (update-cursor screen entities)
|
||||
entities (start-script-if-necessary screen entities :fg-actions)
|
||||
entities (update-from-script screen entities :fg-actions)
|
||||
entities (start-script-if-necessary screen entities :bg-actions)
|
||||
entities (update-from-script screen entities :bg-actions)
|
||||
entities (update-from-room screen entities)
|
||||
entities (update-from-hotspots screen entities)
|
||||
[last-pos-x last-pos-y] (utils/unproject screen nil last-pos)
|
||||
last-pos-x (double last-pos-x)
|
||||
last-pos-y (double last-pos-y)
|
||||
entities (if (and (@utils/settings :camera-man? true)
|
||||
(not (get-in entities [:cam :paused?]))
|
||||
(nil? (get-in entities [:tweens :cam-x]))
|
||||
(= 1 (rand-int 20)))
|
||||
(if (= (rand-int 2) 1)
|
||||
(actions/pan-to screen entities
|
||||
(get-in entities [:room :entities :ego :x])
|
||||
(get-in entities [:room :entities :ego :y])
|
||||
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
||||
tween/ease-in-out-quadratic
|
||||
5.0)
|
||||
(actions/pan-to screen entities
|
||||
(+ ^double (get-in entities [:cam :x] 0)
|
||||
(- 10 ^double (rand-int 20)))
|
||||
(+ ^double (get-in entities [:cam :y] 0)
|
||||
(- 10 ^double (rand-int 20)))
|
||||
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
||||
tween/ease-in-out-quadratic
|
||||
5.0))
|
||||
entities)
|
||||
|
||||
|
||||
entities (grab-layers entities)
|
||||
update-room (fn [{:keys [anim update-fn] :as e}]
|
||||
(let [e (if (:anim e)
|
||||
(animate e screen)
|
||||
e)
|
||||
|
||||
e (if update-fn
|
||||
(update-fn screen (get-in entities [:room :entities]) e)
|
||||
e)
|
||||
e (get-rendered entities e)]
|
||||
e))
|
||||
entities (loop [room (transient (get-in entities [:room :entities]))
|
||||
[[k e] & rest] (doall (seq (get-in entities [:room :entities])))]
|
||||
(if k
|
||||
(recur (assoc! room k (update-room e))
|
||||
rest)
|
||||
(assoc-in entities [:room :entities] (persistent! room))))
|
||||
layers (get-in entities [:room :current-layers])
|
||||
all-entities (-> layers (into (vals (get-in entities [:room :entities]))) (conj (:white-fade entities)))]
|
||||
|
||||
(screen! tooltip-screen :on-hover-start {:hover-text (get-in entities [:label :text])
|
||||
:scene-viewport (:viewport screen)
|
||||
:cursor (:cursor entities)
|
||||
:x (unchecked-subtract last-pos-x
|
||||
cursor-offset-x)
|
||||
:y (unchecked-add (unchecked-subtract last-pos-y 16 )
|
||||
cursor-offset-y)})
|
||||
|
||||
(clear!)
|
||||
(screen! talking-screen :on-update-camera { :scene-viewport (:viewport screen) :scene-camera (:camera screen)})
|
||||
(screen! fade-screen :update-fade { :opacity (get-in entities [:fade :opacity])})
|
||||
(when true #_(not (get-in entities [:cam :paused?]))
|
||||
(set! (. camera zoom) (:zoom (:cam entities)))
|
||||
(set! (.. camera position x) (:x (:cam entities) 160.0))
|
||||
(set! (.. camera position y) (:y (:cam entities) 120.0)))
|
||||
(let [entities (if utils/mobile?
|
||||
(utils/update-override screen entities options)
|
||||
(utils/update-override screen entities options))
|
||||
entities (play-key-sounds screen entities)
|
||||
entities (update-current-sound-vols! entities)
|
||||
entities (remove-ended-sounds screen entities)]
|
||||
(doseq [m (vals (get-in entities [:musics]))]
|
||||
(when m
|
||||
(music! m :set-volume (utils/current-music-volume (get-in entities [:volume :value])))))
|
||||
(doseq [e (doall (sort-by :baseline all-entities))]
|
||||
(if (:parallax e)
|
||||
(render-parallax screen e)
|
||||
(render! screen [e])))
|
||||
|
||||
entities))))
|
||||
|
||||
|
||||
(defscreen scene
|
||||
:on-timer
|
||||
@@ -1123,14 +1239,14 @@
|
||||
:inside-antique (utils/make-music "music/inside-antique.ogg")
|
||||
:town-1 (utils/make-music "music/town-music-1.ogg")
|
||||
:town-2 (utils/make-music "music/town-music-2.ogg")
|
||||
#_#_:love (utils/make-music "music/love.ogg")
|
||||
#_#_:inside-fangald (utils/make-music "music/inside-fangald.ogg")
|
||||
#_#_:fight (utils/make-music "music/megaboss.mp3")
|
||||
#_#_:pull-sword (utils/make-music "music/pull-sword.ogg")
|
||||
#_#_:night (utils/make-music "music/night.ogg")
|
||||
#_#_:dream (utils/make-music "dream/music.ogg")
|
||||
#_#_:secret-hideout (utils/make-music "music/secret-hideout.ogg")
|
||||
#_#_:wind (utils/make-music "music/wind.ogg")}
|
||||
:love (utils/make-music "music/love.ogg")
|
||||
:inside-fangald (utils/make-music "music/inside-fangald.ogg")
|
||||
:fight (utils/make-music "music/megaboss.mp3")
|
||||
:pull-sword (utils/make-music "music/pull-sword.ogg")
|
||||
:night (utils/make-music "music/night.ogg")
|
||||
:dream (utils/make-music "dream/music.ogg")
|
||||
:secret-hideout (utils/make-music "music/secret-hideout.ogg")
|
||||
:wind (utils/make-music "music/wind.ogg")}
|
||||
:state state
|
||||
:time-profiles {:object nil
|
||||
:default utils/default-night-merge
|
||||
@@ -1268,120 +1384,8 @@
|
||||
|
||||
(update-in entities [:cam :zoom] #(* % (+ 1 (/ (double (:amount options)) 10.0 )))))
|
||||
|
||||
:on-render
|
||||
(fn [{:keys [^OrthographicCamera camera ^FitViewport viewport ^Stage renderer] :as screen} {{:keys [last-pos ] [cursor-offset-x cursor-offset-y] :offset} :cursor :keys [tweens] :as entities} options]
|
||||
#_(steam/update)
|
||||
(.apply viewport)
|
||||
|
||||
(if (get-in entities [:closing? :value])
|
||||
|
||||
(let [entities (utils/apply-tweens screen entities tweens)
|
||||
entities (update-current-sound-vols! entities)
|
||||
entities (remove-ended-sounds screen entities)
|
||||
get-rendered (partial get-rendered entities)
|
||||
entities (loop [entities entities
|
||||
[[k e] & rest] (seq (get-in entities [:room :entities]))]
|
||||
(if k
|
||||
(recur (update-in entities [:room :entities k] get-rendered) rest)
|
||||
entities))
|
||||
entities (grab-layers entities)
|
||||
layers (get-in entities [:room :current-layers])
|
||||
all-entities (concat layers (vals (get-in entities [:room :entities])) [(:white-fade entities)])]
|
||||
(screen! fade-screen :update-fade {:opacity (get-in entities [:fade :opacity])})
|
||||
(doseq [m (vals (get-in entities [:musics]))]
|
||||
(when m
|
||||
(music! m :set-volume (utils/current-music-volume (get-in entities [:volume :value])))))
|
||||
|
||||
(clear!)
|
||||
(doseq [e (sort-by :baseline all-entities)]
|
||||
(if (:parallax e)
|
||||
(render-parallax screen e)
|
||||
(render! screen [e])))
|
||||
entities)
|
||||
(let [entities (fade-in-first-time-if-necessary screen entities)
|
||||
entities (utils/apply-tweens screen entities tweens)
|
||||
entities (update-cursor screen entities)
|
||||
entities (start-script-if-necessary screen entities :fg-actions)
|
||||
entities (update-from-script screen entities :fg-actions)
|
||||
entities (start-script-if-necessary screen entities :bg-actions)
|
||||
entities (update-from-script screen entities :bg-actions)
|
||||
entities (update-from-room screen entities)
|
||||
entities (update-from-hotspots screen entities)
|
||||
[last-pos-x last-pos-y] (utils/unproject screen nil last-pos)
|
||||
last-pos-x (double last-pos-x)
|
||||
last-pos-y (double last-pos-y)
|
||||
entities (if (and (@utils/settings :camera-man? true)
|
||||
(not (get-in entities [:cam :paused?]))
|
||||
(nil? (get-in entities [:tweens :cam-x]))
|
||||
(= 1 (rand-int 20)))
|
||||
(if (= (rand-int 2) 1)
|
||||
(actions/pan-to screen entities
|
||||
(get-in entities [:room :entities :ego :x])
|
||||
(get-in entities [:room :entities :ego :y])
|
||||
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
||||
tween/ease-in-out-quadratic
|
||||
5.0)
|
||||
(actions/pan-to screen entities
|
||||
(+ ^double (get-in entities [:cam :x] 0)
|
||||
(- 10 ^double (rand-int 20)))
|
||||
(+ ^double (get-in entities [:cam :y] 0)
|
||||
(- 10 ^double (rand-int 20)))
|
||||
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
||||
tween/ease-in-out-quadratic
|
||||
5.0))
|
||||
entities)
|
||||
|
||||
|
||||
entities (grab-layers entities)
|
||||
update-room (fn [{:keys [anim update-fn] :as e}]
|
||||
(let [e (if (:anim e)
|
||||
(animate e screen)
|
||||
e)
|
||||
|
||||
e (if update-fn
|
||||
(update-fn screen (get-in entities [:room :entities]) e)
|
||||
e)
|
||||
e (get-rendered entities e)]
|
||||
e))
|
||||
entities (loop [room (transient (get-in entities [:room :entities]))
|
||||
[[k e] & rest] (doall (seq (get-in entities [:room :entities])))]
|
||||
(if k
|
||||
(recur (assoc! room k (update-room e))
|
||||
rest)
|
||||
(assoc-in entities [:room :entities] (persistent! room))))
|
||||
layers (get-in entities [:room :current-layers])
|
||||
all-entities (concat layers (vals (get-in entities [:room :entities])) [(:white-fade entities)])]
|
||||
|
||||
(screen! tooltip-screen :on-hover-start {:hover-text (get-in entities [:label :text])
|
||||
:scene-viewport (:viewport screen)
|
||||
:cursor (:cursor entities)
|
||||
:x (unchecked-subtract last-pos-x
|
||||
cursor-offset-x)
|
||||
:y (unchecked-add (unchecked-subtract last-pos-y 16 )
|
||||
cursor-offset-y)})
|
||||
|
||||
(clear!)
|
||||
(screen! talking-screen :on-update-camera { :scene-viewport (:viewport screen) :scene-camera (:camera screen)})
|
||||
(screen! fade-screen :update-fade { :opacity (get-in entities [:fade :opacity])})
|
||||
(when true #_(not (get-in entities [:cam :paused?]))
|
||||
(set! (. camera zoom) (:zoom (:cam entities)))
|
||||
(set! (.. camera position x) (:x (:cam entities) 160.0))
|
||||
(set! (.. camera position y) (:y (:cam entities) 120.0)))
|
||||
(let [entities (if utils/mobile?
|
||||
(utils/update-override screen entities options)
|
||||
(utils/update-override screen entities options))
|
||||
entities (play-key-sounds screen entities)
|
||||
entities (update-current-sound-vols! entities)
|
||||
entities (remove-ended-sounds screen entities)]
|
||||
(doseq [m (vals (get-in entities [:musics]))]
|
||||
(when m
|
||||
(music! m :set-volume (utils/current-music-volume (get-in entities [:volume :value])))))
|
||||
(doseq [e (doall (sort-by :baseline all-entities))]
|
||||
(if (:parallax e)
|
||||
(render-parallax screen e)
|
||||
(render! screen [e])))
|
||||
|
||||
entities))))
|
||||
:on-render render
|
||||
|
||||
|
||||
:on-resize (fn [{:keys [^FitViewport viewport]} entities {:keys [width height]}]
|
||||
(.update viewport width height true))
|
||||
|
||||
@@ -128,15 +128,19 @@
|
||||
|
||||
(defonce selected-save (atom nil))
|
||||
|
||||
(defn current-music-volume [& [^double factor]]
|
||||
(-> (Math/pow (unchecked-multiply (:music-volume @settings) 0.01) 2)
|
||||
(unchecked-multiply 0.25)
|
||||
(unchecked-multiply (or factor 1.0))))
|
||||
(defn current-music-volume
|
||||
([] (current-music-volume 1.0))
|
||||
([^double factor]
|
||||
(-> (Math/pow (unchecked-multiply (:music-volume @settings) 0.01) 2)
|
||||
(unchecked-multiply 0.25)
|
||||
(unchecked-multiply (double factor)))))
|
||||
|
||||
(defn current-sound-volume [& [factor]]
|
||||
(-> (Math/pow (unchecked-multiply (:sound-volume @settings) 0.01) 2)
|
||||
(unchecked-multiply 0.5)
|
||||
(unchecked-multiply (or factor 1.0))))
|
||||
(defn current-sound-volume
|
||||
([] (current-sound-volume 1.0))
|
||||
([^double factor]
|
||||
(-> (Math/pow (unchecked-multiply (:sound-volume @settings) 0.01) 2)
|
||||
(unchecked-multiply 0.5)
|
||||
(unchecked-multiply (double factor)))))
|
||||
|
||||
(defn cursor [filename which]
|
||||
(let [scale 4
|
||||
@@ -700,7 +704,7 @@
|
||||
entities)))
|
||||
|
||||
(defn stop-all-sounds! [entities]
|
||||
(doseq [snd (get-in entities [:current-sounds :value])]
|
||||
(doseq [snd (get-in entities [:current-sounds :value] [])]
|
||||
(sound! (:sound snd) :stop (:id snd))))
|
||||
|
||||
(defn translate-depressed [cursor depressed?]
|
||||
@@ -714,3 +718,6 @@
|
||||
(min (- length (* length 0.5 zoom ))
|
||||
(max (* length 0.5 zoom )
|
||||
x)))
|
||||
|
||||
(defn get-entity [entities id]
|
||||
((:entities (:room entities)) id))
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
(ns advent.zone)
|
||||
|
||||
(defn within [x1 y1 x2 y2 x3 y3]
|
||||
(and
|
||||
(< x1 x3)
|
||||
(< x3 x2)
|
||||
(< y1 y3)
|
||||
(< y3 y2)))
|
||||
|
||||
(defn box [x1 y1 x2 y2]
|
||||
(fn [x y]
|
||||
(and
|
||||
(< x1 x x2)
|
||||
(< y1 y y2))))
|
||||
(within x1 y1 x2 y2 x y)))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user