 
 (defn init []
   (input/init)
-  (register-listeners))
+  (register-listeners)
+  (print-player))
 
 (defn update [delta]
   (let [x (Mouse/getX)

(defn rotate-direction [direction axis angle]
  (assoc direction axis (+ (direction axis) angle)))

(defn translate-with-direction [position direction]
  ;; Direction, measured in 3 angles.
  ;; (0, 0, 0) is origin, upright, facing -z
  (let [[angle-x angle-y angle-z] direction
        distance 1.0
        [px py pz] position
        dx (* -1.0 distance (Math/sin angle-y))
        dy 0.0
        dz (* -1.0 distance (Math/cos angle-y))
        new-x (+ px dx)
        new-y (+ py dy)
        new-z (+ pz dz)]
    [new-x new-y new-z]))

(defn print-info []
  (println "player-position:" @player-position
           ", player-direction:" @player-direction
           ", direction point:" (translate-with-direction @player-position @player-direction)))

(defn key-left-down []
  (swap! player-direction #(rotate-direction % 1 0.1))
  (print-info))

(defn key-right-down []
  (swap! player-direction #(rotate-direction % 1 -0.1))
  (print-info))

(def up-down-callbacks
  {:angle-speed {:atom angle-speed, :amount 0.1}})

  (let [spec (type up-down-callbacks)
        value-atom (:atom spec)
        amount (:amount spec)]
    (swap! value-atom #(identity (if up? (+ % amount) (- % amount))))))

(defn key-up []
  (adjust-value @mode true))
