summaryrefslogtreecommitdiffstats
path: root/src/logic/executor.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2015-12-06 14:58:41 +0000
committerSean Harmer <sean.harmer@kdab.com>2015-12-07 19:07:29 +0000
commit8e585245bc1cb5a35269e7b5210b13a34ed886d3 (patch)
tree0cc0c05bc860ca2c10876a770aaf88d4b06cfa84 /src/logic/executor.cpp
parentc807454297e171abc822e56dc5940d61a3d9abd3 (diff)
Pass frame time delta through to the logic component frame update
Allows for smoother animations in logic components. Change-Id: I2aad5055465b3afbac415e21a356e216701551ef Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/logic/executor.cpp')
-rw-r--r--src/logic/executor.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/logic/executor.cpp b/src/logic/executor.cpp
index 95de46f0e..e34299fed 100644
--- a/src/logic/executor.cpp
+++ b/src/logic/executor.cpp
@@ -71,7 +71,8 @@ void Executor::enqueueLogicFrameUpdates(const QVector<Qt3DCore::QNodeId> &nodeId
bool Executor::event(QEvent *e)
{
if (e->type() == QEvent::User) {
- processLogicFrameUpdates();
+ FrameUpdateEvent *ev = static_cast<FrameUpdateEvent *>(e);
+ processLogicFrameUpdates(ev->deltaTime());
e->setAccepted(true);
return true;
}
@@ -83,7 +84,7 @@ bool Executor::event(QEvent *e)
Called from context of main thread
*/
-void Executor::processLogicFrameUpdates()
+void Executor::processLogicFrameUpdates(float dt)
{
Q_ASSERT(m_scene);
Q_ASSERT(m_semaphore);
@@ -91,7 +92,7 @@ void Executor::processLogicFrameUpdates()
foreach (QNode *node, nodes) {
QLogicComponent *logicComponent = qobject_cast<QLogicComponent *>(node);
if (logicComponent)
- logicComponent->onFrameUpdate();
+ logicComponent->onFrameUpdate(dt);
}
// Release the semaphore so the calling Manager can continue