Fork me on GitHub
#clojure
<
2021-10-09
>
tlonist08:10:50

has anybody played with quil library(https://github.com/quil/quil)? I can’t get the load-image function work. No matter where I place the image it returns NullPointerException.

dgb2309:10:30

I played with it a bit

dgb2309:10:01

but I used a shadowcljs setup with clojurescript instead of the proposed leiningen one

dgb2309:10:02

now the lib does some magical stuff so to speak, some functions only work within a sketch, meaning you need to call it from within a setup or draw function

dgb2309:10:08

did you do it as such?

p-himik09:10:18

I just tried the example from the documentation with Clojure - worked just fine. And yes, load-image is called within setup there.

dgb2309:10:39

if you attempt to call it outside it will fail

dgb2309:10:52

just checked with my setup

dgb2309:10:24

you have to think of this as a stateful environment that you interact with by giving it stuff that is then applied within that environment. Kind of like a simple game engine or framework works. It calls you, you don’t call it.

tlonist11:10:59

wow, thanks @U01EFUL1A8M @U2FRKM4TW. indeed it works within the setup function!

🎉 3
Zach Mitchell, PhD20:10:26

Most Quil functions need to be called inside of draw/setup because they needs access to the current graphics object

3