aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/bounds.hpp
blob: 9cec97ed86a53e02a74e347960c0ab59745b5268 (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 <functional>
#include <memory>

enum CoordsValidation
{
	VALID,
	X_HIGH,
	Y_HIGH
};

class IBounds
{
public:
	[[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::function<std::shared_ptr<IBounds>(const IBoundsOptions &options)>;