Hi, I have a MainKnob class that represents a rotary knob (from png strip) and I need to modify it for take the knob accept negative values.
#include "Images.h"
class MainKnob : public LookAndFeel_V3
{
public:
MainKnob()
{
}
void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos,
const float rotaryStartAngle, const float rotaryEndAngle, Slider& slider) override
{
Image knob = ImageCache::getFromMemory(Images::mainKnob_png, Images::mainKnob_pngSize);
int frameCount = knob.getHeight() / knob.getWidth();
int frameSize = knob.getWidth();
const double div = slider.getMaximum() / frameCount;
double pos = (int)(slider.getValue() / div);
if (pos > 0)
pos = pos - 1;
g.drawImage (knob, x, y, width, height, 0, (int)(pos*frameSize), frameSize, frameSize, false);
}
};
This is the class. In this way I have a knob that hides if I set negative values…
How do I have to change the class properties?