project-kyoku/src/modes/classicmode/game/classicarrownote.h

53 lines
1.3 KiB
C
Raw Normal View History

2021-09-27 23:48:06 -04:00
#pragma once
#include "core/precisionevaluator.h"
2022-02-09 18:30:49 -05:00
#include "classicmode/classicnote.h"
#include "game/arrowelement.h"
2022-02-09 18:30:49 -05:00
#include <algorithm>
2021-09-27 23:48:06 -04:00
class Context;
2021-09-27 23:48:06 -04:00
class ClassicArrowNote : public ClassicNote
{
public:
struct Init
{
2022-05-25 22:13:13 -04:00
const int id = 0;
2022-05-17 00:22:18 -04:00
const std::shared_ptr<const Context> context;
const kku::microsec perfect_offset = 0;
const std::vector<kku::microsec>& intervals = {};
const std::vector<ArrowElement>& elements = {};
2022-05-17 00:22:18 -04:00
const bool is_holding = false;
};
2022-02-05 20:33:09 -05:00
enum class Grade
{
PERFECT = 0,
GOOD = 1,
BAD = 2
2022-02-05 20:33:09 -05:00
};
explicit ClassicArrowNote(Init&& init);
virtual bool isActive(const kku::microsec& offset) const override;
virtual void update(const kku::microsec &music_offset) override;
virtual void input(kku::GameEvent&& input) override;
2022-05-17 19:47:47 -04:00
virtual void draw(const std::shared_ptr<const ClassicGraphicsManager> &graphics_manager) const override;
bool isHold() const;
std::vector<ArrowElement>& getElements();
Grade calculatePrecision(const kku::microsec& offset) const;
2022-05-17 00:22:18 -04:00
bool isPressedAs(kku::SystemEvent::Key::Code key) const;
2022-02-23 17:45:43 -05:00
private:
2022-02-05 20:33:09 -05:00
const kku::PrecisionEvaluator<Grade> _evaluator;
std::vector<ArrowElement> _elements;
2022-05-17 00:22:18 -04:00
const std::shared_ptr<const Context> _context;
bool _is_holding;
2021-09-27 23:48:06 -04:00
};