#pragma once #include #include #include "timeline.h" #include class ClassicNote; class ClassicViewManager; class ClassicTimeline : public Timeline { public: explicit ClassicTimeline(); virtual ~ClassicTimeline(); virtual void update() override; virtual void init() override; virtual void clear() override; virtual microsec currentMusicOffset() const override; virtual void drawVisibleNotes(sf::RenderWindow& window) const override; void fetchVisibleNotes(const std::unique_ptr& view_manager); using Iterator = std::vector::const_iterator; Iterator getActiveNote() noexcept; bool isExpired(const Iterator& iterator) const; void expire(Iterator& iterator); private: std::vector _timeline; Iterator _top_note; Iterator _active_note; Iterator _last_visible_note; microsec _visibility_offset; sf::Music _music; void checkCurrentActiveNote(const microsec &music_offset); void checkForNextActiveNote(const microsec &music_offset); void discardExpiredNotes(const std::unique_ptr& view_manager, const microsec &music_offset); bool isVisiblyClose(const Iterator& iterator, const microsec& music_offset) const; /* 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. * */ };