Return finished animations from util::animation_manager

This commit is contained in:
Nikita Lisitsa 2023-02-14 13:50:32 +03:00
parent ab13864021
commit 4cb86d9314

View file

@ -38,16 +38,19 @@ namespace psemek::util
std::push_heap(animations_.begin(), animations_.end(), compare{});
}
void update(Time dt)
std::vector<Data> update(Time dt)
{
for (auto & animation : animations_)
animation.time += dt;
std::vector<Data> finished;
while (!animations_.empty() && animations_.front().finished())
{
std::pop_heap(animations_.begin(), animations_.end(), compare{});
finished.push_back(std::move(animations_.back().data));
animations_.pop_back();
}
return finished;
}
animation const * begin() const