MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / DrawToPush2Screen

Method DrawToPush2Screen

Source/FloatSliderLFOControl.cpp:198–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198bool FloatSliderLFOControl::DrawToPush2Screen()
199{
200 FloatSlider* slider = GetOwner();
201 if (slider)
202 {
203 ofRectangle rect(30, -12, 100, 11);
204 ofSetColor(100, 100, 100);
205 ofRect(rect);
206
207 float screenPos = rect.x + 1 + (rect.width - 2) * slider->ValToPos(slider->GetValue(), true);
208 float lfomax = ofClamp(GetMax(), slider->GetMin(), slider->GetMax());
209 float screenPosMax = rect.x + 1 + (rect.width - 2) * slider->ValToPos(lfomax, true);
210 float lfomin = ofClamp(GetMin(), slider->GetMin(), slider->GetMax());
211 float screenPosMin = rect.x + 1 + (rect.width - 2) * slider->ValToPos(lfomin, true);
212
213 ofPushStyle();
214 ofSetColor(0, 200, 0);
215 ofFill();
216 if (fabs(screenPos - screenPosMin) > 1)
217 ofRect(screenPosMin, rect.y, screenPos - screenPosMin, rect.height, 1); //lfo bar
218 ofPopStyle();
219
220 ofPushStyle();
221 ofSetColor(0, 255, 0);
222 ofSetLineWidth(2);
223 ofLine(screenPosMin, rect.y + 1, screenPosMin, rect.getMaxY() - 1); //min bar
224 ofLine(screenPosMax, rect.y + 1, screenPosMax, rect.getMaxY() - 1); //max bar
225 ofPopStyle();
226 }
227 return false;
228}
229
230void FloatSliderLFOControl::SetLFOEnabled(bool enabled)
231{

Callers

nothing calls this directly

Calls 13

ofSetColorFunction · 0.85
ofRectFunction · 0.85
ofClampFunction · 0.85
ofPushStyleFunction · 0.85
ofFillFunction · 0.85
ofPopStyleFunction · 0.85
ofSetLineWidthFunction · 0.85
ofLineFunction · 0.85
ValToPosMethod · 0.80
getMaxYMethod · 0.80
GetValueMethod · 0.45
GetMinMethod · 0.45

Tested by

no test coverage detected