diff options
Diffstat (limited to 'src/engine/data/vector2.hpp')
-rw-r--r-- | src/engine/data/vector2.hpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/engine/data/vector2.hpp b/src/engine/data/vector2.hpp index e835e65..868394a 100644 --- a/src/engine/data/vector2.hpp +++ b/src/engine/data/vector2.hpp @@ -17,7 +17,10 @@ class Vector2 public: using Value = int32_t; - explicit Vector2(const Vector2Options &options); + constexpr explicit Vector2(const Vector2Options &options) noexcept + : _x(options.x), _y(options.y) + { + } [[nodiscard]] Value get_x() const noexcept; @@ -41,22 +44,35 @@ public: /** * Returns Vector2({.x = 0, .y = -1}) */ - static Vector2 up() noexcept; + static constexpr Vector2 up() noexcept + { + return Vector2({.x = 0, .y = -1}); + } /** * Returns Vector2({.x = 0, .y = 1}) */ - static Vector2 down() noexcept; + static constexpr Vector2 down() noexcept + { + return Vector2({.x = 0, .y = 1}); + } /** * Returns Vector2({.x = -1, .y = 0}) */ - static Vector2 left() noexcept; + static constexpr Vector2 left() noexcept + { + + return Vector2({.x = -1, .y = 0}); + } /** * Returns Vector2({.x = 1, .y = 0}) */ - static Vector2 right() noexcept; + static constexpr Vector2 right() noexcept + { + return Vector2({.x = 1, .y = 0}); + } private: Value _x; |