diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-06 13:26:14 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:54 +0200 |
commit | a285df324deb579d262ea7cf484de4d6b11b28e4 (patch) | |
tree | e2d181d58a09826c318d7aab5bee66bad3cf484a /src/engine/data/bounds.cpp | |
parent | 0e40bc7ce8c3b3be083002f88c3317d65f6570ad (diff) |
refactor: improve getters & setters for vector2 & bounds
Diffstat (limited to 'src/engine/data/bounds.cpp')
-rw-r--r-- | src/engine/data/bounds.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/engine/data/bounds.cpp b/src/engine/data/bounds.cpp index cd08a02..fbd7ec4 100644 --- a/src/engine/data/bounds.cpp +++ b/src/engine/data/bounds.cpp @@ -5,34 +5,34 @@ Bounds::Bounds(const BoundsOptions &options) { } -uint32_t Bounds::width() const noexcept +uint32_t Bounds::get_width() const noexcept { return _width; } -void Bounds::width(uint32_t width) noexcept +void Bounds::set_width(uint32_t width) noexcept { _width = width; } -uint32_t Bounds::height() const noexcept +uint32_t Bounds::get_height() const noexcept { return _height; } -void Bounds::height(uint32_t height) noexcept +void Bounds::set_height(uint32_t height) noexcept { _height = height; } CoordsValidation Bounds::validate_coords(const Vector2 &coords) const noexcept { - if (coords.x() >= _width) + if (coords.get_x() >= _width) { return CoordsValidation::X_HIGH; } - if (coords.y() >= _height) + if (coords.get_y() >= _height) { return CoordsValidation::Y_HIGH; } @@ -42,24 +42,24 @@ CoordsValidation Bounds::validate_coords(const Vector2 &coords) const noexcept const Bounds &Bounds::operator*=(const Bounds &bounds) noexcept { - _width *= bounds.width(); - _height *= bounds.height(); + _width *= bounds._width; + _height *= bounds._height; return *this; } const Bounds &Bounds::operator+=(const Bounds &bounds) noexcept { - _width += bounds.width(); - _height += bounds.height(); + _width += bounds._width; + _height += bounds._height; return *this; } const Bounds &Bounds::operator-=(const Bounds &bounds) noexcept { - _width -= bounds.width(); - _height -= bounds.height(); + _width -= bounds._width; + _height -= bounds._height; return *this; } |