aboutsummaryrefslogtreecommitdiff
path: root/src/engine/graphics/vector2.hpp
blob: c8c6349c4fc60be6a143fbacf4bf2e8ae5ff5947 (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
45
46
47
48
#pragma once

#include "interfaces/vector2.hpp"

#include <memory>

/**
 * A 2D Vector.
 */
class Vector2 : public IVector2
{
public:
	/**
	 * Creates a 2D vector.
	 */
	explicit Vector2(const IVector2Options &options);

	/**
	 * Returns the X coordinate.
	 */
	[[nodiscard]] unsigned int x() const override;

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

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

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

	const IVector2 &operator+=(const IVector2 &vector2) override;
	const IVector2 &operator-=(const IVector2 &vector2) override;

private:
	unsigned int _x;
	unsigned int _y;
};