go-p5 / p5

p5 is a simple package that provides primitives resembling the ones exposed by p5js.org

Home Page:https://go-p5.github.io/

Repository from Github https://github.comgo-p5/p5Repository from Github https://github.comgo-p5/p5

p5: rework event-loop drawing

sbinet opened this issue · comments

right now, p5 relies on Gio to get its re-draw events, together with a little ticker goroutine (that ticks at the requested frequency, requesting Gio for redrawing the canvas).

it's a bit brittle because it's intertwined with other Gio events that will re-draw the canvas (such as a resize of the window), which will confuse users' draw methods (e.g.: the current solar-system draw methods expects a fixed frequency and computes delta-t (and thus positions, speeds and accelerations) from that frequency).

we'd need to somehow separate or distinguish the 2 sets of events. (probably by only re-drawing when the ticker goroutine marked some Proc state as "dirty"?)