Closed Misophistful closed 10 years ago
I haven't tried it in Light Table, but are you sure you are in the right namespace and are re-evaluating the entire defscreen call? Keep in mind that in the desktop project, the main function and the defscreen call are in separate namespaces.
I just tried re-evaluating a defscreen after changing the on-key-down handler (in the minicraft example, not that it should matter) and that seemed to work ok.
Interestingly, evaluating any of the project's clj files didn't open a window. I had to evaluate a call to minicraft.core.desktop-launcher/-main for the game to start.
Right, the main function is within src
, while the game code itself is within src-common
. The reason for this is that Android and iOS projects don't have main functions, so that needed to be kept out of src-common
.
Thanks, it's working. In fact, I think that REPL development was working all along - the problem was actually me not using my brain. I was following along with the tutorial, but instead of changing :on-key-down
I thought I'd be "smart" and try changing something visible instead; the size of the image. The problem was that the image is defined in :on-show
and not re-evaluated every frame. D'oh!
I know that play-clj is built to work out-of-the-box in Nightcode, but I've been trying to get the REPL workflow up-and-running in Light Table. So far I haven't been successful.
I can connect a
lein-light-nrepl
within LT (by evaluating a play-clj CLJ file), which launches the game window, but when I make code changes and re-evaluate them, the game isn't updated. I have to close the game window and relaunch it with another evaluation to see the changes.REPL development works when I launch the project from a terminal using
lein repl
, so I think the problem is specific to Light Table. Do you know what I'm missing to get it working there?Cheers, James