 (defonce key-loop
   (go-loop []
     (when-let [event (<! key-chan)]
-      (swap! app-state dissoc :game)
+      (let [keycode (.. event -keyCode)
+            input (get *keys* (if (<= 96 keycode 105)
+                                (- keycode 48)
+                                keycode))]
+        (swap! app-state assoc :input input))
       (recur))))
 
 (defmulti draw-ui

  (doseq [ui (:uis game)]
    (draw-ui ui game screen)))


(defn game-loop []
  (when-let [screen (:screen @app-state)]
    (let [input (:input @app-state)
          game (:game @app-state)]
      (draw-game game screen)))
  (.requestAnimationFrame js/window #(game-loop)))

(defn init-game! []

(secretary/defroute "/" []
  (swap! app-state assoc
         :current-page :home
         :game {:uis [{:kind :start}]}
         :input nil))

(secretary/defroute "/about" []
  (swap! app-state assoc :current-page :about))
