#pragma once #include namespace math { class Vector { public: Vector() : x{0.0f}, y{0.0f} { } Vector(float x, float y) : x{x}, y{y} { } Vector(int x, int y) : x{static_cast(x)}, y{static_cast(y)} { } // float& operator[](size_t idx) { return m_v[idx]; } // const float& operator[](size_t idx) const { return m_v[idx]; } Vector operator+(const Vector& other) const { return Vector(x + other.x, y + other.y); } Vector& operator+=(const Vector& other) { x += other.x; y += other.y; return *this; } Vector operator-(const Vector& other) const { return Vector(x - other.x, y - other.y); } Vector& operator-=(const Vector& other) { x -= other.x; y -= other.y; return *this; } Vector operator*(float factor) const { return Vector(x * factor, y * factor); } Vector& operator*=(float factor) { x *= factor; y *= factor; return *this; } public: float x, y; }; } // namespace math