#include "bounds.hpp" Bounds::Bounds(const BoundsOptions &options) noexcept : _width(options.width), _height(options.height) { } Bounds::Value Bounds::get_width() const noexcept { return _width; } void Bounds::set_width(Bounds::Value width) noexcept { _width = width; } Bounds::Value Bounds::get_height() const noexcept { return _height; } void Bounds::set_height(Bounds::Value height) noexcept { _height = height; } CoordsValidation Bounds::validate_coords(const Vector2 &coords) const noexcept { if (static_cast(coords.get_x()) >= _width) { return CoordsValidation::X_HIGH; } if (static_cast(coords.get_x()) <= 0) { return CoordsValidation::X_LOW; } if (static_cast(coords.get_y()) >= _height) { return CoordsValidation::Y_HIGH; } if (static_cast(coords.get_y()) <= 0) { return CoordsValidation::Y_LOW; } return CoordsValidation::VALID; } const Bounds &Bounds::operator*=(const Bounds &rhs) noexcept { _width *= rhs._width; _height *= rhs._height; return *this; } const Bounds &Bounds::operator+=(const Bounds &rhs) noexcept { _width += rhs._width; _height += rhs._height; return *this; } const Bounds &Bounds::operator-=(const Bounds &rhs) noexcept { _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; }