You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.2 KiB
C

#pragma once
2 years ago
#include "core/time.h"
#include "core/gameevent.h"
namespace kku
{
class Note
{
public:
explicit Note(microsec perfect_offset) :
_perfect_offset(perfect_offset) {}
virtual ~Note() = default;
virtual bool isActive(const microsec& offset) const = 0;
virtual void update(const microsec& music_offset) = 0;
virtual void putToGame() = 0;
virtual bool isInGame() const = 0;
virtual bool shouldRemove() const = 0;
2 years ago
virtual void input(kku::GameEvent&& input) = 0;
inline const microsec& getPerfectOffset() const noexcept
{
return _perfect_offset;
}
bool operator<(const Note& note) const
{
2 years ago
return _perfect_offset < note._perfect_offset;
}
bool operator==(const Note& note) const
{
2 years ago
return _perfect_offset == note._perfect_offset;
}
bool operator>(const Note& note) const
{
2 years ago
return _perfect_offset > note._perfect_offset;
}
protected:
microsec _perfect_offset;
};
2 years ago
struct NotePtrComparator
{
bool operator()(const Note* lhs, const Note* rhs) const noexcept
{
2 years ago
return lhs->getPerfectOffset() < rhs->getPerfectOffset();
}
};
2 years ago
}