Preparation to work client-side.
This commit is contained in:
parent
6237eab0cd
commit
b9ee9d138a
10
buildall.sh
10
buildall.sh
|
@ -93,6 +93,8 @@ do
|
||||||
# 'build' is the expected normal case.
|
# 'build' is the expected normal case.
|
||||||
trial="FALSE";
|
trial="FALSE";
|
||||||
;;
|
;;
|
||||||
|
-d|-docker)
|
||||||
|
docker="TRUE";;
|
||||||
-e|-email)
|
-e|-email)
|
||||||
shift;
|
shift;
|
||||||
email=$1;;
|
email=$1;;
|
||||||
|
@ -126,7 +128,7 @@ do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Trial: ${trial}; email: ${email}; fullname ${fullname}; release: ${release}; webapps: $webappsdir"
|
echo "Trial: ${trial}; docker: ${docker}; email: ${email}; fullname ${fullname}; release: ${release}; webapps: $webappsdir"
|
||||||
|
|
||||||
ls mw-* > /dev/null 2>&1
|
ls mw-* > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
|
@ -205,6 +207,12 @@ do
|
||||||
echo "Deployed new WAR file to local Tomcat at ${webappsdir}"
|
echo "Deployed new WAR file to local Tomcat at ${webappsdir}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${dir}" = "mw-ui" -a "${docker}" = "TRUE" ]
|
||||||
|
then
|
||||||
|
lein docker build
|
||||||
|
lein docker push
|
||||||
|
fi
|
||||||
|
|
||||||
# Then unset manifest properties prior to committing.
|
# Then unset manifest properties prior to committing.
|
||||||
cat project.clj > ${tmp}/project.bak.2
|
cat project.clj > ${tmp}/project.bak.2
|
||||||
setup-build-sig
|
setup-build-sig
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
}
|
}
|
||||||
:jvm-opts ["-Xmx4g"]
|
:jvm-opts ["-Xmx4g"]
|
||||||
:source-paths ["src/clj" "src/cljc"]
|
:source-paths ["src/clj" "src/cljc"]
|
||||||
|
:resource-paths ["resources"]
|
||||||
:license {:name "GNU General Public License v2"
|
:license {:name "GNU General Public License v2"
|
||||||
:url "http://www.gnu.org/licenses/gpl-2.0.html"}
|
:url "http://www.gnu.org/licenses/gpl-2.0.html"}
|
||||||
:plugins [[lein-marginalia "0.7.1"]]
|
:plugins [[lein-marginalia "0.7.1"]]
|
||||||
|
@ -18,5 +19,4 @@
|
||||||
[org.clojure/tools.trace "0.7.8"]
|
[org.clojure/tools.trace "0.7.8"]
|
||||||
[org.clojure/tools.namespace "0.2.10"]
|
[org.clojure/tools.namespace "0.2.10"]
|
||||||
[hiccup "1.0.5"]
|
[hiccup "1.0.5"]
|
||||||
[net.mikera/imagez "0.11.0"]
|
[net.mikera/imagez "0.11.0"]])
|
||||||
[fivetonine/collage "0.2.1"]])
|
|
||||||
|
|
|
@ -56,8 +56,10 @@
|
||||||
"Apply a single `rule` to a `cell`. What this is about is that I want to be able,
|
"Apply a single `rule` to a `cell`. What this is about is that I want to be able,
|
||||||
for debugging purposes, to tag a cell with the rule text of the rule which
|
for debugging purposes, to tag a cell with the rule text of the rule which
|
||||||
fired (and especially so when an exception is thrown. So a rule may be either
|
fired (and especially so when an exception is thrown. So a rule may be either
|
||||||
an ifn, or a list (ifn source-text). This function deals with despatching
|
an ifn, a list (ifn source-text), or a list (ifn {:rule source-text :clojure
|
||||||
on those two possibilities. `world` is also passed in in order to be able
|
generated-function}.
|
||||||
|
This function deals with despatching on those three possibilities. `world`
|
||||||
|
is also passed in in order to be able
|
||||||
to access neighbours."
|
to access neighbours."
|
||||||
([world cell rule]
|
([world cell rule]
|
||||||
(cond
|
(cond
|
||||||
|
@ -66,6 +68,7 @@
|
||||||
([world cell rule source]
|
([world cell rule source]
|
||||||
(let [result (apply rule (list cell world))]
|
(let [result (apply rule (list cell world))]
|
||||||
(cond
|
(cond
|
||||||
|
(and result source (map? source)) (merge result source)
|
||||||
(and result source) (merge result {:rule source})
|
(and result source) (merge result {:rule source})
|
||||||
true result))))
|
true result))))
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
:author "Simon Brooke"}
|
:author "Simon Brooke"}
|
||||||
microworld.engine.heightmap
|
microworld.engine.heightmap
|
||||||
(:import [java.awt.image BufferedImage])
|
(:import [java.awt.image BufferedImage])
|
||||||
(:require [fivetonine.collage.util :as collage :only [load-image]]
|
(:require [mikera.image.core :as imagez :only [filter-image get-pixels]]
|
||||||
[mikera.image.core :as imagez :only [filter-image get-pixels]]
|
|
||||||
[mikera.image.filters :as filters]
|
[mikera.image.filters :as filters]
|
||||||
[microworld.engine.utils :refer [abs get-int get-neighbours map-world]]
|
[microworld.engine.utils :refer [abs get-int get-neighbours map-world]]
|
||||||
[microworld.engine.world :refer [make-world]]))
|
[microworld.engine.world :refer [make-world]]))
|
||||||
|
@ -107,15 +106,15 @@
|
||||||
* `imagepath` a file path or URL which indicates an (ideally greyscale) image file."
|
* `imagepath` a file path or URL which indicates an (ideally greyscale) image file."
|
||||||
([world imagepath]
|
([world imagepath]
|
||||||
(let [heightmap (imagez/filter-image
|
(let [heightmap (imagez/filter-image
|
||||||
(filters/grayscale)
|
(imagez/load-image-resource imagepath)
|
||||||
(collage/load-image imagepath))]
|
(filters/grayscale))]
|
||||||
(map-world
|
(map-world
|
||||||
(map-world world tag-altitude (list heightmap))
|
(map-world world tag-altitude (list heightmap))
|
||||||
tag-gradient)))
|
tag-gradient)))
|
||||||
([imagepath]
|
([imagepath]
|
||||||
(let [heightmap (imagez/filter-image
|
(let [heightmap (imagez/filter-image
|
||||||
(filters/grayscale)
|
(imagez/load-image-resource imagepath)
|
||||||
(collage/load-image imagepath))
|
(filters/grayscale))
|
||||||
world (make-world (.getWidth heightmap) (.getHeight heightmap))]
|
world (make-world (.getWidth heightmap) (.getHeight heightmap))]
|
||||||
(map-world
|
(map-world
|
||||||
(map-world world tag-altitude (list heightmap))
|
(map-world world tag-altitude (list heightmap))
|
||||||
|
@ -132,6 +131,6 @@
|
||||||
intensity of the corresponding cell of the image."
|
intensity of the corresponding cell of the image."
|
||||||
[world imagepath property]
|
[world imagepath property]
|
||||||
(let [heightmap (imagez/filter-image
|
(let [heightmap (imagez/filter-image
|
||||||
(filters/grayscale)
|
(imagez/load-image-resource imagepath)
|
||||||
(collage/load-image imagepath))]
|
(filters/grayscale))]
|
||||||
(map-world world tag-property (list property heightmap))))
|
(map-world world tag-property (list property heightmap))))
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
(deftest apply-heightmap-test
|
(deftest apply-heightmap-test
|
||||||
(testing "Heightmap functionality"
|
(testing "Heightmap functionality"
|
||||||
(let [world (apply-heightmap (as-file "resources/heightmaps/test9x9.png"))
|
(let [world (apply-heightmap "heightmaps/test9x9.png")
|
||||||
altitudes (map #(:altitude %) (flatten world))
|
altitudes (map #(:altitude %) (flatten world))
|
||||||
gradients (map #(:gradient %) (flatten world))]
|
gradients (map #(:gradient %) (flatten world))]
|
||||||
(is (= (count world) 9) "World should be 9x9")
|
(is (= (count world) 9) "World should be 9x9")
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
(is (> (apply + gradients) 0)
|
(is (> (apply + gradients) 0)
|
||||||
"At least some gradients must be positive, none should be negative"))
|
"At least some gradients must be positive, none should be negative"))
|
||||||
;; alternate means of making the world, same tests.
|
;; alternate means of making the world, same tests.
|
||||||
(let [world (apply-heightmap (world/make-world 9 9) (as-file "resources/heightmaps/test9x9.png"))
|
(let [world (apply-heightmap (world/make-world 9 9) "heightmaps/test9x9.png")
|
||||||
altitudes (map #(:altitude %) (flatten world))
|
altitudes (map #(:altitude %) (flatten world))
|
||||||
gradients (map #(:gradient %) (flatten world))]
|
gradients (map #(:gradient %) (flatten world))]
|
||||||
(is (= (count world) 9) "World should be 9x9")
|
(is (= (count world) 9) "World should be 9x9")
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
(deftest apply-valuemap-test
|
(deftest apply-valuemap-test
|
||||||
(testing "Valuemap functionality"
|
(testing "Valuemap functionality"
|
||||||
(let [image (as-file "resources/heightmaps/test9x9.png")
|
(let [image "heightmaps/test9x9.png"
|
||||||
world (apply-valuemap (apply-heightmap image) image :arbitrary)
|
world (apply-valuemap (apply-heightmap image) image :arbitrary)
|
||||||
altitudes (map #(:altitude %) (flatten world))
|
altitudes (map #(:altitude %) (flatten world))
|
||||||
arbitraries (map #(:arbitrary %) (flatten world))]
|
arbitraries (map #(:arbitrary %) (flatten world))]
|
||||||
|
|
Loading…
Reference in a new issue