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

Method DrawModule

Source/QuickSpawnMenu.cpp:431–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429}
430
431void QuickSpawnMenu::DrawModule()
432{
433 ofPushStyle();
434
435 mHighlightIndex = -1;
436 if (TheSynth->GetMouseY(GetOwningContainer()) > GetPosition().y)
437 mHighlightIndex = GetIndexAt(TheSynth->GetMouseX(GetOwningContainer()) - GetPosition().x, TheSynth->GetMouseY(GetOwningContainer()) - GetPosition().y);
438
439 ofSetColor(50, 50, 50, 100);
440 ofFill();
441 ofRect(-2, -2, mWidth + 4, mHeight + 4);
442 for (int i = 0; i < mElements.size(); ++i)
443 {
444 if (mMenuMode == MenuMode::ModuleCategories)
445 ofSetColor(IDrawableModule::GetColor(TheTitleBar->GetSpawnLists()[mCategoryIndices[i]]->GetCategory()) * (i == mHighlightIndex ? .7f : .5f), 255);
446 else
447 ofSetColor(IDrawableModule::GetColor(TheSynth->GetModuleFactory()->GetModuleCategory(mElements[i])) * (i == mHighlightIndex ? .7f : .5f), 255);
448 ofRect(0, i * kItemSpacing + 1, mWidth, kItemSpacing - 1);
449 if (i == mHighlightIndex)
450 ofSetColor(255, 255, 0);
451 else
452 ofSetColor(255, 255, 255);
453
454 bool showDecorator = true;
455 if (mMenuMode == MenuMode::SingleCategory && mSelectedCategoryIndex >= 0 && mSelectedCategoryIndex < (int)TheTitleBar->GetSpawnLists().size())
456 showDecorator = TheTitleBar->GetSpawnLists()[mSelectedCategoryIndex]->ShouldShowDecorators();
457
458 DrawTextNormal(mElements[i].mLabel + (showDecorator ? (" " + mElements[i].mDecorator) : ""), 1 + (mMenuMode == MenuMode::SingleLetter ? 0 : kRightClickShiftX), i * kItemSpacing + 12);
459 }
460 if (mElements.size() == 0)
461 {
462 ofSetColor(255, 255, 255);
463 DrawTextNormal("no modules found", 1, 12);
464 }
465
466 ofPopStyle();
467
468 mMainContainerFollower->UpdateLocation();
469}
470
471void QuickSpawnMenu::DrawModuleUnclipped()
472{

Callers

nothing calls this directly

Calls 14

ofPushStyleFunction · 0.85
ofSetColorFunction · 0.85
ofFillFunction · 0.85
ofRectFunction · 0.85
DrawTextNormalFunction · 0.85
ofPopStyleFunction · 0.85
sizeMethod · 0.80
GetCategoryMethod · 0.80
GetModuleFactoryMethod · 0.80
ShouldShowDecoratorsMethod · 0.80
UpdateLocationMethod · 0.80
GetMouseYMethod · 0.45

Tested by

no test coverage detected