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

Method DrawModule

Source/EffectChain.cpp:183–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183void EffectChain::DrawModule()
184{
185 if (Minimized() || IsVisible() == false)
186 return;
187
188 mEffectSpawnList->SetShowing(mShowSpawnList);
189 mSpawnEffectButton->SetShowing(mShowSpawnList && mSpawnIndex != -1);
190 if (mSpawnIndex != -1)
191 mSpawnEffectButton->SetLabel((std::string("spawn ") + mEffectSpawnList->GetLabel(mSpawnIndex)).c_str());
192
193 for (int i = 0; i < mEffects.size(); ++i)
194 {
195 ofVec2f pos = GetEffectPos(i);
196
197 if (gTime < mSwapTime) //in swap animation
198 {
199 double progress = 1 - (mSwapTime - gTime) / gSwapLength;
200 if (i == mSwapFromIdx)
201 {
202 pos.set(mSwapToPos.x * (1 - progress) + pos.x * progress,
203 mSwapToPos.y * (1 - progress) + pos.y * progress);
204 }
205 if (i == mSwapToIdx)
206 {
207 pos.set(mSwapFromPos.x * (1 - progress) + pos.x * progress,
208 mSwapFromPos.y * (1 - progress) + pos.y * progress);
209 }
210 }
211
212 mEffects[i]->SetPosition(pos.x, pos.y);
213 float w, h;
214 mEffects[i]->GetDimensions(w, h);
215 w = MAX(w, MIN_EFFECT_WIDTH);
216
217 mEffectControls[i].mMoveLeftButton->SetShowing(i > 0);
218 mEffectControls[i].mMoveLeftButton->SetPosition(pos.x + w / 2 - 46, pos.y - 30);
219 mEffectControls[i].mMoveLeftButton->Draw();
220
221 mEffectControls[i].mMoveRightButton->SetShowing(i < (int)mEffects.size() - 1 && !(GetKeyModifiers() & kModifier_Shift));
222 mEffectControls[i].mMoveRightButton->SetPosition(pos.x + w / 2 + 35, pos.y - 30);
223 mEffectControls[i].mMoveRightButton->Draw();
224
225 mEffectControls[i].mDeleteButton->SetShowing(i == (int)mEffects.size() - 1 || (GetKeyModifiers() & kModifier_Shift));
226 mEffectControls[i].mDeleteButton->SetPosition(pos.x + w / 2 + 35, pos.y - 30);
227 mEffectControls[i].mDeleteButton->Draw();
228
229 mEffectControls[i].mDryWetSlider->SetPosition(pos.x + w / 2 - 30, pos.y - 29);
230 mEffectControls[i].mDryWetSlider->Draw();
231 }
232
233 for (int i = 0; i < mEffects.size(); ++i)
234 {
235 mEffects[i]->Draw();
236
237 float x, y, w, h;
238 mEffects[i]->GetPosition(x, y, true);
239 mEffects[i]->GetDimensions(w, h);
240 w = MAX(w, MIN_EFFECT_WIDTH);

Callers

nothing calls this directly

Calls 15

GetKeyModifiersFunction · 0.85
ofPushStyleFunction · 0.85
ofFillFunction · 0.85
ofSetColorFunction · 0.85
ofRectFunction · 0.85
ofPopStyleFunction · 0.85
ofPushMatrixFunction · 0.85
ofTranslateFunction · 0.85
ofPopMatrixFunction · 0.85
sizeMethod · 0.80
DrawConnectionMethod · 0.80
getMaxXMethod · 0.80

Tested by

no test coverage detected