2021-06-24 14:04:09 -04:00
|
|
|
#pragma once
|
2021-08-11 15:00:28 -04:00
|
|
|
|
2021-09-14 15:02:23 -04:00
|
|
|
using microsec = long long;
|
2021-06-24 14:04:09 -04:00
|
|
|
|
2021-12-23 12:33:24 -05:00
|
|
|
struct TimeRange
|
|
|
|
{
|
|
|
|
const microsec begin = 0;
|
|
|
|
const microsec end = 0;
|
|
|
|
|
|
|
|
constexpr inline explicit TimeRange() noexcept :
|
|
|
|
begin(0), end(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
constexpr inline explicit TimeRange(microsec x, microsec y) noexcept :
|
|
|
|
begin(x), end(y)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2021-06-24 14:04:09 -04:00
|
|
|
struct Coordinates
|
|
|
|
{
|
2021-11-24 13:21:30 -05:00
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
|
|
|
|
constexpr inline explicit Coordinates() noexcept :
|
|
|
|
x(0.), y(0.)
|
|
|
|
{}
|
|
|
|
|
|
|
|
constexpr inline explicit Coordinates(int x, int y) noexcept :
|
|
|
|
x(x), y(y)
|
|
|
|
{}
|
|
|
|
|
|
|
|
constexpr inline explicit Coordinates(float x, float y) noexcept :
|
|
|
|
x(x), y(y)
|
|
|
|
{}
|
2021-06-24 14:04:09 -04:00
|
|
|
|
|
|
|
constexpr inline Coordinates operator+(const Coordinates& right) const noexcept
|
|
|
|
{
|
2021-11-24 13:21:30 -05:00
|
|
|
return Coordinates{right.x + x, right.y + y};
|
2021-06-24 14:04:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
constexpr inline Coordinates operator-(const Coordinates& right) const noexcept
|
|
|
|
{
|
2021-11-24 13:21:30 -05:00
|
|
|
return Coordinates{right.x - x, right.y - y};
|
2021-06-24 14:04:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|