aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/cursor.hpp
blob: caa89dfa256c64a84dbdb5e460e2d8fea9da2f91 (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
40
41
42
43
#pragma once

#include "interfaces/publisher.hpp"
#include "interfaces/subscriber.hpp"

#include "engine/data/vector2.hpp"

#include <memory>

enum CursorEvent
{
	POSITION_CHANGE
};

// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class ICursorController : public IPublisher<CursorEvent, Vector2>
{
public:
	using Event = CursorEvent;
	using Context = Vector2;
	using Subscriber = std::shared_ptr<ISubscriber<Context>>;

	~ICursorController() noexcept override = default;

	virtual void move(const Vector2 &direction, const uint32_t &amount) noexcept = 0;

	// NOLINTNEXTLINE(google-default-arguments)
	virtual void move_to(const Vector2 &position, bool silent = false) noexcept = 0;

	[[nodiscard]] virtual Vector2 where() const noexcept = 0;

	virtual void ensure_position() noexcept = 0;

	virtual void hide() noexcept = 0;

	virtual void show() noexcept = 0;

	void subscribe(const Event &event,
				   const Subscriber &subscriber) noexcept override = 0;

	void notify_subscribers(const Event &event,
							const Context &context) const noexcept override = 0;
};