#pragma once #include #include struct Vector2Options { int32_t x; int32_t y; }; /** * A 2D Vector. */ class Vector2 { public: explicit Vector2(const Vector2Options &options); [[nodiscard]] int32_t get_x() const noexcept; void set_x(int32_t x) noexcept; [[nodiscard]] int32_t get_y() const noexcept; void set_y(int32_t y) noexcept; const Vector2 &operator+=(const Vector2 &vector2) noexcept; const Vector2 &operator-=(const Vector2 &vector2) noexcept; bool operator==(const Vector2 &vector2) const noexcept; /** * Returns Vector2({.x = 0, .y = 1}) */ static Vector2 up(); /** * Returns Vector2({.x = 0, .y = -1}) */ static Vector2 down(); /** * Returns Vector2({.x = -1, .y = 0}) */ static Vector2 left(); /** * Returns Vector2({.x = 1, .y = 0}) */ static Vector2 right(); private: int32_t _x; int32_t _y; }; class Vector2Hasher { public: std::size_t operator()(const Vector2 &vector2) const; };