diff options
Diffstat (limited to 'src/engine/vector2.hpp')
-rw-r--r-- | src/engine/vector2.hpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/engine/vector2.hpp b/src/engine/vector2.hpp index 3dc1db1..8423431 100644 --- a/src/engine/vector2.hpp +++ b/src/engine/vector2.hpp @@ -2,6 +2,12 @@ #include <memory> +struct Vector2Opts +{ + unsigned int x; + unsigned int y; +}; + /** * A 2D Vector. */ @@ -10,16 +16,13 @@ class Vector2 public: /** * Creates a 2D vector. - * - * @param x A X coordinate - * @param y A Y coordinate */ - Vector2(unsigned int x, unsigned int y); + explicit Vector2(Vector2Opts opts); /** * Returns the X coordinate. */ - unsigned int x() const; + [[nodiscard]] unsigned int x() const; /** * Sets the X coordinate. @@ -31,7 +34,7 @@ public: /** * Returns the Y coordinate. */ - unsigned int y() const; + [[nodiscard]] unsigned int y() const; /** * Sets the Y coordinate. @@ -47,8 +50,9 @@ public: */ std::shared_ptr<Vector2> copy(); - Vector2 operator+(const Vector2 vector2); - Vector2 operator-(const Vector2 vector2); + Vector2 operator*(const Vector2 &vector2) const; + Vector2 operator+(const Vector2 &vector2) const; + Vector2 operator-(const Vector2 &vector2) const; Vector2 &operator+=(const Vector2 &vector2); Vector2 &operator-=(const Vector2 &vector2); |