Add multiply and divide to coordinate components

This commit is contained in:
Matt 2021-02-09 14:25:46 +02:00
parent e7adf19f62
commit a2ebec8676
No known key found for this signature in database
GPG Key ID: 6D4C24A61C93E208
1 changed files with 24 additions and 0 deletions

View File

@ -139,6 +139,20 @@ struct CoordsXY
return *this;
}
constexpr CoordsXY& operator*=(const int32_t rhs)
{
x *= rhs;
y *= rhs;
return *this;
}
constexpr CoordsXY& operator/=(const int32_t rhs)
{
x /= rhs;
y /= rhs;
return *this;
}
constexpr bool operator>=(const CoordsXY& rhs) const
{
return x >= rhs.x && y >= rhs.y;
@ -159,6 +173,16 @@ struct CoordsXY
return { x - rhs.x, y - rhs.y };
}
constexpr const CoordsXY operator*(const int32_t rhs) const
{
return { x * rhs, y * rhs };
}
constexpr const CoordsXY operator/(const int32_t rhs) const
{
return { x / rhs, y / rhs };
}
constexpr CoordsXY Rotate(int32_t direction) const
{
CoordsXY rotatedCoords;