I believe this fixes the freezes.

This commit is contained in:
Bryce Covert
2015-08-14 21:01:55 -07:00
parent 6a5193e5dc
commit b8a97ad875
5 changed files with 45 additions and 29 deletions

View File

@@ -74,22 +74,31 @@
(terminate [this screen entities]
entities)
(skip-type [this screen entities]
:skip)))
:none-but-arrow)))
(defmacro get-script [entities & forms]
`(fn [starting-entities#]
(let [~entities (atom starting-entities#)]
(thread (do (change-script-state ~entities true)
~@forms
(change-script-state ~entities false)
(utils/save @~entities))))))
(put! (get-in starting-entities# [:actions :script-chan])
(fn [starting-entities#]
(let [~entities (atom starting-entities#)]
(thread (do
(try
~@forms
(finally
(change-script-state ~entities false)
(utils/save @~entities)
)))))))))
(defmacro get-unsaved-script [entities & forms]
`(fn [starting-entities#]
(let [~entities (atom starting-entities#)]
(thread (change-script-state ~entities true)
~@forms
(change-script-state ~entities false)))))
(put! (get-in starting-entities# [:actions :script-chan])
(fn [starting-entities#]
(let [~entities (atom starting-entities#)]
(thread (do
(try
~@forms
(finally
(change-script-state ~entities false))))))))))
(defn bound-to-camera [x length zoom]
(min (- length (* length 0.5 zoom ))