summaryrefslogtreecommitdiff
path: root/ui/gameMainSelector.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gameMainSelector.h')
-rw-r--r--ui/gameMainSelector.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/ui/gameMainSelector.h b/ui/gameMainSelector.h
new file mode 100644
index 0000000..e0715c9
--- /dev/null
+++ b/ui/gameMainSelector.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "special_members.hpp"
+#include "uiComponent.h"
+#include <glm/glm.hpp>
+#include <memory>
+#include <string>
+class Ray;
+class UIShader;
+union SDL_Event;
+class Camera;
+
+class GameMainSelector : public UIComponent {
+public:
+ class ClickReceiver {
+ public:
+ ClickReceiver() = default;
+ virtual ~ClickReceiver() = default;
+ DEFAULT_MOVE_COPY(ClickReceiver);
+
+ virtual void click(const Ray &) = 0;
+ virtual void move(const Ray &) = 0;
+ virtual bool handleMove() = 0;
+ };
+
+ GameMainSelector(const Camera * c, glm::vec2 size);
+
+ void render(const UIShader & shader, const Position & pos) const override;
+
+ bool handleInput(const SDL_Event & e, const Position &) override;
+
+ void defaultClick(const Ray & ray);
+
+ std::unique_ptr<ClickReceiver> target;
+
+private:
+ const Camera * camera;
+ std::string clicked;
+};