aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/vector2.hpp
blob: dfd369fd905d704bf55a7f900a92fe66b4a0c00a (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 <memory>

class IVector2
{
public:
	virtual ~IVector2() = default;

	/**
	 * 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::shared_ptr<IVector2> (*)(const IVector2Options &options);