project-kyoku/timeline.h

45 lines
1.1 KiB
C
Raw Normal View History

#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 &microseconds);
void checkForNextActiveNote(const microsec &microseconds);
/* 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