project-kyoku/core/shared/core/note.h

51 lines
1.1 KiB
C
Raw Normal View History

#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);
}
protected:
microsec _perfect_offset;
};
2021-10-03 17:23:28 +02:00
struct NotePtrCompt
{
bool operator()(const Note* lhs, const Note* rhs) const noexcept
{
return lhs->offset() < rhs->offset();
}
2021-10-03 17:23:28 +02:00
};