The idea that one can change and modify code while it is running sounds great, but I have never really gotten to the point that I understand practically how to do it in a non-trivial circumstance. As a concrete example where I think I should be able to do it, but I can’t, is when running one of the examples from the claylib system. I am using slime/emacs and I open claylib/examples/shapes/bouncing-ball.lisp. In slime I use (in-package :claylib/examples/bouncing-ball) and then (main) and I have the bouncing ball demo working fine. What I have tried to do is to change the color of ball from its current +maroon+ to some other color. I have tried editing that part of the function definition in bouncing-ball.lisp and recompiling, but nothing changes. If I kill the running example, recompile the bouncing-ball.lisp and then re-run main I see the new color, so I know that I am specifying a color correctly. Would someone tell me the steps to change the ball color while it is bouncing around to help me get started on this “live” coding method? Of if they think one of the other raylib wrappers would be better for this I can change. I am just using this as a learning tool to give me some visual feedback as I make changes. Thanks.

  • shelvick@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 months ago

    Hi, Claylib maintainer here! The other commenters have already answered your general question – write a separate function that’s called from your main loop and then recompile that. I believe your confusion stemmed from the fact that most of the examples are written for conciseness rather than live coding. I had meant to add some more examples specifically for live coding but never really got around to it. As you may have figured out by now, the initial values are typically defined in scenes and then changed later via whatever custom functions you might add.

    • brittAnderson@alien.topOPB
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 months ago

      Thank you for you library. It would be great to have a tutorial about how to get started that includes some of this. I know you are busy working on the library, and that is what I hope you spend your time, but I will keep good notes on my experience and maybe I can contribute some sort of tutorial blog post or something. Cheers,