diff options
Diffstat (limited to 'src/engine/data/bounds.cpp')
-rw-r--r-- | src/engine/data/bounds.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/engine/data/bounds.cpp b/src/engine/data/bounds.cpp index fdf8c6b..1a8c4d0 100644 --- a/src/engine/data/bounds.cpp +++ b/src/engine/data/bounds.cpp @@ -50,26 +50,36 @@ CoordsValidation Bounds::validate_coords(const Vector2 &coords) const noexcept return CoordsValidation::VALID; } -const Bounds &Bounds::operator*=(const Bounds &bounds) noexcept +const Bounds &Bounds::operator*=(const Bounds &rhs) noexcept { - _width *= bounds._width; - _height *= bounds._height; + _width *= rhs._width; + _height *= rhs._height; return *this; } -const Bounds &Bounds::operator+=(const Bounds &bounds) noexcept +const Bounds &Bounds::operator+=(const Bounds &rhs) noexcept { - _width += bounds._width; - _height += bounds._height; + _width += rhs._width; + _height += rhs._height; return *this; } -const Bounds &Bounds::operator-=(const Bounds &bounds) noexcept +const Bounds &Bounds::operator-=(const Bounds &rhs) noexcept { - _width -= bounds._width; - _height -= bounds._height; + _width -= rhs._width; + _height -= rhs._height; return *this; } + +Bounds Bounds::operator-(const Bounds &rhs) const noexcept +{ + auto new_bounds = Bounds(*this); + + new_bounds._width -= rhs._width; + new_bounds._height -= rhs._height; + + return new_bounds; +} |