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

Method Draw

Source/StepSequencer.cpp:1144–1181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1142}
1143
1144void StepSequencerRow::Draw(float x, float y)
1145{
1146 float xCellSize = float(mGrid->GetWidth()) / mGrid->GetCols();
1147 float yCellSize = float(mGrid->GetHeight()) / mGrid->GetRows();
1148
1149 bool showTextEntry = yCellSize > 14;
1150 mRowPitchEntry->SetShowing(showTextEntry);
1151 mRowPitchEntry->SetPosition(x - 32, y);
1152 mRowPitchEntry->Draw();
1153
1154 if (!showTextEntry)
1155 DrawTextRightJustify(ofToString(mRowPitch), x - 7, y + 10);
1156
1157 const float kPlayHighlightDurationMs = 250;
1158 for (size_t i = 0; i < mPlayedSteps.size(); ++i)
1159 {
1160 if (mPlayedSteps[i].time != -1)
1161 {
1162 if (gTime - mPlayedSteps[i].time < kPlayHighlightDurationMs)
1163 {
1164 if (gTime - mPlayedSteps[i].time > 0)
1165 {
1166 float fade = (1 - (gTime - mPlayedSteps[i].time) / kPlayHighlightDurationMs);
1167 ofPushStyle();
1168 ofSetLineWidth(3 * fade);
1169 ofVec2f pos = mGrid->GetCellPosition(mPlayedSteps[i].step, mRow) + mGrid->GetPosition(true);
1170 ofSetColor(ofColor::white, fade * 255);
1171 ofRect(pos.x, pos.y, xCellSize, yCellSize);
1172 ofPopStyle();
1173 }
1174 }
1175 else
1176 {
1177 mPlayedSteps[i].time = -1;
1178 }
1179 }
1180 }
1181}
1182
1183NoteRepeat::NoteRepeat(StepSequencer* seq, int row)
1184: mSeq(seq)

Callers 1

DrawModuleMethod · 0.45

Calls 15

DrawTextRightJustifyFunction · 0.85
ofToStringFunction · 0.85
ofPushStyleFunction · 0.85
ofSetLineWidthFunction · 0.85
ofSetColorFunction · 0.85
ofRectFunction · 0.85
ofPopStyleFunction · 0.85
sizeMethod · 0.80
GetWidthMethod · 0.45
GetColsMethod · 0.45
GetHeightMethod · 0.45
GetRowsMethod · 0.45

Tested by

no test coverage detected