From 4f9d300e0b6e72f09cafe471184cc856b573f7f7 Mon Sep 17 00:00:00 2001 From: oakes Date: Sat, 10 May 2014 13:11:53 -0400 Subject: [PATCH] Only create input listeners when screen is first created --- src/play_clj/core.clj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/play_clj/core.clj b/src/play_clj/core.clj index ac51ec3..ce9fadc 100644 --- a/src/play_clj/core.clj +++ b/src/play_clj/core.clj @@ -70,7 +70,9 @@ (wrapper screen) (reset-changed! entities old-entities)))))] ; add the input listeners to the screen atom - (swap! screen assoc :input-listeners (input-listeners options execute-fn!)) + (when-not (:input-listeners @screen) + (->> (input-listeners options execute-fn!) + (swap! screen assoc :input-listeners))) ; update screen when either the screen or entities are changed (add-watch screen :changed (fn [_ _ _ new-screen] (update-screen! new-screen)))