|
|
|
@ -37,19 +37,23 @@ void ClassicSceneGraphicsManager::display() const
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClassicSceneGraphicsManager::update(const kku::microsec& offset, ClassicArrowNote* note)
|
|
|
|
|
void ClassicSceneGraphicsManager::update(const kku::microsec &offset)
|
|
|
|
|
{
|
|
|
|
|
//TODO
|
|
|
|
|
(void)note;
|
|
|
|
|
fetchLastNote(offset);
|
|
|
|
|
fetchFirstNote(offset);
|
|
|
|
|
|
|
|
|
|
updateVisibleNotes(offset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClassicSceneGraphicsManager::draw(const ClassicArrowNote* note) const
|
|
|
|
|
void ClassicSceneGraphicsManager::update(const kku::microsec& offset, ClassicArrowNote* note)
|
|
|
|
|
{
|
|
|
|
|
bool hasGraphics = (note->getElements()[0].sprite != nullptr);
|
|
|
|
|
if (isVisiblyClose(note, offset) && (!hasGraphics))
|
|
|
|
|
setGraphics(note->getElements(), kku::TimeRange{note->getPerfectOffset() - _visibility_offset, note->getPerfectOffset()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClassicSceneGraphicsManager::draw(const std::vector<ArrowElement>& elements) const
|
|
|
|
|
{
|
|
|
|
|
auto& elements = note->getElements();
|
|
|
|
|
for (std::size_t i = 0; i < elements.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
const auto& sprite = elements[i].sprite;
|
|
|
|
@ -89,9 +93,9 @@ bool ClassicSceneGraphicsManager::nothingToDraw() const noexcept
|
|
|
|
|
|| _timeline->isExpired(_last);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ClassicSceneGraphicsManager::isVisiblyClose(const Iterator& iterator, const kku::microsec& music_offset) const noexcept
|
|
|
|
|
bool ClassicSceneGraphicsManager::isVisiblyClose(const ClassicNote * const note, const kku::microsec& music_offset) const noexcept
|
|
|
|
|
{
|
|
|
|
|
return ((*iterator)->getPerfectOffset() - _visibility_offset) <= music_offset;
|
|
|
|
|
return (note->getPerfectOffset() - _visibility_offset) <= music_offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ClassicSceneGraphicsManager::fetchFirstNote(const kku::microsec& offset)
|
|
|
|
@ -102,7 +106,7 @@ void ClassicSceneGraphicsManager::fetchFirstNote(const kku::microsec& offset)
|
|
|
|
|
if (offset < (*_first)->getPerfectOffset())
|
|
|
|
|
{
|
|
|
|
|
Iterator note_iterator = _first;
|
|
|
|
|
while (note_iterator != _timeline->begin() && isVisiblyClose(note_iterator, offset))
|
|
|
|
|
while (note_iterator != _timeline->begin() && isVisiblyClose(*note_iterator, offset))
|
|
|
|
|
{
|
|
|
|
|
--note_iterator;
|
|
|
|
|
}
|
|
|
|
@ -110,12 +114,13 @@ void ClassicSceneGraphicsManager::fetchFirstNote(const kku::microsec& offset)
|
|
|
|
|
_first = note_iterator;
|
|
|
|
|
|
|
|
|
|
auto note = *_first;
|
|
|
|
|
if (note->getState() != ClassicNote::State::FLYING
|
|
|
|
|
&& note->getState() != ClassicNote::State::DYING
|
|
|
|
|
const auto state = note->getState();
|
|
|
|
|
if (state != ClassicNote::State::FLYING
|
|
|
|
|
&& state != ClassicNote::State::DYING
|
|
|
|
|
&& state != ClassicNote::State::INITIAL
|
|
|
|
|
&& offset <= note->getPerfectOffset())
|
|
|
|
|
{
|
|
|
|
|
note->setState(ClassicNote::State::FLYING);
|
|
|
|
|
note->setGraphics(shared_from_this(), kku::TimeRange{note->getPerfectOffset() - _visibility_offset, note->getPerfectOffset()});
|
|
|
|
|
note->setState(ClassicNote::State::INITIAL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -138,19 +143,19 @@ void ClassicSceneGraphicsManager::fetchFirstNote(const kku::microsec& offset)
|
|
|
|
|
void ClassicSceneGraphicsManager::fetchLastNote(const kku::microsec& offset)
|
|
|
|
|
{
|
|
|
|
|
Iterator note_iterator = _timeline->getTopNote();
|
|
|
|
|
while (!_timeline->isExpired(note_iterator) && isVisiblyClose(note_iterator, offset))
|
|
|
|
|
while (!_timeline->isExpired(note_iterator) && isVisiblyClose(*note_iterator, offset))
|
|
|
|
|
{
|
|
|
|
|
if (nothingToDraw())
|
|
|
|
|
_first = note_iterator;
|
|
|
|
|
|
|
|
|
|
auto note = *note_iterator;
|
|
|
|
|
|
|
|
|
|
if (note->getState() != ClassicNote::State::FLYING
|
|
|
|
|
&& note->getState() != ClassicNote::State::DYING
|
|
|
|
|
const auto state = note->getState();
|
|
|
|
|
if (state != ClassicNote::State::FLYING
|
|
|
|
|
&& state != ClassicNote::State::DYING
|
|
|
|
|
&& state != ClassicNote::State::INITIAL
|
|
|
|
|
&& offset <= note->getPerfectOffset())
|
|
|
|
|
{
|
|
|
|
|
note->setState(ClassicNote::State::FLYING);
|
|
|
|
|
note->setGraphics(shared_from_this(), kku::TimeRange{note->getPerfectOffset() - _visibility_offset, note->getPerfectOffset()});
|
|
|
|
|
note->setState(ClassicNote::State::INITIAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++note_iterator;
|
|
|
|
|