2021-12-29 09:59:18 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace kku
|
|
|
|
{
|
|
|
|
|
|
|
|
struct Point
|
|
|
|
{
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
|
2022-10-17 22:59:51 -04:00
|
|
|
constexpr inline explicit Point() noexcept : x(0.), y(0.) {}
|
2021-12-29 09:59:18 -05:00
|
|
|
|
2022-10-17 22:59:51 -04:00
|
|
|
constexpr inline explicit Point(int x, int y) noexcept : x(x), y(y) {}
|
2021-12-29 09:59:18 -05:00
|
|
|
|
2022-10-17 22:59:51 -04:00
|
|
|
constexpr inline explicit Point(float x, float y) noexcept : x(x), y(y) {}
|
2021-12-29 09:59:18 -05:00
|
|
|
|
2022-10-17 22:59:51 -04:00
|
|
|
constexpr inline Point operator+(const Point &right) const noexcept
|
2021-12-29 09:59:18 -05:00
|
|
|
{
|
|
|
|
return Point{right.x + x, right.y + y};
|
|
|
|
}
|
|
|
|
|
2022-10-17 22:59:51 -04:00
|
|
|
constexpr inline Point operator-(const Point &right) const noexcept
|
2021-12-29 09:59:18 -05:00
|
|
|
{
|
|
|
|
return Point{right.x - x, right.y - y};
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void moveBy(float x, float y) noexcept
|
|
|
|
{
|
|
|
|
this->x += x;
|
|
|
|
this->y += y;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void scaleBy(float factor) noexcept
|
|
|
|
{
|
|
|
|
x *= factor;
|
|
|
|
y *= factor;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-10-17 22:59:51 -04:00
|
|
|
} // namespace kku
|