-
Notifications
You must be signed in to change notification settings - Fork 4
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
instance mode improvements #8
Comments
I have started playing with instance mode and already found a new issue, symbols from p5 can be used in procs and funcs which are not inside the setup and draw templates (but I think not in "global" scope, see https://github.com/processing/p5.js/wiki/p5.js-overview#why-cant-i-assign-variables-using-p5-functions-and-variables-before-setup). Luckily for these cases there is a workaround (add My current working document for playing with instance mode (that shows the two examples mentioned above) is: https://github.com/pietroppeter/adventofnim/blob/day6-2015-with-p5/2015/day06.nim |
Ahh, sorry! This is something I wanted to ask you about and forgot. I did that consciously as I wasn't sure if we should just replace symbols in the complete https://github.com/pietroppeter/p5nim/blob/master/src/p5/p5instance_logic.nim#L175 by let s = proc(p5Inst {.inject.}: P5Instance) {.closure.} = replaceCalls(body) at which point the existing
That should be correct I believe unless there is some weird edge case where one might sometimes want to access something of the same name as a template in local scope. And you're probably aware that the name of the used symbol |
Perfect thanks, I can take it from here! |
following up from #4 where (experimental) instance mode support was added, there remain some stuff to do:
p5js.nim
except the vars that represent constants like TWO_PI)p5sugar.nim
should be added. This could be done with a macro but it is simpler via copy & paste.The text was updated successfully, but these errors were encountered: