project-kyoku/src/classicgame/classicnote.h

57 lines
1.3 KiB
C
Raw Normal View History

2021-06-07 20:19:58 +02:00
#pragma once
2021-06-24 00:43:13 +02:00
#include "classicactions.h"
#include "game/precisionevaluator.h"
#include "SFML/Window/Keyboard.hpp"
2021-06-07 20:19:58 +02:00
#include <memory>
#include <vector>
#include <array>
enum class ClassicGrade
2021-06-07 20:19:58 +02:00
{
PERFECT,
GOOD,
BAD
};
2021-07-15 04:45:52 +02:00
enum ClassicNoteState
{
NONE,
2021-07-15 04:45:52 +02:00
FLYING,
ACTIVE,
DYING,
DEAD
};
class ClassicSprite;
class ClassicAnimationScenario;
struct ClassicNote
{
PrecisionEvaluator<ClassicGrade> evaluator;
std::vector<microsec> intervals;
bool hold = false;
2021-07-21 20:15:56 +02:00
ClassicNoteState state = ClassicNoteState::NONE;
struct Element
2021-07-14 17:24:47 +02:00
{
2021-07-19 19:59:23 +02:00
Coordinates coordinates; // Each note may consist of several buttons.
// For example, ↑ → or ↓ → ←
2021-07-19 19:59:23 +02:00
// Note Element represents this idea.
bool pressed = false; // Each ending button in such sequence
sf::Keyboard::Key pressed_as; // is an element.
2021-07-14 17:24:47 +02:00
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;
};
2021-06-24 00:43:13 +02:00
std::vector<Element> elements;
2021-06-07 20:19:58 +02:00
};