We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Minart can be called from ammonite, which can lead to some interesting live-coding usages.
I haven't thought about this in detail, but I'm thinking about adding a new minart-live package with some utilities such a special RenderLoop, like:
minart-live
class LiveRenderLoop[S](innerRenderLoop: RenderLoop) { private[this] var renderFrame: (Canvas, S) => S = _._2 def changeRenderFrame(newRenderFrame: (Canvas, S) => S): Unit def init(canvasManager: CanvasManager, initialState: S, frameRate: FrameRate) { innerRenderLoop.infiniteRenderLoop(canvasManager, initialState, {(c, s) => renderFrame(c, s)}, frameRate) } }
This would allow a render loop to keep the state and run in the background, while the rendering logic was updated in the REPL.
The text was updated successfully, but these errors were encountered:
Another possibility here (which would just work on JS) would be to do something similar to Tyrian's HotReload
In this case, there would be something like:
class HotReloadRenderLoop[S](decodeState: String => Option[S], encodeState: S => String) { private def loadState(): Option[S] = Option(dom.window.localStorage.getItem(key)).flatMap(decodeState) private def saveState(state: S): String = dom.window.localStorage.setItem(key, encodeState(state)) def run(runner: LoopRunner, canvasManager: CanvasManager, canvasSettings: Canvas.Settings, initialState: S) = { val canvas = canvasManager.init(canvasSettings) runner .finiteLoop( (state: S) => renderFrame(canvas, state).tap(saveState), (newState: S) => terminateWhen(newState) || !canvas.isCreated(), frameRate, () => if (canvas.isCreated()) canvas.close() ) .run(loadState().getOrElse(initialState)) } }
I think that with some adjustments, it might also be able to plug this logic into the PureRenderLoop without a ton of work.
PureRenderLoop
Sorry, something went wrong.
No branches or pull requests
Minart can be called from ammonite, which can lead to some interesting live-coding usages.
I haven't thought about this in detail, but I'm thinking about adding a new
minart-live
package with some utilities such a special RenderLoop, like:This would allow a render loop to keep the state and run in the background, while the rendering logic was updated in the REPL.
The text was updated successfully, but these errors were encountered: