2021-06-07 20:19:58 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "note.h"
|
|
|
|
#include "precisionevaluator.h"
|
2021-06-24 00:43:13 +02:00
|
|
|
#include "classicactions.h"
|
2021-06-07 20:19:58 +02:00
|
|
|
|
2021-06-09 20:08:58 +02:00
|
|
|
#include <memory>
|
2021-06-21 21:10:50 +02:00
|
|
|
#include <array>
|
2021-06-09 20:08:58 +02:00
|
|
|
|
|
|
|
class ClassicSprite;
|
2021-06-24 00:43:13 +02:00
|
|
|
class ClassicGraphicsManager;
|
|
|
|
class ClassicAnimationScenario;
|
2021-06-09 20:08:58 +02:00
|
|
|
|
2021-06-07 20:19:58 +02:00
|
|
|
class ClassicNote : public Note
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2021-06-11 18:58:44 +02:00
|
|
|
enum class Grade
|
2021-06-07 20:19:58 +02:00
|
|
|
{
|
|
|
|
PERFECT,
|
|
|
|
GOOD,
|
|
|
|
BAD
|
|
|
|
};
|
|
|
|
|
2021-06-24 00:43:13 +02:00
|
|
|
enum State
|
|
|
|
{
|
|
|
|
NONE,
|
|
|
|
|
|
|
|
FLYING,
|
2021-06-24 20:04:09 +02:00
|
|
|
ACTIVE,
|
|
|
|
DYING,
|
|
|
|
DEAD
|
2021-06-24 00:43:13 +02:00
|
|
|
};
|
|
|
|
|
2021-06-09 20:08:58 +02:00
|
|
|
explicit ClassicNote(const std::vector<microsec>& intervals, microsec perfect_offset,
|
2021-06-23 21:18:33 +02:00
|
|
|
Type type, const Coordinates& coord,
|
|
|
|
const std::unique_ptr<ClassicGraphicsManager>& manager);
|
2021-06-07 20:19:58 +02:00
|
|
|
virtual ~ClassicNote() = default;
|
2021-06-09 20:08:58 +02:00
|
|
|
|
2021-06-24 20:04:09 +02:00
|
|
|
virtual bool isActive() const override;
|
2021-06-11 18:58:44 +02:00
|
|
|
virtual void update(const microsec &music_offset) override;
|
2021-06-23 21:18:33 +02:00
|
|
|
virtual void input(PlayerInput&& inputdata) override;
|
2021-06-22 20:20:08 +02:00
|
|
|
virtual void putToGame(const microsec &music_offset) override;
|
2021-06-24 20:04:09 +02:00
|
|
|
virtual bool isInGame() const override;
|
2021-06-21 21:10:50 +02:00
|
|
|
virtual bool isExpired() const override;
|
2021-06-23 21:18:33 +02:00
|
|
|
virtual void draw() const override;
|
2021-06-21 21:10:50 +02:00
|
|
|
|
2021-06-23 21:18:33 +02:00
|
|
|
Type type() const noexcept;
|
2021-06-09 20:08:58 +02:00
|
|
|
|
|
|
|
std::shared_ptr<ClassicSprite> sprite() const noexcept;
|
|
|
|
void setSprite(const std::shared_ptr<ClassicSprite>& sprite) noexcept;
|
2021-06-11 18:58:44 +02:00
|
|
|
const Coordinates& getCoordinates() const noexcept;
|
2021-06-07 20:19:58 +02:00
|
|
|
|
|
|
|
private:
|
2021-06-09 20:08:58 +02:00
|
|
|
|
2021-07-14 17:24:47 +02:00
|
|
|
struct NoteElement
|
|
|
|
{
|
|
|
|
std::shared_ptr<ClassicSprite> _sprite;
|
|
|
|
std::array<std::shared_ptr<ClassicAnimationScenario>, 5> _animations;
|
2021-06-21 21:10:50 +02:00
|
|
|
|
2021-07-14 17:24:47 +02:00
|
|
|
const std::array<const sf::Keyboard::Key, 2> _keys;
|
|
|
|
const Coordinates _coordinates;
|
|
|
|
const Type _type;
|
|
|
|
|
|
|
|
bool pressed = false;
|
|
|
|
sf::Keyboard::Key pressed_as;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<NoteElement> _elements;
|
|
|
|
|
|
|
|
const PrecisionEvaluator<Grade> _evaluator;
|
|
|
|
const std::unique_ptr<ClassicGraphicsManager>& _graphics_manager;
|
2021-06-24 00:43:13 +02:00
|
|
|
|
|
|
|
State _state;
|
2021-06-07 20:19:58 +02:00
|
|
|
};
|