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

Method Render

Source/CodeEntry.cpp:240–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240void CodeEntry::Render()
241{
242 ofPushStyle();
243 ofPushMatrix();
244
245 ofSetLineWidth(.5f);
246
247 float w, h;
248 GetDimensions(w, h);
249
250 ofClipWindow(mX, mY, w, h, true);
251
252 bool isCurrent = IKeyboardFocusListener::GetActiveKeyboardFocus() == this;
253
254 ofColor color = ofColor::white;
255
256 ofFill();
257
258 bool hasUnpublishedCode = (mString != mPublishedString);
259
260 if (isCurrent)
261 {
262 ofSetColor(currentBg);
263 }
264 else
265 {
266 if (hasUnpublishedCode)
267 ofSetColor(unpublishedBg);
268 else
269 ofSetColor(publishedBg);
270 }
271 ofRect(mX, mY, w, h);
272
273 double timeSincePublished = gTime - mLastPublishTime;
274 if (TheSynth->IsAudioPaused())
275 timeSincePublished = 99999;
276
277 if (timeSincePublished < 400)
278 {
279 ofSetColor(0, 255, 0, 150 * (1 - timeSincePublished / 400));
280 ofRect(mX, mLastPublishedLineStart * mCharHeight + mY + 3 - mScroll.y, mWidth, mCharHeight * (mLastPublishedLineEnd + 1 - mLastPublishedLineStart), L(corner, 2));
281 }
282
283 ofPushStyle();
284 ofNoFill();
285 if (mHasError)
286 {
287 ofSetColor(255, 0, 0, gModuleDrawAlpha);
288 ofSetLineWidth(2);
289 }
290 else if (hasUnpublishedCode)
291 {
292 float highlight = 1 - ofClamp(timeSincePublished / 150, 0, 1);
293 ofSetColor(ofLerp(170, 255, highlight), 255, ofLerp(170, 255, highlight), gModuleDrawAlpha);
294 ofSetLineWidth(2 + highlight * 3);
295 }
296 else
297 {

Callers

nothing calls this directly

Calls 15

ofPushStyleFunction · 0.85
ofPushMatrixFunction · 0.85
ofSetLineWidthFunction · 0.85
ofClipWindowFunction · 0.85
ofFillFunction · 0.85
ofSetColorFunction · 0.85
ofRectFunction · 0.85
ofNoFillFunction · 0.85
ofClampFunction · 0.85
ofLerpFunction · 0.85
ofPopStyleFunction · 0.85
ofVec2fClass · 0.85

Tested by

no test coverage detected