46 lines
725 B
C
46 lines
725 B
C
|
#ifndef NOTE_H
|
||
|
#define NOTE_H
|
||
|
|
||
|
#include <SFML/System/Clock.hpp>
|
||
|
|
||
|
using microsec = sf::Int64;
|
||
|
|
||
|
struct NoteGrade
|
||
|
{
|
||
|
int score = 0;
|
||
|
enum class Rating
|
||
|
{
|
||
|
WRONG,
|
||
|
BAD,
|
||
|
GOOD,
|
||
|
GREAT
|
||
|
} rating = Rating::BAD;
|
||
|
};
|
||
|
|
||
|
class Note
|
||
|
{
|
||
|
public:
|
||
|
enum class Arrow
|
||
|
{
|
||
|
UP,
|
||
|
RIGHT,
|
||
|
DOWN,
|
||
|
LEFT
|
||
|
};
|
||
|
|
||
|
Note(microsec offset, microsec death_offset, Note::Arrow type = Note::Arrow::UP);
|
||
|
|
||
|
NoteGrade onTap(Arrow arrow_type, microsec tap_time_stamp) const;
|
||
|
microsec deathOffset() const noexcept;
|
||
|
|
||
|
|
||
|
private:
|
||
|
microsec _offset;
|
||
|
microsec _death_offset;
|
||
|
Arrow _type = Arrow::UP;
|
||
|
|
||
|
NoteGrade calculatePrecision(microsec odds) const;
|
||
|
};
|
||
|
|
||
|
#endif // NOTE_H
|