64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
#pragma once
|
|
|
|
using microsec = long long;
|
|
|
|
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)
|
|
{}
|
|
};
|
|
|
|
struct Coordinates
|
|
{
|
|
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)
|
|
{}
|
|
|
|
constexpr inline Coordinates operator+(const Coordinates& right) const noexcept
|
|
{
|
|
return Coordinates{right.x + x, right.y + y};
|
|
}
|
|
|
|
constexpr inline Coordinates operator-(const Coordinates& right) const noexcept
|
|
{
|
|
return Coordinates{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;
|
|
}
|
|
};
|