Return finished animations from util::animation_manager
This commit is contained in:
parent
ab13864021
commit
4cb86d9314
1 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue