Is there an iPlug2 equivalent of “IKnobMultiControlText” that was a common yet custom control in iPlug1? It’s a bitmap knob control with text value display and entry. I am trying to convert from iPlug1 and that custom code is unrecognized in iPlug2.
Something similar…
class IKnobMultiControlText : public IKnobControlBase, public IBitmapBase
{
private:
IRECT mTextRECT, mImgRECT;
public:
IKnobMultiControlText(const IRECT& rect, int paramIdx, const IBitmap& bitmap, const IText& text)
: IKnobControlBase(rect, paramIdx)
, IBitmapBase(bitmap)
{
SetText(text);
mRECT = rect;
mTextRECT = IRECT(mRECT.L, mRECT.B-20, mRECT.R, mRECT.B);
mImgRECT = IRECT(mRECT.L, mRECT.T, mBitmap);
mDisablePrompt = false;
}
void Draw(IGraphics& g) override
{
int i = 1 + int(0.5 + GetValue() * (double) (mBitmap.N() - 1));
i = Clip(i, 1, mBitmap.N());
g.DrawBitmap(mBitmap, mImgRECT, i, &mBlend);
WDL_String disp;
GetParam()->GetDisplay(disp);
if (disp.GetLength())
g.DrawText(mText, disp.Get(), mTextRECT);
}
};
IPlugEffect::IPlugEffect(const InstanceInfo& info)
: Plugin(info, MakeConfig(kNumParams, kNumPresets))
{
GetParam(kGain)->InitDouble("Gain", 0., 0., 100.0, 0.01, "%");
#if IPLUG_EDITOR // http://bit.ly/2S64BDd
mMakeGraphicsFunc = [&]() {
return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT));
};
mLayoutFunc = [&](IGraphics* pGraphics) {
pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false);
pGraphics->AttachPanelBackground(COLOR_GRAY);
pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN);
const IRECT b = pGraphics->GetBounds();
pGraphics->AttachControl(new IKnobMultiControlText(b.GetCentredInside(48, 68), kGain, pGraphics->LoadBitmap("knob.png", 60), IText(10)));
};
#endif
}```
Will try it. Thank you.