 (defn paint-screen [graphics screen-state available-tiles]
   (let [original-transform (.getTransform graphics)]
     (doto graphics
-      (.setClip 0 0 (:width @screen-state) (:height @screen-state))
-      (.translate (:x @screen-state)
-                  (:y @screen-state))
-      ;(.rotate @angle)
+      (.setClip 0 0 (:width screen-state) (:height screen-state))
+      (.translate (- (:x screen-state))
+                  (- (:y screen-state)))
+      ;(do (println (.getClipBounds graphics)))
       enable-anti-aliasing
-      (paint-tiles @available-tiles @screen-state [512 512])
+      (paint-tiles available-tiles screen-state [512 512])
       (.setColor Color/YELLOW)
       (.fillOval -5 -5
                  10 10)
       (.setTransform original-transform)
       (.setColor Color/YELLOW)
-      (.drawString (str @screen-state)
+      (.drawString (str screen-state)
                    (int 0)
-                   (int (- (:height @screen-state) 10))))))
+                   (int (- (:height screen-state) 10))))))
   
 
 ;; USER INPUT HANDLING

  (let [binder (fn [key axis step]
                 (bind-key component key
                           #(swap! position-atom update-in [axis] + step) true))]
    (binder "UP" :y 50)
    (binder "DOWN" :y -50)
    (binder "RIGHT" :x -50)
    (binder "LEFT" :x 50)))

(defn handle-wheel [component z-atom]
  (.addMouseWheelListener component

    (proxy [JPanel] []
      (paintComponent [^Graphics graphics]
        (proxy-super paintComponent graphics)
        (paint-screen graphics @screen-state @available-tiles)))
    (.setBackground Color/BLACK)))
    
(defn main-frame []
