project-kyoku/src/classicgame/classicnote.h

57 lines
1.3 KiB
C++

#pragma once
#include "classicactions.h"
#include "game/precisionevaluator.h"
#include "SFML/Window/Keyboard.hpp"
#include <memory>
#include <vector>
#include <array>
enum class ClassicGrade
{
PERFECT,
GOOD,
BAD
};
enum ClassicNoteState
{
NONE,
FLYING,
ACTIVE,
DYING,
DEAD
};
class ClassicSprite;
class ClassicAnimationScenario;
struct ClassicNote
{
PrecisionEvaluator<ClassicGrade> evaluator;
std::vector<microsec> intervals;
bool hold = false;
ClassicNoteState state = ClassicNoteState::NONE;
struct Element
{
Coordinates coordinates; // Each note may consist of several buttons.
// For example, ↑ → or ↓ → ←
// Note Element represents this idea.
bool pressed = false; // Each ending button in such sequence
sf::Keyboard::Key pressed_as; // is an element.
Type type = Type::NONE;
std::vector<Coordinates> falling_curve_interpolation;
std::array<sf::Keyboard::Key, 2> available_keys;
std::shared_ptr<ClassicSprite> sprite;
std::array<std::shared_ptr<ClassicAnimationScenario>, 5> animations;
};
std::vector<Element> elements;
};