aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/vector2.hpp
blob: a58686f148b598e482ce0dc1f7f1f9a73af153c4 (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
44
#pragma once

#include <functional>
#include <memory>

class IVector2
{
public:
	/**
	 * Returns the X coordinate.
	 */
	[[nodiscard]] virtual unsigned int x() const = 0;

	/**
	 * Sets the X coordinate.
	 *
	 * @param x A new X coordinate
	 */
	virtual void x(unsigned int x) = 0;

	/**
	 * Returns the Y coordinate.
	 */
	[[nodiscard]] virtual unsigned int y() const = 0;

	/**
	 * Sets the Y coordinate.
	 *
	 * @param Y A new Y coordinate
	 */
	virtual void y(unsigned int y) = 0;

	virtual const IVector2 &operator+=(const IVector2 &vector2) = 0;
	virtual const IVector2 &operator-=(const IVector2 &vector2) = 0;
};

struct IVector2Options
{
	unsigned int x;
	unsigned int y;
};

using IVector2Factory =
	std::function<std::shared_ptr<IVector2>(const IVector2Options &options)>;