project-kyoku/note.h

48 lines
777 B
C
Raw Normal View History

2021-04-04 22:43:12 +02:00
#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,
2021-04-05 16:17:57 +02:00
LEFT,
NONE
2021-04-04 22:43:12 +02:00
};
Note(microsec offset, microsec death_offset, Note::Arrow type = Note::Arrow::UP);
NoteGrade onTap(Arrow arrow_type, microsec tap_time_stamp) const;
2021-04-05 16:17:57 +02:00
microsec offset() const noexcept;
2021-04-04 22:43:12 +02:00
microsec deathOffset() const noexcept;
private:
microsec _offset;
microsec _death_offset;
Arrow _type = Arrow::UP;
NoteGrade calculatePrecision(microsec odds) const;
};
#endif // NOTE_H