Confirmed working implementation of Node UpdateCallback. For now example

used in visual effect on selecting a source as current.
This commit is contained in:
brunoherbelin
2020-07-01 23:39:36 +02:00
parent d638145520
commit 6cc756c401
4 changed files with 72 additions and 14 deletions

View File

@@ -57,10 +57,20 @@ void Node::copyTransform(Node *other)
void Node::update( float dt)
{
std::list<UpdateCallback *>::iterator iter;
for (iter=update_callbacks_.begin(); iter != update_callbacks_.end(); iter++)
for (iter=update_callbacks_.begin(); iter != update_callbacks_.end(); )
{
if ((*iter)->enabled())
(*iter)->update(this, dt);
UpdateCallback *callback = *iter;
if (callback->enabled())
callback->update(this, dt);
if (callback->finished()) {
iter = update_callbacks_.erase(iter);
delete callback;
}
else {
iter++;
}
}
// update transform matrix from attributes