diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-06 13:16:05 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:54 +0200 |
commit | 0e40bc7ce8c3b3be083002f88c3317d65f6570ad (patch) | |
tree | 2fcc470a0f1ce1d51ff26c53c8a9a890b3f31b3b /src/engine/graphics/bounds.cpp | |
parent | f4d812a5b9131e65bb55db7211dc68fc453792df (diff) |
refactor: make vector2 & bounds data classes
Diffstat (limited to 'src/engine/graphics/bounds.cpp')
-rw-r--r-- | src/engine/graphics/bounds.cpp | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/src/engine/graphics/bounds.cpp b/src/engine/graphics/bounds.cpp deleted file mode 100644 index 8cb83eb..0000000 --- a/src/engine/graphics/bounds.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#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; -} |