Mercurial > cortex
diff org/sense.org @ 187:6142e85f5825
extracted common elements of display code
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 04 Feb 2012 09:42:19 -0700 |
parents | 21816b27d7c8 |
children | 22548d48cc85 |
line wrap: on
line diff
1.1 --- a/org/sense.org Sat Feb 04 09:35:15 2012 -0700 1.2 +++ b/org/sense.org Sat Feb 04 09:42:19 2012 -0700 1.3 @@ -214,6 +214,27 @@ 1.4 (Vector3f. (.getX in) 1.5 (.getZ in) 1.6 (- (.getY in)))) 1.7 + 1.8 + 1.9 +(defn view-sense 1.10 + "Take a function that produces a BufferedImage from some sense data 1.11 + and return a function which takes a list of sense and displays 1.12 + those images in multiple JFrames." 1.13 + [sense-display-kernel] 1.14 + (let 1.15 + [windows (atom [])] 1.16 + (fn [data] 1.17 + (if (> (count data) (count @windows)) 1.18 + (reset! windows (map (fn [_] (view-image)) 1.19 + (range (count data))))) 1.20 + (dorun 1.21 + (map 1.22 + (fn [display gen data] 1.23 + (display (gen data))) 1.24 + @windows sense-display-kernel data))))) 1.25 + 1.26 + 1.27 + 1.28 #+end_src 1.29 1.30