Sets a function that wraps around all screen functions, allowing you to handle errors and perform other custom actions each time they run.
; default behavior
(set-screen-wrapper! (fn [screen-atom screen-fn]
(screen-fn)))
; if there is an error, print it out and switch to a blank screen
; (this is useful because it makes error recovery easier in a REPL)
(set-screen-wrapper! (fn [screen-atom screen-fn]
(try (screen-fn)
(catch Exception e
(.printStackTrace e)
(set-screen! my-game blank-screen)))))
Source
(defn set-screen-wrapper! [wrapper-fn] (intern 'play-clj.core 'wrapper wrapper-fn))