diff --git a/build.boot b/build.boot index 17a8cd1..06ebae4 100644 --- a/build.boot +++ b/build.boot @@ -9,7 +9,6 @@ [org.clojure/tools.nrepl "0.2.12" :scope "test"] [adzerk/boot-reload "0.5.2" :scope "test"] [adzerk/boot-test "1.2.0" :scope "test"] - [crisptrutski/boot-cljs-test "0.3.5-SNAPSHOT" :scope "test"] [pandeiro/boot-http "0.8.3" :scope "test"] [javax.xml.bind/jaxb-api "2.3.0" :scope "test"] ; necessary for Java 9 compatibility ; project deps @@ -23,7 +22,6 @@ '[adzerk.boot-cljs-repl :refer [cljs-repl start-repl]] '[adzerk.boot-reload :refer [reload]] '[adzerk.boot-test :refer :all] - '[crisptrutski.boot-cljs-test :refer [test-cljs]] '[pandeiro.boot-http :refer [serve]]) (deftask run [] diff --git a/src/space_game/grid.cljs b/src/space_game/grid.cljs deleted file mode 100644 index b2e0114..0000000 --- a/src/space_game/grid.cljs +++ /dev/null @@ -1,57 +0,0 @@ -(ns space-game.grid - (:require [play-cljs.core :as p])) - -(defn shift-line-x - "Return a new line ({:x1 x1 :y1 y1 :x2 x2 :y2 y2}) shifted up or down by a given x value." - [line x-shift] - (-> line - (update :x1 + x-shift) - (update :x2 + x-shift))) - -(defn shift-line-y - "Return a new line shifted left or right by a given y value." - [line y-shift] - (-> line - (update :y1 + y-shift) - (update :y2 + y-shift))) - -(defn repeat-lines-x - "Given an initial line, construct a list of that line plus a given number of repeats of that line, shifted x amount" - [init-line num-squares x-shift] - (let [num-reps (+ 1 num-squares)] ;; number of lines to generate = squares + 1 - (for [i (range num-reps)] - (shift-line-x init-line (* i x-shift))))) - -(defn repeat-lines-y - "Given an initial line, construct a list of that line plus a given number of repeats of that line, shifted y amount" - [init-line num-squares y-shift] - (let [num-reps (+ 1 num-squares)] ;; number of lines to generate = squares + 1 - (for [i (range num-reps)] - (shift-line-y init-line (* i y-shift))))) - -(defn coordinates-to-line-element - "A helper function to put a map of coordinates in a line display element." - [coordinates] - [:line coordinates]) - -(defn square-grid - "Draw a square grid with given number of squares along a side, of the given - square width." - [game num-squares square-width] - (let [window-width (p/get-width game) - window-height (p/get-height game) - grid-width (* num-squares square-width) - width-center (/ window-width 2) - height-center (/ window-height 2) - half-line-width (/ grid-width 2) - top-line-left-x (int (- width-center half-line-width)) - top-line-right-x (int (+ width-center half-line-width)) - left-line-top-y (int (- height-center half-line-width)) - left-line-bottom-y (int (+ height-center half-line-width)) - top-line {:x1 top-line-left-x :y1 left-line-top-y :x2 top-line-right-x :y2 left-line-top-y} - left-line {:x1 top-line-left-x :y1 left-line-top-y :x2 top-line-left-x :y2 left-line-bottom-y} - grid - (map coordinates-to-line-element - (concat (repeat-lines-x left-line num-squares square-width) - (repeat-lines-y top-line num-squares square-width)))] - grid)) \ No newline at end of file diff --git a/test/space_game/grid_test.cljs b/test/space_game/grid_test.cljs deleted file mode 100644 index a152dea..0000000 --- a/test/space_game/grid_test.cljs +++ /dev/null @@ -1,9 +0,0 @@ -(ns space-game.grid-test - (:require-macros [cljs.test :refer [deftest testing is]]) - (:require [cljs.test] - [space-game.grid :as grid])) - -(deftest shift-line-x-test [] - (let [base-line {:x1 0 :x2 0 :y1 0 :y2 0} - expected-line {:x1 5 :x2 5 :y1 0 :y2 0}] - (is (= expected-line (grid/shift-line-x base-line 5)))))