diff options
author | cflip <cflip@cflip.net> | 2021-12-22 16:26:04 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2021-12-22 16:26:04 -0700 |
commit | 9ac242c22d86f1a32afe90510b0e2365d01cc5f2 (patch) | |
tree | 79eff6453ce59fe2323cc70ef9aefad0222b2278 /gui.cpp | |
parent | 8844d54b4bd5535009a1b70888860490899ca0d5 (diff) |
Use sequence parameters for step colours
Just a nice little visual effect.
Diffstat (limited to 'gui.cpp')
-rw-r--r-- | gui.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -22,6 +22,7 @@ bool Knob::InBounds(int x, int y) } GUI::GUI(Sequence& seq) + : m_sequence(seq) { int i = 0; for (auto& step : seq.steps) { @@ -63,14 +64,14 @@ void GUI::OnMouseMove(int x, int y) void GUI::Repaint(SDL_Renderer* renderer, int currentStep) { SDL_Rect rect = { - (640 - 8 * (32 + 8)) / 2, - (320 - 32) / 2, + 40, + 40, 32, 32 }; for (int i = 0; i < 8; i++) { - SDL_SetRenderDrawColor(renderer, 128, i * (255 / 8), 255, 255); + SDL_SetRenderDrawColor(renderer, m_sequence.steps[i].modDepth * 8, m_sequence.steps[i].modFreq * 2, m_sequence.steps[i].carrierFreq / 3, 255); if (i == currentStep) SDL_RenderFillRect(renderer, &rect); @@ -80,6 +81,8 @@ void GUI::Repaint(SDL_Renderer* renderer, int currentStep) rect.x += rect.w + 8; } + SDL_SetRenderDrawColor(renderer, 127, 127, 255, 255); + for (Knob& knob : m_knobs) { knob.Draw(renderer); } |