2021-12-21 12:07:19 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "spritecontainer.h"
|
|
|
|
#include "classicmode/classicactions.h"
|
|
|
|
#include "graphics/classicspritefactory.h"
|
2021-12-23 12:33:24 -05:00
|
|
|
#include "classicarrownote.h"
|
2021-12-21 12:07:19 -05:00
|
|
|
#include "core/timeline.h"
|
|
|
|
|
|
|
|
#include <SFML/Graphics/RenderTarget.hpp>
|
|
|
|
|
|
|
|
class ClassicSprite;
|
|
|
|
|
|
|
|
class ClassicGraphicsManager : public sf::Drawable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ClassicGraphicsManager(Timeline<ClassicNote>& timeline, const microsec& visibility_offset);
|
|
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
|
|
|
|
2021-12-23 12:33:24 -05:00
|
|
|
void draw(const std::vector<ClassicArrowNote::ArrowElement>& elements, sf::RenderTarget& target, sf::RenderStates states) const;
|
|
|
|
void setGraphics(std::vector<ClassicArrowNote::ArrowElement> &elements, TimeRange&& range);
|
|
|
|
|
2021-12-21 12:07:19 -05:00
|
|
|
void update(const microsec& offset);
|
2021-12-23 12:33:24 -05:00
|
|
|
void fetchFirstNote(const microsec& offset);
|
|
|
|
void fetchLastNote(const microsec& offset);
|
2021-12-21 12:07:19 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
using Iterator = Timeline<ClassicNote>::Iterator;
|
|
|
|
|
|
|
|
Iterator _first;
|
|
|
|
Iterator _last;
|
|
|
|
|
|
|
|
SpriteContainer<Type, ClassicSpriteFactory, ClassicSprite> _sprite_container;
|
|
|
|
Timeline<ClassicNote> * const _timeline;
|
|
|
|
|
|
|
|
microsec _visibility_offset;
|
|
|
|
|
|
|
|
inline bool nothingToDraw() const noexcept;
|
|
|
|
inline bool isVisiblyClose(const Iterator& iterator, const microsec& music_offset) const noexcept;
|
2021-12-23 12:33:24 -05:00
|
|
|
inline sf::VertexArray makeLine(const Coordinates& c1, const Coordinates& c2) const;
|
2021-12-21 12:07:19 -05:00
|
|
|
};
|