45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
|
#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);
|
||
|
const Note* getActiveNote() const noexcept;
|
||
|
|
||
|
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
|