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

Method DrawConsole

Source/ModularSynth.cpp:872–960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870}
871
872void ModularSynth::DrawConsole()
873{
874 /*if (!mErrors.empty())
875 {
876 ofPushStyle();
877 ofFill();
878 ofSetColor(255,0,0,128);
879 ofBeginShape();
880 ofVertex(0,0);
881 ofVertex(20,0);
882 ofVertex(0,20);
883 ofEndShape();
884 ofPopStyle();
885 }*/
886
887 float consoleY = TheTitleBar->GetRect().height + 15;
888
889 if (IKeyboardFocusListener::GetActiveKeyboardFocus() == mConsoleEntry)
890 {
891 mConsoleEntry->SetPosition(0, consoleY - 15);
892 mConsoleEntry->Draw();
893 consoleY += 17;
894 }
895 else
896 {
897 if (gHoveredUIControl != nullptr)
898 {
899 ofPushStyle();
900 ofSetColor(0, 255, 255);
901 DrawTextNormal(gHoveredUIControl->Path(), 0, consoleY - 4);
902 ofPopStyle();
903 }
904 }
905
906 if (mHasCircularDependency)
907 {
908 ofPushStyle();
909 float pulse = ofMap(sin(gTime / 500 * PI * 2), -1, 1, .5f, 1);
910 ofSetColor(255 * pulse, 255 * pulse, 0);
911 DrawTextNormal("circular dependency detected", 0, consoleY + 20);
912 ofPopStyle();
913 }
914
915 if (IKeyboardFocusListener::GetActiveKeyboardFocus() == mConsoleEntry)
916 {
917 int outputLines = (int)mEvents.size();
918 if (IKeyboardFocusListener::GetActiveKeyboardFocus() == mConsoleEntry)
919 outputLines += mErrors.size();
920 if (outputLines > 0)
921 {
922 ofPushStyle();
923 ofSetColor(0, 0, 0, 150);
924 ofFill();
925 float titleBarW, titleBarH;
926 TheTitleBar->GetDimensions(titleBarW, titleBarH);
927 ofRect(0, consoleY - 16, titleBarW, outputLines * 15 + 3);
928 ofPopStyle();
929 }

Callers

nothing calls this directly

Calls 15

ofPushStyleFunction · 0.85
ofSetColorFunction · 0.85
DrawTextNormalFunction · 0.85
ofPopStyleFunction · 0.85
ofMapFunction · 0.85
ofFillFunction · 0.85
ofRectFunction · 0.85
ofSplitStringFunction · 0.85
PathMethod · 0.80
sizeMethod · 0.80
DrawStringMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected