diff options
Diffstat (limited to 'src/engine/data/vector2.hpp')
-rw-r--r-- | src/engine/data/vector2.hpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/engine/data/vector2.hpp b/src/engine/data/vector2.hpp index dff548c..49e5d85 100644 --- a/src/engine/data/vector2.hpp +++ b/src/engine/data/vector2.hpp @@ -15,15 +15,17 @@ struct Vector2Options class Vector2 { public: + using Value = int32_t; + explicit Vector2(const Vector2Options &options); - [[nodiscard]] int32_t get_x() const noexcept; + [[nodiscard]] Value get_x() const noexcept; - void set_x(int32_t x) noexcept; + void set_x(Value x) noexcept; - [[nodiscard]] int32_t get_y() const noexcept; + [[nodiscard]] Value get_y() const noexcept; - void set_y(int32_t y) noexcept; + void set_y(Value y) noexcept; const Vector2 &operator+=(const Vector2 &vector2) noexcept; const Vector2 &operator-=(const Vector2 &vector2) noexcept; @@ -33,30 +35,30 @@ public: /** * Returns Vector2({.x = 0, .y = 1}) */ - static Vector2 up(); + static Vector2 up() noexcept; /** * Returns Vector2({.x = 0, .y = -1}) */ - static Vector2 down(); + static Vector2 down() noexcept; /** * Returns Vector2({.x = -1, .y = 0}) */ - static Vector2 left(); + static Vector2 left() noexcept; /** * Returns Vector2({.x = 1, .y = 0}) */ - static Vector2 right(); + static Vector2 right() noexcept; private: - int32_t _x; - int32_t _y; + Value _x; + Value _y; }; class Vector2Hasher { public: - std::size_t operator()(const Vector2 &vector2) const; + std::size_t operator()(const Vector2 &vector2) const noexcept; }; |