View the current state

29 views
Skip to first unread message

James Vanderhyde

unread,
Jun 2, 2016, 5:43:15 PM6/2/16
to clj-processing
I am attempting to use quil for game development. I am using functional mode. For debugging purposes I would like to see the current state while the program is running. I mean the value of the state parameter that is passed to the update and draw functions. Ideally there would be something I can enter into a REPL that would show me the value of the state the last time draw was called. How can I do this?

James Vanderhyde

unread,
Jun 3, 2016, 3:23:08 PM6/3/16
to clj-processing
I actually figure out something that will work. (I am still fairly new to Clojure.) Let me know if there is an easier way.
(def state-for-repl (atom 0))

(defn draw [state]
  (reset! state-for-repl state)
  ...)

(deref state-for-repl)



Nikita Beloglazov

unread,
Jun 3, 2016, 4:16:22 PM6/3/16
to clj-processing
Hi James.

Are you using clojure (not clojurescript)? Assuming that you're using clojure, state is stored as sketch meta. So say can access it like this: https://gist.github.com/nbeloglazov/e3083fdb6da6d8cc684adb7b60c879e0

 

--
You received this message because you are subscribed to the Google Groups "clj-processing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clj-processin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages