Created
September 18, 2012 20:48
-
-
Save cassiel/3745794 to your computer and use it in GitHub Desktop.
Puffdraw Bad Code 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn paint | |
"Paint does the work. Iterate through the circular queue of states, drawing | |
a fat line from each point to the next (if button down)." | |
[me] | |
(... | |
(letfn [(iter [i last-x last-y] | |
((let [{:keys [button x y]} (nth points i)] | |
... | |
(.move_to g last-x last-y) | |
(.line_to g x y) | |
(.stroke g)) | |
(when (< i (- TRAIL-LENGTH 1)) | |
(recur (inc i) x y))))] | |
(iter 1 | |
(:x (first points)) | |
(:y (first points)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment