forked from NaiJi/project-kyoku
Fix animation objects and note state machine
parent
06d099c11f
commit
77a9d15caa
@ -0,0 +1,38 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <SFML/System/Clock.hpp>
|
||||||
|
|
||||||
|
using microsec = sf::Int64;
|
||||||
|
|
||||||
|
struct Coordinates
|
||||||
|
{
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue