Created
December 13, 2012 23:58
-
-
Save jellybob/4281249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def state | |
ref { :view-ns 'media-mogul.frontend.main-menu }) | |
(defn- callback | |
[ name & args ] | |
; Rummages around in the specified namespace, extracts any public methods | |
; and then finds the one with the same name as the callback being requested. | |
; | |
; Then evals it for good measure. | |
(let [ callback-fn @(name (ns-publics (the-ns (:view-ns @state)))) ] | |
(eval (apply callback-fn args)))) | |
(def application-proxy | |
(proxy [ BasicGame ] [ "Media Mogul" ] | |
(init [ container ]) | |
(render [ container graphics ] | |
(callback 'render container graphics)) | |
(update [ container delta ] | |
(callback 'update container delta)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment