summaryrefslogtreecommitdiff
path: root/src/gui.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui.h')
-rw-r--r--src/gui.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gui.h b/src/gui.h
new file mode 100644
index 0000000..76a1128
--- /dev/null
+++ b/src/gui.h
@@ -0,0 +1,37 @@
+#pragma once
+
+#include <SDL.h>
+
+#include <vector>
+#include "sequence.h"
+
+class Slider {
+public:
+ Slider(int x, int y, float* valuePtr, float scaling = 1.f)
+ : m_bounds({ x, y, 25, 75 }), value(valuePtr), valueScaling(scaling) {}
+
+ void Draw(SDL_Renderer*);
+ bool InBounds(int x, int y);
+
+ float* value;
+ float valueScaling;
+private:
+ SDL_Rect m_bounds;
+};
+
+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<Slider> m_sliders;
+
+ Sequence& m_sequence;
+ Slider* m_activeSlider{ nullptr };
+ int m_dragStart{ 0 };
+}; \ No newline at end of file