Wait till we finish drawing and watching to commit state
This commit is contained in:
parent
a2f53900f9
commit
0732d473b7
@ -84,17 +84,15 @@
|
||||
(let [config (:config @game-config)]
|
||||
(try
|
||||
(doseq [buf @buffered-objs] (snapshot! buf))
|
||||
(swap! game-state #(update config %))
|
||||
(catch Throwable t
|
||||
(doseq [buf @buffered-objs]
|
||||
(restore! buf))
|
||||
(report-exception! t)))
|
||||
(rl/with-drawing!
|
||||
(try
|
||||
(draw config @game-state)
|
||||
(w/watch! (watch-fn config @game-state))
|
||||
(catch Throwable t
|
||||
(report-exception! t)))))))
|
||||
(let [updated-state (update config @game-state)]
|
||||
(rl/with-drawing!
|
||||
(draw config updated-state)
|
||||
(w/watch! (watch-fn config updated-state))
|
||||
(swap! game-state updated-state)
|
||||
(catch Throwable t
|
||||
(doseq [buf @buffered-objs]
|
||||
(restore! buf))
|
||||
(report-exception! t))))))))
|
||||
(try
|
||||
(when unload
|
||||
(doseq [[_ tex] @texture-cache]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user