quil

plexus 2021-01-23T14:31:49.001800Z

I'm using Quil to teach someone clojure, and I really wanted to be able to just call drawing functions by themselves (so outside a draw function), to allow for more interactive exploration. Took me some figuring out so in case it's useful for anyone else:

(defn draw []
  (Thread/sleep 100))

(q/defsketch mijn-sketch
  :size [800 800]
  :draw draw
  :features [:keep-on-top])

(alter-var-root #'quil.applet/*applet* (constantly mijn-sketch))

plexus 2021-01-23T14:33:50.003800Z

Now you can just call any q/... function at the top level. The Thread/sleep is necessary because the animation thread will still be calling draw in a loop, and only graphics that happen between the start/end of draw will show up on the sketch.

yiorgos 2021-01-23T21:39:15.006800Z

Hello, I am trying to use Quil in combination with Emacs . when I eval the defsketch function I am getting an exception

Unhandled java.lang.NoClassDefFoundError
   com/apple/eawt/QuitHandler

1. Caused by java.lang.ClassNotFoundException
   com.apple.eawt.QuitHandler

yiorgos 2021-01-23T21:39:56.007200Z

I am trying to eval the forms in the editor and not in the REPL

yiorgos 2021-01-23T21:43:43.007700Z

Has anyone seen a similar error?

yiorgos 2021-01-23T21:43:46.007900Z

Thanks!