Thanks.
So I’ve been looking at examples, but it’s still not clear the path by which VCVRack is calling into my plugin.
I’ve changed my code to
void SlowSliderWidget::draw(const rack::widget::Widget::DrawArgs& args) {
NVGcontext* vg = args.vg;
update();
nvgBeginPath(vg);
nvgFillColor(vg, nvgRGBA(0,0,66,255));
nvgRoundedRect(vg, ssm.getRect().left(), ssm.getRect().top(), ssm.getRect().width(), ssm.getRect().height(), 6);
nvgFill(vg);
nvgBeginPath(vg);
nvgFillColor(vg,nvgRGBA(0,255,0,255));
nvgMoveTo(vg,ssm.getRect().left(),ssm.getRect().top()+ssm.current);
nvgLineTo(vg,ssm.getRect().right(),ssm.getRect().top()+ssm.current);
nvgFill(vg);
nvgBeginPath(vg);
nvgFillColor(vg,nvgRGBA(255,0,200,255));
nvgMoveTo(vg,ssm.getRect().left(),ssm.getRect().top()+ssm.destination);
nvgLineTo(vg,ssm.getRect().right(),ssm.getRect().top()+ssm.destination);
nvgFill(vg);
}
Which compiles OK. But there’s still no sign of this function running. Is Rack automatically calling this draw function for my widget when the widget is attached to a ModuleWidget?
My module contains the code
SlowSliderWidget *ssw;
ssw= createParamCentered<SlowSliderWidget>(Vec(10,30), module, SlowSliders::SLOW1_PARAM);
ssw->setup(0,0,-5.0,5.0);
ssw->setDestination(30,10);
addParam(ssw);
Which I think should be making my SlowSliderWidget and attaching it to the parent correctly.
But there’s no sign of it appearing.