Revert change to the add-timer! function

This commit is contained in:
oakes
2014-05-27 16:10:32 -04:00
parent 7ffd8d1469
commit 75246ee21c

View File

@@ -111,7 +111,7 @@ specified path.
new-timer))
(defn add-timer!
"Creates a [Timer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/Timer.html)
"Returns a [Timer](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/Timer.html)
which will fire the :on-timer function one or more times (depending on the given
arguments). In the :on-timer function, the id will be passed in the screen map.
If a timer with that id already exists in the screen, it will be stopped and
@@ -124,14 +124,14 @@ replaced with a new timer.
; wait 2 seconds, run once, and then run 3 more times at 10 second intervals
(add-timer! screen :spawn-enemy 2 10 3)"
([screen id delay]
(-> (create-and-add-timer! screen id)
(.scheduleTask (task* screen id) delay)))
(doto (create-and-add-timer! screen id)
(.scheduleTask (task* screen id) delay)))
([screen id delay interval]
(-> (create-and-add-timer! screen id)
(.scheduleTask (task* screen id) delay interval)))
(doto (create-and-add-timer! screen id)
(.scheduleTask (task* screen id) delay interval)))
([screen id delay interval repeat]
(-> (create-and-add-timer! screen id)
(.scheduleTask (task* screen id) delay interval repeat))))
(doto (create-and-add-timer! screen id)
(.scheduleTask (task* screen id) delay interval repeat))))
(defn remove-timer!
"Stops and removes the timer associated with `id`, returning it or nil if not