#include "vector2.hpp" #include Vector2::Vector2(Vector2Opts opts) : _x(opts.x), _y(opts.y) {} unsigned int Vector2::x() const { return _x; } void Vector2::x(unsigned int x) { _x = x; } unsigned int Vector2::y() const { return _y; } void Vector2::y(unsigned int y) { _y = y; } Vector2 Vector2::operator*(const Vector2 &vector2) const { return Vector2({.x = _x * vector2.x(), .y = _y * vector2.y()}); } Vector2 Vector2::operator+(const Vector2 &vector2) const { return Vector2({.x = _x + vector2.x(), .y = _y + vector2.y()}); } Vector2 Vector2::operator-(const Vector2 &vector2) const { return Vector2({.x = _x - vector2.x(), .y = _y - vector2.y()}); } Vector2 &Vector2::operator+=(const Vector2 &vector2) { _x += vector2.x(); _y += vector2.y(); return *this; } Vector2 &Vector2::operator-=(const Vector2 &vector2) { _x -= vector2.x(); _y -= vector2.y(); return *this; }