2021-04-08 15:34:03 +02:00
|
|
|
#ifndef TIMELINE_H
|
|
|
|
#define TIMELINE_H
|
|
|
|
|
|
|
|
#include <SFML/Config.hpp>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
using microsec = sf::Int64;
|
|
|
|
class Note;
|
|
|
|
|
|
|
|
class Timeline
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Timeline();
|
|
|
|
~Timeline();
|
|
|
|
|
|
|
|
void update(const microsec& microseconds);
|
2021-04-08 18:08:01 +02:00
|
|
|
const Note* fetchActiveNote(const microsec µseconds) noexcept;
|
2021-04-08 15:34:03 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<Note*> _timeline;
|
|
|
|
std::vector<Note*>::iterator _top_note;
|
|
|
|
Note* _active_note;
|
|
|
|
|
|
|
|
void checkCurrentActiveNote(const microsec µseconds);
|
|
|
|
void checkForNextActiveNote(const microsec µseconds);
|
|
|
|
|
|
|
|
/* Difference between top and active note is that
|
|
|
|
* top note is the note handling input right now
|
|
|
|
* OR it's the closest note from current music offset
|
|
|
|
* position, not necessarily active. A note stops being top only
|
|
|
|
* after dying or being tapped by player, even if it's already
|
|
|
|
* past her perfect offset.
|
|
|
|
*
|
|
|
|
* Meanwhile active note is the note which is currently handling
|
|
|
|
* player input for grade.
|
|
|
|
*
|
|
|
|
* An active note is always top note but a top note
|
|
|
|
* is not always active note.
|
|
|
|
* */
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TIMELINE_H
|