From 8844d54b4bd5535009a1b70888860490899ca0d5 Mon Sep 17 00:00:00 2001 From: cflip Date: Wed, 22 Dec 2021 15:20:13 -0700 Subject: Refactoring and cleanup --- gui.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 gui.h (limited to 'gui.h') diff --git a/gui.h b/gui.h new file mode 100644 index 0000000..9bd8545 --- /dev/null +++ b/gui.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#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 m_knobs; + Knob* m_activeKnob{ nullptr }; + int m_dragStart{ 0 }; +}; \ No newline at end of file -- cgit v1.2.3