Mercurial > vba-clojure
view clojure/com/aurellem/run/title.clj @ 314:073600cba28a
scroll text works robustly but is slow
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 02 Apr 2012 20:30:02 -0500 |
parents | 8e63b0bb8ea3 |
children | 9a4d3f801c89 |
line wrap: on
line source
1 (ns com.aurellem.run.title2 (:use (com.aurellem.gb gb-driver vbm)))5 (defn start [] [[] (root)])7 (defn-memo title8 ([] (title (start)))9 ([script]10 (->> script11 (advance [] [:a])12 (advance [] [:start])13 (advance [] [:a])14 (advance [] [:start]))))16 (defn-memo oak17 ([] (oak (title)))18 ([script]19 (->> script20 (scroll-text 13))))22 (defn-memo name-entry-rlm23 ([] (name-entry-rlm (oak)))24 ([script]25 (->> script26 (advance [] [:a])27 (advance [] [:r] DE)28 (play-moves29 [[]30 [:r] [] [:r] [] [:r] [] [:r] []31 [:r] [] [:r] [] [:r] [] [:d] [:a]32 [:l] [] [:l] [] [:l] [] [:l] []33 [:l] [] [:l] [:a] [] [:r] [:a]34 [:r] [] [:r] [] [:r] [] [:r] []35 [:r] [] [:d] [] [:d] [] [:d] [:a]]))))37 (defn-memo name-entry-ash38 ([] (name-entry-ash (oak)))39 ([script]40 (->> script41 (advance [] [:d])42 (advance [] [:d])43 (advance [] [:a]))))45 (defn-memo rival-name-entry-gary46 ([] (rival-name-entry-gary (name-entry-ash)))47 ([script]48 (->> script49 (scroll-text 5)50 (advance [] [:d])51 (advance [] [:d])52 (advance [] [:a]))))54 (defn-memo rival-name-entry-blue55 ([] (rival-name-entry-blue (name-entry-ash)))56 ([script]57 (->> script58 (scroll-text 5)59 (advance [] [:d])60 (advance [] [:a]))))62 (defn-memo finish-title63 ([] (finish-title (rival-name-entry-blue)))64 ([script]65 (->> script66 (scroll-text 7))))68 (def title-frames 2194)70 (defn title-checkpoint! []71 (let [[moves state] (finish-title)]72 (assert (= title-frames (count moves)))73 [(write-moves! moves "title-checkpoint")74 (write-state! state "title-checkpoint")]))76 (defn intro []77 [(read-moves "title-checkpoint")78 (read-state "title-checkpoint")])80 (defn test-intro []81 (play-vbm (moves-filename "title-checkpoint")))83 ;; TODO might be able to glue these together more elegantly with monads