 (enable-console-print!)
 
 ;; Globals ----------------------------------------------------------
-(def canvas-size {:w 646 :h 400})
+(def canvas-size
+  (let [[w h] [646 400]]
+    {:w w
+     :h h
+     :hw (/ w 2)
+     :hh (/ h 2)}))
 
 (def paddle-offset 12)
 

  (assoc world-state
    :mouse-coords (client->canvas-coords canvas (client-coords event))))

(defn render-scene
  "Loop over the entities calling each ones draw fn."
  [ctx world-state]

                 update-fn
                 (partial draw-rect (:paddle colours))))

(defn center-on [[x y] {:keys [w h] :as obj}]
  (-> obj
      (assoc :x (- x (/ w 2)))
      (assoc :y (- y (/ w 2)))))

(defn center-ball [ball {:keys [hw hh]}]
  (center-on [hw hh] ball))


(defn client->canvas-coords
  "Transforms mouse coords from client space to canvas space.
