2022-03-16 02:10:18 +01:00
|
|
|
#include "chart_state.hpp"
|
2022-03-17 02:50:30 +01:00
|
|
|
#include "src/better_note.hpp"
|
2022-03-16 02:10:18 +01:00
|
|
|
|
|
|
|
ChartState::ChartState(better::Chart& c, std::filesystem::path assets) :
|
|
|
|
chart(c),
|
|
|
|
density_graph(assets)
|
|
|
|
{
|
|
|
|
history.push(std::make_shared<OpenChart>(c));
|
|
|
|
}
|
|
|
|
|
2022-03-17 02:50:30 +01:00
|
|
|
std::optional<better::LongNote> ChartState::make_long_note_dummy(Fraction current_beat) const {
|
2022-03-16 02:10:18 +01:00
|
|
|
if (creating_long_note and long_note_being_created) {
|
2022-03-17 02:50:30 +01:00
|
|
|
better::LongNote long_note{
|
|
|
|
long_note_being_created->first,
|
|
|
|
long_note_being_created->second
|
|
|
|
};
|
2022-03-16 02:10:18 +01:00
|
|
|
Note dummy_long_note = Note(
|
|
|
|
long_note.getPos(),
|
|
|
|
current_tick,
|
|
|
|
chart.getResolution(),
|
|
|
|
long_note.getTail_pos());
|
|
|
|
return dummy_long_note;
|
|
|
|
} else {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-17 02:50:30 +01:00
|
|
|
std::optional<better::LongNote> ChartState::make_current_long_note() const {
|
2022-03-16 02:10:18 +01:00
|
|
|
if (creating_long_note and long_note_being_created) {
|
|
|
|
return Note(long_note_being_created->first, long_note_being_created->second);
|
|
|
|
} else {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
}
|