forked from NaiJi/project-kyoku
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
717 B
C++
38 lines
717 B
C++
#pragma once
|
|
|
|
using microsec = long long;
|
|
|
|
struct Coordinates
|
|
{
|
|
float x = 0.;
|
|
float y = 0.;
|
|
|
|
constexpr inline Coordinates operator+(const Coordinates& right) const noexcept
|
|
{
|
|
return {right.x + x, right.y + y};
|
|
}
|
|
|
|
constexpr inline Coordinates operator-(const Coordinates& right) const noexcept
|
|
{
|
|
return {right.x - x, right.y - y};
|
|
}
|
|
|
|
inline void moveBy(float x, float y) noexcept
|
|
{
|
|
this->x += x;
|
|
this->y += y;
|
|
}
|
|
|
|
inline void moveBy(const Coordinates& right) noexcept
|
|
{
|
|
this->x += right.x;
|
|
this->y += right.y;
|
|
}
|
|
|
|
inline void scale(float factor) noexcept
|
|
{
|
|
x *= factor;
|
|
y *= factor;
|
|
}
|
|
};
|