diff options
Diffstat (limited to 'src/engine/data')
-rw-r--r-- | src/engine/data/bounds.cpp | 14 | ||||
-rw-r--r-- | src/engine/data/bounds.hpp | 14 | ||||
-rw-r--r-- | src/engine/data/vector2.cpp | 22 | ||||
-rw-r--r-- | src/engine/data/vector2.hpp | 30 |
4 files changed, 40 insertions, 40 deletions
diff --git a/src/engine/data/bounds.cpp b/src/engine/data/bounds.cpp index 1a8c4d0..ca67008 100644 --- a/src/engine/data/bounds.cpp +++ b/src/engine/data/bounds.cpp @@ -5,7 +5,7 @@ Bounds::Bounds(const BoundsOptions &options) noexcept { } -Bounds::Value Bounds::get_width() const noexcept +auto Bounds::get_width() const noexcept -> Bounds::Value { return _width; } @@ -15,7 +15,7 @@ void Bounds::set_width(Bounds::Value width) noexcept _width = width; } -Bounds::Value Bounds::get_height() const noexcept +auto Bounds::get_height() const noexcept -> Bounds::Value { return _height; } @@ -25,7 +25,7 @@ void Bounds::set_height(Bounds::Value height) noexcept _height = height; } -CoordsValidation Bounds::validate_coords(const Vector2 &coords) const noexcept +auto Bounds::validate_coords(const Vector2 &coords) const noexcept -> CoordsValidation { if (static_cast<Bounds::Value>(coords.get_x()) >= _width) { @@ -50,7 +50,7 @@ CoordsValidation Bounds::validate_coords(const Vector2 &coords) const noexcept return CoordsValidation::VALID; } -const Bounds &Bounds::operator*=(const Bounds &rhs) noexcept +auto Bounds::operator*=(const Bounds &rhs) noexcept -> const Bounds & { _width *= rhs._width; _height *= rhs._height; @@ -58,7 +58,7 @@ const Bounds &Bounds::operator*=(const Bounds &rhs) noexcept return *this; } -const Bounds &Bounds::operator+=(const Bounds &rhs) noexcept +auto Bounds::operator+=(const Bounds &rhs) noexcept -> const Bounds & { _width += rhs._width; _height += rhs._height; @@ -66,7 +66,7 @@ const Bounds &Bounds::operator+=(const Bounds &rhs) noexcept return *this; } -const Bounds &Bounds::operator-=(const Bounds &rhs) noexcept +auto Bounds::operator-=(const Bounds &rhs) noexcept -> const Bounds & { _width -= rhs._width; _height -= rhs._height; @@ -74,7 +74,7 @@ const Bounds &Bounds::operator-=(const Bounds &rhs) noexcept return *this; } -Bounds Bounds::operator-(const Bounds &rhs) const noexcept +auto Bounds::operator-(const Bounds &rhs) const noexcept -> Bounds { auto new_bounds = Bounds(*this); diff --git a/src/engine/data/bounds.hpp b/src/engine/data/bounds.hpp index ccea2c3..5444503 100644 --- a/src/engine/data/bounds.hpp +++ b/src/engine/data/bounds.hpp @@ -26,21 +26,21 @@ public: explicit Bounds(const BoundsOptions &options) noexcept; - [[nodiscard]] Value get_width() const noexcept; + [[nodiscard]] auto get_width() const noexcept -> Value; void set_width(Value width) noexcept; - [[nodiscard]] Value get_height() const noexcept; + [[nodiscard]] auto get_height() const noexcept -> Value; void set_height(Value height) noexcept; - [[nodiscard]] CoordsValidation validate_coords(const Vector2 &coords) const noexcept; + [[nodiscard]] auto validate_coords(const Vector2 &coords) const noexcept -> CoordsValidation; - const Bounds &operator*=(const Bounds &rhs) noexcept; - const Bounds &operator+=(const Bounds &rhs) noexcept; - const Bounds &operator-=(const Bounds &rhs) noexcept; + auto operator*=(const Bounds &rhs) noexcept -> const Bounds &; + auto operator+=(const Bounds &rhs) noexcept -> const Bounds &; + auto operator-=(const Bounds &rhs) noexcept -> const Bounds &; - Bounds operator-(const Bounds &rhs) const noexcept; + auto operator-(const Bounds &rhs) const noexcept -> Bounds; private: Value _width = 0U; diff --git a/src/engine/data/vector2.cpp b/src/engine/data/vector2.cpp index b838051..0554930 100644 --- a/src/engine/data/vector2.cpp +++ b/src/engine/data/vector2.cpp @@ -2,7 +2,7 @@ #include "util/hash.hpp" -Vector2::Value Vector2::get_x() const noexcept +auto Vector2::get_x() const noexcept -> Vector2::Value { return _x; } @@ -12,7 +12,7 @@ void Vector2::set_x(Vector2::Value x) noexcept _x = x; } -Vector2::Value Vector2::get_y() const noexcept +auto Vector2::get_y() const noexcept -> Vector2::Value { return _y; } @@ -22,13 +22,13 @@ void Vector2::set_y(Vector2::Value y) noexcept _y = y; } -Vector2 Vector2::to_direction(const Vector2 &direction, - Vector2::Value amount) const noexcept +auto Vector2::to_direction(const Vector2 &direction, + Vector2::Value amount) const noexcept -> Vector2 { return *this + (direction * Vector2({.x = amount, .y = amount})); } -const Vector2 &Vector2::operator+=(const Vector2 &rhs) noexcept +auto Vector2::operator+=(const Vector2 &rhs) noexcept -> const Vector2 & { _x += rhs._x; _y += rhs._y; @@ -36,7 +36,7 @@ const Vector2 &Vector2::operator+=(const Vector2 &rhs) noexcept return *this; } -const Vector2 &Vector2::operator-=(const Vector2 &rhs) noexcept +auto Vector2::operator-=(const Vector2 &rhs) noexcept -> const Vector2 & { _x -= rhs._x; _y -= rhs._y; @@ -44,7 +44,7 @@ const Vector2 &Vector2::operator-=(const Vector2 &rhs) noexcept return *this; } -Vector2 Vector2::operator+(const Vector2 &rhs) const noexcept +auto Vector2::operator+(const Vector2 &rhs) const noexcept -> Vector2 { auto new_vector2 = Vector2(*this); @@ -54,7 +54,7 @@ Vector2 Vector2::operator+(const Vector2 &rhs) const noexcept return new_vector2; } -Vector2 Vector2::operator-(const Vector2 &rhs) const noexcept +auto Vector2::operator-(const Vector2 &rhs) const noexcept -> Vector2 { auto new_vector2 = Vector2(*this); @@ -64,7 +64,7 @@ Vector2 Vector2::operator-(const Vector2 &rhs) const noexcept return new_vector2; } -Vector2 Vector2::operator*(const Vector2 &rhs) const noexcept +auto Vector2::operator*(const Vector2 &rhs) const noexcept -> Vector2 { auto new_vector2 = *this; @@ -74,12 +74,12 @@ Vector2 Vector2::operator*(const Vector2 &rhs) const noexcept return new_vector2; } -bool Vector2::operator==(const Vector2 &rhs) const noexcept +auto Vector2::operator==(const Vector2 &rhs) const noexcept -> bool { return _x == rhs._x && _y == rhs._y; } -std::size_t Vector2Hasher::operator()(const Vector2 &vector2) const noexcept +auto Vector2Hasher::operator()(const Vector2 &vector2) const noexcept -> std::size_t { std::size_t result_hash = 0; diff --git a/src/engine/data/vector2.hpp b/src/engine/data/vector2.hpp index 78eba11..95baf1c 100644 --- a/src/engine/data/vector2.hpp +++ b/src/engine/data/vector2.hpp @@ -22,30 +22,30 @@ public: { } - [[nodiscard]] Value get_x() const noexcept; + [[nodiscard]] auto get_x() const noexcept -> Value; void set_x(Value x) noexcept; - [[nodiscard]] Value get_y() const noexcept; + [[nodiscard]] auto get_y() const noexcept -> Value; void set_y(Value y) noexcept; - [[nodiscard]] Vector2 to_direction(const Vector2 &direction, - Vector2::Value amount) const noexcept; + [[nodiscard]] auto to_direction(const Vector2 &direction, + Vector2::Value amount) const noexcept -> Vector2; - const Vector2 &operator+=(const Vector2 &rhs) noexcept; - const Vector2 &operator-=(const Vector2 &rhs) noexcept; + auto operator+=(const Vector2 &rhs) noexcept -> const Vector2 &; + auto operator-=(const Vector2 &rhs) noexcept -> const Vector2 &; - Vector2 operator+(const Vector2 &rhs) const noexcept; - Vector2 operator-(const Vector2 &rhs) const noexcept; - Vector2 operator*(const Vector2 &rhs) const noexcept; + auto operator+(const Vector2 &rhs) const noexcept -> Vector2; + auto operator-(const Vector2 &rhs) const noexcept -> Vector2; + auto operator*(const Vector2 &rhs) const noexcept -> Vector2; - bool operator==(const Vector2 &rhs) const noexcept; + auto operator==(const Vector2 &rhs) const noexcept -> bool; /** * Returns Vector2({.x = 0, .y = -1}) */ - static constexpr Vector2 up() noexcept + static constexpr auto up() noexcept -> Vector2 { return Vector2({.x = 0, .y = -1}); } @@ -53,7 +53,7 @@ public: /** * Returns Vector2({.x = 0, .y = 1}) */ - static constexpr Vector2 down() noexcept + static constexpr auto down() noexcept -> Vector2 { return Vector2({.x = 0, .y = 1}); } @@ -61,7 +61,7 @@ public: /** * Returns Vector2({.x = -1, .y = 0}) */ - static constexpr Vector2 left() noexcept + static constexpr auto left() noexcept -> Vector2 { return Vector2({.x = -1, .y = 0}); @@ -70,7 +70,7 @@ public: /** * Returns Vector2({.x = 1, .y = 0}) */ - static constexpr Vector2 right() noexcept + static constexpr auto right() noexcept -> Vector2 { return Vector2({.x = 1, .y = 0}); } @@ -83,5 +83,5 @@ private: class Vector2Hasher { public: - std::size_t operator()(const Vector2 &vector2) const noexcept; + auto operator()(const Vector2 &vector2) const noexcept -> std::size_t; }; |