diff clojure/com/aurellem/gb_driver.clj @ 75:eb7d4efe0f34

added play command
author Robert McIntyre <rlm@mit.edu>
date Thu, 08 Mar 2012 06:01:09 -0600
parents aaddd7b72a0e
children d7c38ce83421
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb_driver.clj	Thu Mar 08 04:40:18 2012 -0600
     1.2 +++ b/clojure/com/aurellem/gb_driver.clj	Thu Mar 08 06:01:09 2012 -0600
     1.3 @@ -98,9 +98,10 @@
     1.4  (def ^:dynamic *save-history* true)
     1.5  
     1.6  (defn advance []
     1.7 -  (let [save (save-state)]
     1.8 -    (backup-state @current-frame)
     1.9 -    (swap! current-frame inc)))
    1.10 +  (swap! current-frame inc)
    1.11 +  (if *save-history*
    1.12 +    (let [save (save-state)]
    1.13 +      (backup-state @current-frame))))
    1.14  
    1.15  (defn step
    1.16    ([] (advance) (Gb/step))
    1.17 @@ -110,6 +111,10 @@
    1.18         (Gb/step mask-or-buttons)
    1.19         (Gb/step (button-mask mask-or-buttons)))))
    1.20  
    1.21 +(defn step! [& args]
    1.22 +  (binding [*save-history* false]
    1.23 +    (apply step args)))
    1.24 +
    1.25  (defn frame [] @current-frame)
    1.26    
    1.27