aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qsgsprite.cpp
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-09-13 09:39:11 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-13 04:53:33 +0200
commit29993ff8e91715bdfbaf964c91e07a112f6d2a24 (patch)
tree46a7b25ba1091f1d6ada9decaa9bf9d77d3a8004 /src/declarative/items/qsgsprite.cpp
parent4dba5720e03542e0989adad2461358074c7d0dee (diff)
Refactor SpriteEngine out of StochasticEngine
Also add ParticleGroups which use only StochasticStates Simplistic change for now, just to focus the API for the particle system. ParticleGroup elements replace the particleStates property on the system, and the term "group" is now used more consistently. Change-Id: I6456f9c521b8166ccd94ea953275557bcfbf6423 Reviewed-on: http://codereview.qt-project.org/4699 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'src/declarative/items/qsgsprite.cpp')
-rw-r--r--src/declarative/items/qsgsprite.cpp27
1 files changed, 1 insertions, 26 deletions
diff --git a/src/declarative/items/qsgsprite.cpp b/src/declarative/items/qsgsprite.cpp
index 806f7a9ad8..63d1951b7c 100644
--- a/src/declarative/items/qsgsprite.cpp
+++ b/src/declarative/items/qsgsprite.cpp
@@ -40,42 +40,17 @@
****************************************************************************/
#include "qsgsprite_p.h"
-//TODO: Split out particle system dependency
-#include "qsgparticlesystem_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
QSGSprite::QSGSprite(QObject *parent) :
- QObject(parent)
+ QSGStochasticState(parent)
, m_generatedCount(0)
, m_framesPerRow(0)
- , m_frames(1)
, m_frameHeight(0)
, m_frameWidth(0)
- , m_duration(1000)
{
}
-void redirectError(QDeclarativeListProperty<QObject> *prop, QObject *value)
-{
- qWarning() << "Could not add " << value << " to state" << prop->object << "as it is not associated with a particle system.";
-}
-
-QDeclarativeListProperty<QObject> QSGSprite::particleChildren()
-{
- QSGParticleSystem* system = qobject_cast<QSGParticleSystem*>(parent());
- if (system)
- return QDeclarativeListProperty<QObject>(this, 0, &QSGParticleSystem::stateRedirect);
- else
- return QDeclarativeListProperty<QObject>(this, 0, &redirectError);
-}
-
-int QSGSprite::variedDuration() const
-{
- return m_duration
- + (m_durationVariance * ((qreal)qrand()/RAND_MAX) * 2)
- - m_durationVariance;
-}
-
QT_END_NAMESPACE