forked from NaiJi/project-kyoku
Add abstraction for timeline views
parent
dd3a175b55
commit
ecd0e67ed1
@ -0,0 +1,6 @@
|
|||||||
|
#include "timelineviewmanager.h"
|
||||||
|
|
||||||
|
TimelineViewManager::TimelineViewManager()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef TIMELINEVIEWMANAGER_H
|
||||||
|
#define TIMELINEVIEWMANAGER_H
|
||||||
|
|
||||||
|
|
||||||
|
class TimelineViewManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TimelineViewManager();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TIMELINEVIEWMANAGER_H
|
@ -0,0 +1,28 @@
|
|||||||
|
#include "classicviewmanager.h"
|
||||||
|
#include "../note.h"
|
||||||
|
#include <SFML/Graphics/RectangleShape.hpp>
|
||||||
|
|
||||||
|
static constexpr std::size_t RESERVED_SIZE = 20;
|
||||||
|
|
||||||
|
ClassicViewManager::ClassicViewManager()
|
||||||
|
{
|
||||||
|
for (std::size_t i = ARROW_UP; i < AMOUNT_OF_KINDS; ++i)
|
||||||
|
{
|
||||||
|
SpritePoll &poll = _sprite_dispatcher.at(i);
|
||||||
|
poll.reserve(RESERVED_SIZE);
|
||||||
|
for (auto &sprite : poll)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Sprite> ClassicViewManager::createSprite(Button kind_of_button) const
|
||||||
|
{
|
||||||
|
auto sprite = std::make_shared<sf::RectangleShape>();
|
||||||
|
sprite->setSize({20.f, 20.f});
|
||||||
|
switch (kind_of_button)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
#ifndef CLASSICDIVAVIEWMANAGER_H
|
||||||
|
#define CLASSICDIVAVIEWMANAGER_H
|
||||||
|
|
||||||
|
#include "timelineviewmanager.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
class Sprite;
|
||||||
|
|
||||||
|
class ClassicViewManager : public TimelineViewManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ClassicViewManager();
|
||||||
|
virtual ~ClassicViewManager() override;
|
||||||
|
|
||||||
|
virtual void update() override;
|
||||||
|
virtual void draw() override;
|
||||||
|
virtual void initNoteGraphics(Note *note) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
enum Button
|
||||||
|
{
|
||||||
|
ARROW_UP,
|
||||||
|
ARROW_DOWN,
|
||||||
|
ARROW_LEFT,
|
||||||
|
ARROW_RIGHT,
|
||||||
|
|
||||||
|
SHOULDER_RIGHT,
|
||||||
|
SHOULDER_LEFT,
|
||||||
|
|
||||||
|
AMOUNT_OF_KINDS
|
||||||
|
};
|
||||||
|
|
||||||
|
using SpritePoll = std::vector<std::shared_ptr<Sprite>>;
|
||||||
|
using SpriteDispatcher = std::array<SpritePoll, AMOUNT_OF_KINDS>;
|
||||||
|
SpriteDispatcher _sprite_dispatcher;
|
||||||
|
|
||||||
|
std::shared_ptr<Sprite> createSprite(Button kind_of_button) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CLASSICDIVAVIEWMANAGER_H
|
@ -0,0 +1,7 @@
|
|||||||
|
#include "timelineviewmanager.h"
|
||||||
|
|
||||||
|
TimelineViewManager::TimelineViewManager()
|
||||||
|
{}
|
||||||
|
|
||||||
|
TimelineViewManager::~TimelineViewManager()
|
||||||
|
{}
|
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef TIMELINEVIEWMANAGER_H
|
||||||
|
#define TIMELINEVIEWMANAGER_H
|
||||||
|
|
||||||
|
class Note;
|
||||||
|
|
||||||
|
class TimelineViewManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit TimelineViewManager();
|
||||||
|
virtual ~TimelineViewManager();
|
||||||
|
|
||||||
|
virtual void update() = 0;
|
||||||
|
virtual void draw() = 0;
|
||||||
|
virtual void initNoteGraphics(Note *note) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TIMELINEVIEWMANAGER_H
|
Loading…
Reference in New Issue