diff options
author | cflip <cflip@cflip.net> | 2021-12-22 15:20:13 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2021-12-22 15:20:13 -0700 |
commit | 8844d54b4bd5535009a1b70888860490899ca0d5 (patch) | |
tree | a03cb2a663299f3bc61f5d981560c5e84e36a483 /gui.h | |
parent | d3fcd2d8dbff9362b47ab94c8b4cc24826077591 (diff) |
Refactoring and cleanup
Diffstat (limited to 'gui.h')
-rw-r--r-- | gui.h | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +#pragma once + +#include <vector> +#include "sequence.h" + +struct SDL_Renderer; + +class Knob { +public: + Knob(int x, int y, float* valuePtr, float scaling = 1.f) + : m_x(x), m_y(y), value(valuePtr), valueScaling(scaling) {} + + void Draw(SDL_Renderer*); + bool InBounds(int x, int y); + + float* value; + float valueScaling; +private: + int m_x, m_y; +}; + +class GUI { +public: + GUI(Sequence&); + + void OnMouseDown(int x, int y); + void OnMouseUp(); + void OnMouseMove(int x, int y); + + void Repaint(SDL_Renderer*, int currentStep); +private: + std::vector<Knob> m_knobs; + Knob* m_activeKnob{ nullptr }; + int m_dragStart{ 0 }; +};
\ No newline at end of file |