-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved interactive development #157
Comments
I would love to see this feature because Sketch is really annoying in my tiling window manager ... on every recompile the window is restarted and my window manager renders the window in a slightly different place (which is correct for my workflow). Anyone know what it would take to implement this feature? |
I've never been sure exactly how the window gets reinitialized. I imagine it's something to do with |
I am learning Lisp and don't know enough to dig in to that level my self yet. I will try to help if I can. |
I've done some experimenting with the current version of Sketch. The window isn't getting recreated for me when I recompile a We do, however, reset all the slots to their default values, and we trigger the I'm imagining the user might want to tweak the drawing logic and SOME of the slots, without resetting all of them or invoking Straightforward solution: if Maybe....
Or...
|
Live coding is now possible in Sketch! These ideas were implemented here, although it's completely undocumented: Kevinpgalligan@4032f57 The final API looks like: (defsketch moon
((x 0)
(y 0)
(c +white+ :tweakable t)
(bg +black+ :tweakable t)
(restart-on-change nil)
(restart-on :r)
(background bg)
(setf x (mod (+ x (random 10) -5) width)
y (mod (+ y (random 10) -5) height))
(with-pen (make-pen :fill c)
(circle x y 15)))
Feel free to check out the |
Amazing! |
I tried loading up your dev branch, I am running into a few problems.
Value of (- 1 -1) in (FLOAT-DIGITS (- 1 -1)) is 2, not a FLOAT. Restarts: Backtrace:
Thoughts? I'm pretty sure I am doing something wrong. |
You should try loading |
Pushed a fix to |
Just dropping in to let you know that it does error out with missing things like rain.fasl (and a few others) but I can just accept, get it running and play around! None of the errors are an issue, don't spend any time on that, just have fun. Hey thanks, that looks great, appreciate it. I wasn't expecting a quick response, awesome! |
Hm, weird, I don't think I've gotten an error like that before. Happy to help debug if anything's not working, just create an issue over in the sketches repo. Thanks for checking it out! |
Just dropping in to say thank you for the updates and the samples! I played with all of them, really great work! I will use them to do a whole bunch of learning. Thanks again. |
Things to add:
:restart-on-redefinition nil
, so the window doesn't have to restart every time the defsketch is recompiled. If someone is just tweaking the drawing code, for example, or how the state gets updated (as opposed to adding new state), then they may not need to restart the window. Or even if they're adding new state, maybe they don't need to refresh (this might require ensuring that the newdraw
doesn't get called before any new slots are added).prepare
.close-on
) to manually trigger restarts.Together, these features would enable something closer to "true" interactive development.
The text was updated successfully, but these errors were encountered: