48 lines
777 B
C++
48 lines
777 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,
|
|
|
|
NONE
|
|
};
|
|
|
|
Note(microsec offset, microsec death_offset, Note::Arrow type = Note::Arrow::UP);
|
|
|
|
NoteGrade onTap(Arrow arrow_type, microsec tap_time_stamp) const;
|
|
microsec offset() const noexcept;
|
|
microsec deathOffset() const noexcept;
|
|
|
|
private:
|
|
microsec _offset;
|
|
microsec _death_offset;
|
|
Arrow _type = Arrow::UP;
|
|
|
|
NoteGrade calculatePrecision(microsec odds) const;
|
|
};
|
|
|
|
#endif // NOTE_H
|