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

Method DrawConnection

Source/IDrawableModule.cpp:559–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559void IDrawableModule::DrawConnection(IClickable* target)
560{
561 float lineWidth = 1;
562 float plugWidth = 4;
563 int lineAlpha = 100;
564
565 IDrawableModule* targetModule = dynamic_cast<IDrawableModule*>(target);
566
567 bool fatCable = false;
568 if (TheSynth->GetLastClickedModule() == this ||
569 TheSynth->GetLastClickedModule() == targetModule)
570 fatCable = true;
571
572 if (fatCable)
573 {
574 lineWidth = 3;
575 plugWidth = 8;
576 lineAlpha = 255;
577 }
578
579 ofPushMatrix();
580 ofPushStyle();
581
582 PatchCableOld cable = GetPatchCableOld(target);
583
584 ofColor lineColor = GetColor(kModuleCategory_Other);
585 lineColor.setBrightness(lineColor.getBrightness() * .8f);
586 ofColor lineColorAlphaed = lineColor;
587 lineColorAlphaed.a = lineAlpha;
588
589 float wThis, hThis, xThis, yThis;
590 GetDimensions(wThis, hThis);
591 GetPosition(xThis, yThis);
592
593 ofSetLineWidth(plugWidth);
594 ofSetColor(lineColor);
595 ofLine(cable.plug.x, cable.plug.y, cable.end.x, cable.end.y);
596
597 ofSetLineWidth(lineWidth);
598 ofSetColor(lineColorAlphaed);
599 ofLine(cable.start.x, cable.start.y, cable.plug.x, cable.plug.y);
600
601 ofPopStyle();
602 ofPopMatrix();
603}
604
605void IDrawableModule::SetTarget(IClickable* target)
606{

Callers 1

DrawModuleMethod · 0.80

Calls 10

ofPushMatrixFunction · 0.85
ofPushStyleFunction · 0.85
ofSetLineWidthFunction · 0.85
ofSetColorFunction · 0.85
ofLineFunction · 0.85
ofPopStyleFunction · 0.85
ofPopMatrixFunction · 0.85
GetLastClickedModuleMethod · 0.80
setBrightnessMethod · 0.80
getBrightnessMethod · 0.80

Tested by

no test coverage detected