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

Method DrawSyntaxHighlight

Source/CodeEntry.cpp:528–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526}
527
528void CodeEntry::DrawSyntaxHighlight(std::string input, ofColor color, std::vector<int> mapping, int filter1, int filter2)
529{
530 std::string filtered = FilterText(input, mapping, filter1, filter2);
531 ofSetColor(color, gModuleDrawAlpha);
532
533 float shake = (1 - ofClamp((gTime - mLastPublishTime) / 150, 0, 1)) * 3.0f;
534 if (TheSynth->IsAudioPaused())
535 shake = 0;
536 float offsetX = ofRandom(-shake, shake);
537 float offsetY = ofRandom(-shake, shake);
538
539 gFontFixedWidth.DrawString(filtered, mFontSize, mX + 2 - mScroll.x + offsetX, mY + mCharHeight - mScroll.y + offsetY);
540}
541
542std::string CodeEntry::FilterText(std::string input, std::vector<int> mapping, int filter1, int filter2)
543{

Callers

nothing calls this directly

Calls 5

ofSetColorFunction · 0.85
ofClampFunction · 0.85
ofRandomFunction · 0.85
IsAudioPausedMethod · 0.80
DrawStringMethod · 0.80

Tested by

no test coverage detected