Remove :on-dispose (no different than :on-hide)

This commit is contained in:
oakes
2014-09-04 16:57:28 -04:00
parent d6b994602f
commit 5425625709

View File

@@ -63,8 +63,7 @@
(defn defscreen* (defn defscreen*
[screen entities [screen entities
{:keys [on-show on-render on-hide on-pause {:keys [on-show on-render on-hide on-pause on-resize on-resume on-timer]
on-resize on-resume on-dispose on-timer]
:as options}] :as options}]
(let [execute-fn! (fn [func & {:keys [] :as options}] (let [execute-fn! (fn [func & {:keys [] :as options}]
(when func (when func
@@ -115,8 +114,7 @@
:resize (fn [w h] :resize (fn [w h]
(execute-fn! on-resize :width w :height h) (execute-fn! on-resize :width w :height h)
(update-screen! @screen)) (update-screen! @screen))
:resume #(execute-fn! on-resume) :resume #(execute-fn! on-resume)}))
:dispose #(execute-fn! on-dispose)}))
(defmacro defscreen (defmacro defscreen
"Defines a screen, and creates vars for all the functions inside of it. All "Defines a screen, and creates vars for all the functions inside of it. All
@@ -512,7 +510,6 @@ keywords and functions in pairs."
(let [run-fn! (fn [k & args] (let [run-fn! (fn [k & args]
(doseq [screen screen-objects] (doseq [screen screen-objects]
(apply (get screen k) args)))] (apply (get screen k) args)))]
(some-> game-object .getScreen .dispose)
(.setScreen game-object (.setScreen game-object
(reify Screen (reify Screen
(show [this] (show [this]
@@ -526,7 +523,7 @@ keywords and functions in pairs."
(pause [this] (run-fn! :pause)) (pause [this] (run-fn! :pause))
(resize [this w h] (run-fn! :resize w h)) (resize [this w h] (run-fn! :resize w h))
(resume [this] (run-fn! :resume)) (resume [this] (run-fn! :resume))
(dispose [this] (run-fn! :dispose)))))) (dispose [this])))))
(defn set-screen-wrapper! (defn set-screen-wrapper!
"Sets a function that wraps around all screen functions, allowing you to "Sets a function that wraps around all screen functions, allowing you to