24 constexpr
Vector2(
float _x,
float _y) noexcept :
x(_x),
y(_y) {}
33 x += rhs.
x;
y += rhs.y;
return *
this;
41 x -= rhs.
x;
y -= rhs.y;
return *
this;
49 x *= rhs.
x;
y *= rhs.y;
return *
this;
57 x /= rhs.
x;
y /= rhs.y;
return *
this;
94#define CANGINE_VECTOR2_OP(OP) \
95constexpr Vector2 operator OP(const Vector2& lhs, const Vector2& rhs) noexcept { return Vector2(lhs.x OP rhs.x, lhs.y OP rhs.y); } \
96constexpr Vector2 operator OP(const Vector2& lhs, float rhs) noexcept { return Vector2(lhs.x OP rhs, lhs.y OP rhs); } \
97constexpr Vector2 operator OP(float lhs, const Vector2& rhs) noexcept { return Vector2(lhs OP rhs.x, lhs OP rhs.y); }
104#undef CANGINE_VECTOR2_OP
Definition audiomanager.cpp:4
Two-component floating-point vector.
Definition vector2.hpp:13
constexpr Vector2 & operator+=(const Vector2 &rhs) noexcept
Adds another vector component-wise.
Definition vector2.hpp:32
constexpr Vector2 & operator-=(const Vector2 &rhs) noexcept
Subtracts another vector component-wise.
Definition vector2.hpp:40
float x
Definition vector2.hpp:14
constexpr Vector2 & operator*=(float rhs) noexcept
Multiplies both components by a scalar.
Definition vector2.hpp:77
constexpr Vector2 & operator-=(float rhs) noexcept
Subtracts a scalar from both components.
Definition vector2.hpp:71
constexpr Vector2 & operator/=(const Vector2 &rhs) noexcept
Divides by another vector component-wise.
Definition vector2.hpp:56
float y
Vector components.
Definition vector2.hpp:14
constexpr Vector2 & operator*=(const Vector2 &rhs) noexcept
Multiplies by another vector component-wise.
Definition vector2.hpp:48
constexpr Vector2 & operator/=(float rhs) noexcept
Divides both components by a scalar.
Definition vector2.hpp:83
constexpr Vector2 & operator+=(float rhs) noexcept
Adds a scalar to both components.
Definition vector2.hpp:65
constexpr Vector2() noexcept=default
Constructs a zero vector (x = y = 0).
#define CANGINE_VECTOR2_OP(OP)
Defines the free binary operator OP for Vector2.
Definition vector2.hpp:94