Skip to content

Commit

Permalink
Don't redraw the screen more times than is necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjl committed Jul 14, 2012
1 parent f32a929 commit 0fae7ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/caves/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
(defn run-game [game screen]
(loop [{:keys [input uis] :as game} game]
(when-not (empty? uis)
(draw-game game screen)
(if (nil? input)
(recur (get-input (update-in game [:world] tick-all) screen))
(do
(draw-game game screen)
(recur (get-input (update-in game [:world] tick-all) screen)))
(recur (process-input (dissoc game :input) input))))))

(defn new-game []
Expand Down

0 comments on commit 0fae7ff

Please sign in to comment.