#include "bounds.hpp" Bounds::Bounds(const BoundsOptions &options) noexcept : _width(options.width), _height(options.height) { } auto Bounds::get_width() const noexcept -> Bounds::Value { return _width; } void Bounds::set_width(Bounds::Value width) noexcept { _width = width; } auto Bounds::get_height() const noexcept -> Bounds::Value { return _height; } void Bounds::set_height(Bounds::Value height) noexcept { _height = height; } auto Bounds::validate_coords(const Vector2 &coords) const noexcept -> CoordsValidation { 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; } auto Bounds::operator*=(const Bounds &rhs) noexcept -> const Bounds & { _width *= rhs._width; _height *= rhs._height; return *this; } auto Bounds::operator+=(const Bounds &rhs) noexcept -> const Bounds & { _width += rhs._width; _height += rhs._height; return *this; } auto Bounds::operator-=(const Bounds &rhs) noexcept -> const Bounds & { _width -= rhs._width; _height -= rhs._height; return *this; } auto Bounds::operator-(const Bounds &rhs) const noexcept -> Bounds { auto new_bounds = Bounds(*this); new_bounds._width -= rhs._width; new_bounds._height -= rhs._height; return new_bounds; }