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.

53 lines
1.1 KiB
C++

#pragma once
#include "core/gameevent.h"
#include "core/time.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 input(kku::GameEvent &&input) = 0;
inline const microsec &getPerfectOffset() const noexcept
{
return _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;
}
bool operator>(const Note &note) const
{
return _perfect_offset > note._perfect_offset;
}
protected:
microsec _perfect_offset;
};
struct NotePtrComparator
{
bool operator()(const Note *lhs, const Note *rhs) const noexcept
{
return lhs->getPerfectOffset() < rhs->getPerfectOffset();
}
};
} // namespace kku