summaryrefslogtreecommitdiff
path: root/ui/gameMainSelector.h
blob: e0715c909b55671e7dbad28d15ad73c0e46be023 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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;
};