| 499 | } |
| 500 | |
| 501 | void ModularSynth::Draw(void* vg) |
| 502 | { |
| 503 | gNanoVG = (NVGcontext*)vg; |
| 504 | |
| 505 | ofNoFill(); |
| 506 | |
| 507 | //DrawTextNormal("fps: "+ofToString(ofGetFrameRate(),4)+" "+ofToString(ofGetWidth()*ofGetHeight()), 100, 100,50); |
| 508 | //return; |
| 509 | |
| 510 | mModuleContainer.SetDrawScale(gDrawScale); |
| 511 | mDrawRect.set(-GetDrawOffset().x, -GetDrawOffset().y, ofGetWidth() / gDrawScale, ofGetHeight() / gDrawScale); |
| 512 | |
| 513 | if (mFatalError != "") |
| 514 | { |
| 515 | ofSetColor(255, 255, 255, 255); |
| 516 | DrawFallbackText(("bespoke " + GetBuildInfoString()).c_str(), 100, 50); |
| 517 | |
| 518 | if (gFont.IsLoaded()) |
| 519 | DrawTextNormal(mFatalError, 100, 100, 18); |
| 520 | else |
| 521 | DrawFallbackText(mFatalError.c_str(), 100, 100); |
| 522 | } |
| 523 | |
| 524 | if (ScriptModule::sBackgroundTextString != "") |
| 525 | { |
| 526 | ofPushStyle(); |
| 527 | ofSetColor(ScriptModule::sBackgroundTextColor); |
| 528 | DrawTextBold(ScriptModule::sBackgroundTextString, ScriptModule::sBackgroundTextPos.x, ScriptModule::sBackgroundTextPos.y + ScriptModule::sBackgroundTextSize, ScriptModule::sBackgroundTextSize); |
| 529 | ofPopStyle(); |
| 530 | } |
| 531 | |
| 532 | if (UserPrefs.draw_background_lissajous.Get()) |
| 533 | DrawLissajous(mGlobalRecordBuffer, 0, 0, ofGetWidth(), ofGetHeight(), sBackgroundLissajousR, sBackgroundLissajousG, sBackgroundLissajousB, UserPrefs.background_lissajous_autocorrelate.Get()); |
| 534 | |
| 535 | if (gTime == 1 && mFatalError == "") |
| 536 | { |
| 537 | std::string loading("Bespoke is initializing audio..."); |
| 538 | DrawTextNormal(loading, ofGetWidth() / 2 - GetStringWidth(loading, 28) / 2, ofGetHeight() / 2 - 6, 28); |
| 539 | return; |
| 540 | } |
| 541 | |
| 542 | if (!mInitialized && mFatalError == "") |
| 543 | { |
| 544 | std::string loading("Bespoke is loading..."); |
| 545 | DrawTextNormal(loading, ofGetWidth() / 2 - GetStringWidth(loading, 28) / 2, ofGetHeight() / 2 - 6, 28); |
| 546 | return; |
| 547 | } |
| 548 | |
| 549 | ofPushMatrix(); |
| 550 | |
| 551 | ofScale(gDrawScale, gDrawScale, gDrawScale); |
| 552 | |
| 553 | ofPushMatrix(); |
| 554 | |
| 555 | ofTranslate(GetDrawOffset().x, GetDrawOffset().y); |
| 556 | |
| 557 | if (ShouldShowGridSnap()) |
| 558 | { |
no test coverage detected