blob: 8cb83ebb0b36fe62250965b417889bfb802f0433 (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include "bounds.hpp"
Bounds::Bounds(const IBoundsOptions &options)
: _width(options.width), _height(options.height)
{
}
unsigned int Bounds::width() const
{
return _width;
}
void Bounds::width(unsigned int width)
{
_width = width;
}
unsigned int Bounds::height() const
{
return _height;
}
void Bounds::height(unsigned int height)
{
_height = height;
}
CoordsValidation Bounds::validate_coords(const IVector2 &coords) const
{
if (coords.x() >= _width)
{
return CoordsValidation::X_HIGH;
}
if (coords.y() >= _height)
{
return CoordsValidation::Y_HIGH;
}
return CoordsValidation::VALID;
}
const IBounds &Bounds::operator*=(const IBounds &bounds)
{
_width *= bounds.width();
_height *= bounds.height();
return *this;
}
const IBounds &Bounds::operator+=(const IBounds &bounds)
{
_width += bounds.width();
_height += bounds.height();
return *this;
}
const IBounds &Bounds::operator-=(const IBounds &bounds)
{
_width -= bounds.width();
_height -= bounds.height();
return *this;
}
|