I’ve a question about drawing.
Is it necessary to draw() (thus, redraw) every time the function is called?
I mean: I’m thinking to place some kind of “isDirty” flag on step() (for some reasons) only when somethings to draw is changed, and than check within draw() if that flag is true; and only in that case, redraw.
Can I do it? or for some reason (i.e. switch os windows, overlap with other software, and so on) its necessary to always draw content?
You do need to draw every time. That’s why most of the widgets in vcv use the transparent frame buffer ( forget the name). Like the svg widget draws every time, but only rasterizes the svg when it’s dirty.
If your Widget::draw() method only draws every N frames (through an early return for example), it will only appear every N frames. If you wish to cache the appearance of your widget, subclass FramebufferWidget and set dirty = true when you want to redraw.
@Vortico: is it legit to add more widgets to a single fb?
I would use fb to process data (let say object x and y, from a ring buffer from audio module), and when its ready/processed, draw the two different child widgets (one for x, one for y):