Mercurial > vba-clojure
diff clojure/com/aurellem/run/title.clj @ 256:c7b002525041
improved scroll-text to scroll through multiple lines of text
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 26 Mar 2012 06:11:49 -0500 |
parents | 5dafe6188ca5 |
children | 8e63b0bb8ea3 |
line wrap: on
line diff
1.1 --- a/clojure/com/aurellem/run/title.clj Mon Mar 26 06:00:30 2012 -0500 1.2 +++ b/clojure/com/aurellem/run/title.clj Mon Mar 26 06:11:49 2012 -0500 1.3 @@ -21,7 +21,14 @@ 1.4 ([alt [commands state]] 1.5 (advance [] alt [commands state]))) 1.6 1.7 -(def scroll-text (partial advance [:b] [:a :b])) 1.8 +(defn scroll-text 1.9 + ([script] 1.10 + (advance [:b] [:a :b] script)) 1.11 + ([n script] 1.12 + (reduce (fn [script _] 1.13 + (scroll-text script)) 1.14 + script 1.15 + (range n)))) 1.16 1.17 (defn start [] [[] (root)]) 1.18 1.19 @@ -38,19 +45,7 @@ 1.20 ([] (oak (title))) 1.21 ([script] 1.22 (->> script 1.23 - scroll-text 1.24 - scroll-text 1.25 - scroll-text 1.26 - scroll-text 1.27 - scroll-text 1.28 - scroll-text 1.29 - scroll-text 1.30 - scroll-text 1.31 - scroll-text 1.32 - scroll-text 1.33 - scroll-text 1.34 - scroll-text 1.35 - scroll-text))) 1.36 + (scroll-text 13)))) 1.37 1.38 (defn-memo name-entry-rlm 1.39 ([] (name-entry-rlm (oak))) 1.40 @@ -79,11 +74,7 @@ 1.41 ([] (rival-name-entry-gary (name-entry-ash))) 1.42 ([script] 1.43 (->> script 1.44 - scroll-text 1.45 - scroll-text 1.46 - scroll-text 1.47 - scroll-text 1.48 - scroll-text 1.49 + (scroll-text 5) 1.50 (advance [] [:d]) 1.51 (advance [] [:d]) 1.52 (advance [] [:a])))) 1.53 @@ -92,11 +83,7 @@ 1.54 ([] (rival-name-entry-blue (name-entry-ash))) 1.55 ([script] 1.56 (->> script 1.57 - scroll-text 1.58 - scroll-text 1.59 - scroll-text 1.60 - scroll-text 1.61 - scroll-text 1.62 + (scroll-text 5) 1.63 (advance [] [:d]) 1.64 (advance [] [:a])))) 1.65 1.66 @@ -104,14 +91,8 @@ 1.67 ([] (finish-title (rival-name-entry-blue))) 1.68 ([script] 1.69 (->> script 1.70 - scroll-text 1.71 - scroll-text 1.72 - scroll-text 1.73 - scroll-text 1.74 - scroll-text 1.75 - scroll-text 1.76 - scroll-text))) 1.77 - 1.78 + (scroll-text 7)))) 1.79 + 1.80 (def title-frames 2194) 1.81 1.82 (defn title-checkpoint! []