                           (doseq [[i c] (take 23 (map-indexed (fn [i c] [i (char c)]) (range (int \a) (int \z))))]
                             (zutil/put-string terminal :text 0 (inc i) (str c) [128 (* 10 i) 0] [0 0 50]))
                           (zutil/put-string terminal :text 12 0 (str key-in))
-                          (zutil/put-string terminal :rainbow 1 1 "Rainbow")
-                          (zutil/put-string terminal :rainbow 1 7 "Overlay")
-                          (zat/put-chars! terminal :text [
-                            {:c :metal       :fg [128 0 0] :bg [4 4 5] :x 12 :y 12}
-                            {:c :panels      :fg [128 0 0] :bg [4 4 5] :x 13 :y 12}
-                            {:c :stone       :fg [128 128 128] :bg [4 4 5] :x 14 :y 12}
-                            {:c :masonry     :fg [128 128 0] :bg [4 4 5] :x 15 :y 12}
-                            {:c :dark-metal  :fg [128 128 0] :bg [4 4 5] :x 16 :y 12}
-                            {:c :dark-panels :fg [128 128 0] :bg [4 4 5] :x 17 :y 12}
-                            {:c :grass       :fg [4 4 5]   :bg [0 128 0] :x 18 :y 12}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 1 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 2 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 3 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 4 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 5 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 6 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 7 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 8 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 9 :y 7}
-                            {:c :metal       :fg [4 4 5] :bg [0 128 0] :x 10 :y 7}])
-                          (doseq [[col row] @last-mouse-pos]
-                            (zat/put-chars! terminal :text [{:c \* :fg [200 200 100] :bg [4 4 5] :x col :y row}]))
+                          (zutil/put-string terminal :overlay 2 7 "Overlay")
+                          (zat/put-chars! terminal :text
+                            (for [x (range 1 11)
+                                  y (range 5 10)]
+                              {:c :metal       :fg [4 4 5] :bg [0 128 0] :x x :y y}))
                           (zat/refresh! terminal)))
                           ;; ~30fps
                         (Thread/sleep 33)
                         (recur))]
     ;; get key presses in fg thread
     (loop []
-      (let [new-event (async/<!! event-chan)]
-        (cond
-          (map? new-event)
-            (let [{:keys [mouse-leave]} new-event]
-              (log/info "Got mouse-event" new-event (vec @last-mouse-pos))
-              (when mouse-leave
-                (swap! last-mouse-pos (fn [col] (take trail-length (cons mouse-leave col)))))
-              (recur))
-          (char? new-event)
-            (let [new-key new-event]
-              (reset! last-key new-key)
-              (log/info "got key" (or (str @last-key) "nil"))
-              (case new-key
-                \q (zat/destroy! terminal)
-                nil)
-              (if (= new-key :exit)
-                (do
-                  (async/close! fx-chan)
-                  (async/close! render-chan)
-                  (System/exit 0))
-                ;; change font size on s/m/l keypress
-                (recur))))))))
-
-
+      (let [new-key (async/<!! key-chan)]
+        (reset! last-key new-key)
+        (log/info "got key" (or (str @last-key) "nil"))
+        (case new-key
+          \q (zat/destroy! terminal)
+          nil)
+        (if (= new-key :exit)
+          (do
+            (async/close! render-chan)
+            (System/exit 0))
+          ;; change font size on s/m/l keypress
+          (recur))))))

                                     (map->tile->col-row one-bit-map)
                                     (map->tile->transparent one-bit-map))]))
                                     
#_(def font (CP437Font. "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green 2))
                                     

(defn -main [& _]
  ;; render in background thread
   (let [terminal   (zgl/make-terminal [:text :rainbow]
                                       {:title "Zaffre demo"
                                        :columns 16 :rows 16
                                        :default-fg-color [250 250 250]

                                        :icon-paths ["images/icon-16x16.png"
                                                     "images/icon-32x32.png"
                                                     "images/icon-128x128.png"]})
        key-chan   (zat/get-key-chan terminal)
        last-key    (atom nil)
        ;; Every 33ms, draw a full frame
        render-chan (go-loop []
                      (dosync
