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

#include "interfaces/vector2.hpp"

#include <memory>

enum CoordsValidation
{
	VALID,
	X_HIGH,
	Y_HIGH
};

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

	[[nodiscard]] virtual unsigned int width() const = 0;

	virtual void width(unsigned int width) = 0;

	[[nodiscard]] virtual unsigned int height() const = 0;

	virtual void height(unsigned int height) = 0;

	[[nodiscard]] virtual CoordsValidation
	validate_coords(const IVector2 &coords) const = 0;

	virtual const IBounds &operator*=(const IBounds &bounds) = 0;
	virtual const IBounds &operator+=(const IBounds &bounds) = 0;
	virtual const IBounds &operator-=(const IBounds &bounds) = 0;
};

struct IBoundsOptions
{
	unsigned int width;
	unsigned int height;
};

using IBoundsFactory = std::shared_ptr<IBounds> (*)(const IBoundsOptions &options);