2021-09-14 21:02:23 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "core/inputtype.h"
|
|
|
|
|
|
|
|
class Note
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Note(microsec perfect_offset) :
|
|
|
|
_perfect_offset(perfect_offset) {}
|
|
|
|
virtual ~Note() = default;
|
|
|
|
|
|
|
|
virtual bool isActive() const = 0;
|
|
|
|
virtual void update(const microsec& music_offset) = 0;
|
|
|
|
virtual void draw() const = 0;
|
|
|
|
|
|
|
|
virtual void putToGame(const microsec& offset) = 0;
|
|
|
|
virtual bool isInGame() const = 0;
|
|
|
|
virtual bool shouldRemove() const = 0;
|
|
|
|
|
|
|
|
const microsec& offset() const noexcept
|
|
|
|
{
|
|
|
|
return _perfect_offset;
|
|
|
|
}
|
|
|
|
|
2021-10-03 17:23:28 +02:00
|
|
|
bool operator<(const Note& note) const
|
|
|
|
{
|
|
|
|
return (_perfect_offset < note._perfect_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const Note& note) const
|
|
|
|
{
|
|
|
|
return (_perfect_offset == note._perfect_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator>(const Note& note) const
|
|
|
|
{
|
|
|
|
return (_perfect_offset > note._perfect_offset);
|
|
|
|
}
|
|
|
|
|
2021-09-14 21:02:23 +02:00
|
|
|
protected:
|
|
|
|
microsec _perfect_offset;
|
|
|
|
};
|
2021-10-03 17:23:28 +02:00
|
|
|
|
|
|
|
struct NotePtrCompt
|
|
|
|
{
|
2021-11-02 18:03:27 +01:00
|
|
|
bool operator()(const Note* lhs, const Note* rhs) const noexcept
|
|
|
|
{
|
|
|
|
return lhs->offset() < rhs->offset();
|
|
|
|
}
|
2021-10-03 17:23:28 +02:00
|
|
|
};
|