project-kyoku/src/modes/classicmode/graphics/classicscenegraphicsmanager.h

47 lines
1.8 KiB
C
Raw Normal View History

2021-12-29 15:59:18 +01:00
#pragma once
2022-02-10 00:30:49 +01:00
#include "classicmode/classicnote.h"
2021-12-29 15:59:18 +01:00
#include "graphics/classicgraphicsmanager.h"
2022-02-06 02:33:09 +01:00
#include "graphics/classicgraphicsfactory.h"
2021-12-29 15:59:18 +01:00
#include "core/timeline.h"
#include "core/spritecontainer.h"
2021-12-29 15:59:18 +01:00
class ClassicSprite;
class ClassicSceneGraphicsManager : public ClassicGraphicsManager
{
public:
explicit ClassicSceneGraphicsManager(const std::shared_ptr<kku::Timeline<ClassicNote>>& timeline,
2022-02-06 02:33:09 +01:00
const std::shared_ptr<ClassicGraphicsFactory>& factory,
2021-12-29 15:59:18 +01:00
const kku::microsec& visibility_offset);
2022-02-06 02:33:09 +01:00
virtual void input(kku::GameEvent&& input) override;
2021-12-29 15:59:18 +01:00
virtual void display() const override;
virtual void update(const kku::microsec& offset) override;
virtual void display(const std::vector<ArrowElement>& elements) const override;
virtual void setGraphics(std::vector<ArrowElement>& elements, kku::TimeRange&& range) override;
2022-02-06 02:33:09 +01:00
virtual void display(const std::vector<MockElement>& elements) const override;
virtual void setGraphics(std::vector<MockElement>& elements, kku::TimeRange&& range) override;
2021-12-29 15:59:18 +01:00
protected:
2022-02-06 02:33:09 +01:00
kku::SpriteContainer<Type, ClassicGraphicsFactory, ClassicSprite> _sprite_container;
const std::shared_ptr<const ClassicGraphicsFactory> _factory;
2021-12-29 15:59:18 +01:00
using Iterator = kku::Timeline<ClassicNote>::Iterator;
Iterator _first;
Iterator _last;
const std::shared_ptr<kku::Timeline<ClassicNote>> _timeline;
inline bool nothingToDraw() const noexcept;
inline bool isVisiblyClose(const Iterator& iterator, const kku::microsec& music_offset) const noexcept;
//inline sf::VertexArray makeLine(const kku::Point& c1, const kku::Point& c2) const;
void fetchFirstNote(const kku::microsec& offset);
void fetchLastNote(const kku::microsec& offset);
void updateVisibleNotes(const kku::microsec& offset);
};