diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-07-04 18:15:28 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-06 10:09:09 +0200 |
commit | 29c4b643272a43022081cce063394bac823ab529 (patch) | |
tree | 10e4fe15bdf68dec90edac0d67b949a92d9204d5 /src/declarative/particles/qsgparticleemitter.cpp | |
parent | 87822d24df32311a50dc87ded55ad4d17e8226f0 (diff) |
Squashed Particle System Stateful Rewrite
Add TargetAffector
Fix for ParticlePainter offsets
Adds a particleStates property to ParticleSystem
Augment SpriteGoal to change system states as well
Also add 'collidingParticles' list to affector.
Particle Stochastic States Now actually working, and you can put
emitters, affectors and painters inside their targeted state.
Fireworks example uses states instead of delegates.
Replaced the delegate example with a text thing.
The examples launcher now also contains all the custom examples.
Adds CumulativeDirection and working null Affector (for affected
signal).
Add spaces after all flow control keywords.
Change-Id: I77b7e3044a9800dbfff6db833914d63127602cf5
Reviewed-on: http://codereview.qt.nokia.com/968
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'src/declarative/particles/qsgparticleemitter.cpp')
-rw-r--r-- | src/declarative/particles/qsgparticleemitter.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/declarative/particles/qsgparticleemitter.cpp b/src/declarative/particles/qsgparticleemitter.cpp index 143338f798..a75d6388ed 100644 --- a/src/declarative/particles/qsgparticleemitter.cpp +++ b/src/declarative/particles/qsgparticleemitter.cpp @@ -70,15 +70,15 @@ QSGParticleEmitter::QSGParticleEmitter(QSGItem *parent) : QSGParticleEmitter::~QSGParticleEmitter() { - if(m_defaultExtruder) + if (m_defaultExtruder) delete m_defaultExtruder; } void QSGParticleEmitter::componentComplete() { - if(!m_system && qobject_cast<QSGParticleSystem*>(parentItem())) + if (!m_system && qobject_cast<QSGParticleSystem*>(parentItem())) setSystem(qobject_cast<QSGParticleSystem*>(parentItem())); - if(!m_system) + if (!m_system) qWarning() << "Emitter created without a particle system specified";//TODO: useful QML warnings, like line number? QSGItem::componentComplete(); } @@ -99,31 +99,31 @@ void QSGParticleEmitter::setEmitting(bool arg) QSGParticleExtruder* QSGParticleEmitter::effectiveExtruder() { - if(m_extruder) + if (m_extruder) return m_extruder; - if(!m_defaultExtruder) + if (!m_defaultExtruder) m_defaultExtruder = new QSGParticleExtruder; return m_defaultExtruder; } void QSGParticleEmitter::pulse(qreal seconds) { - if(!particleCount()) + if (!particleCount()) qWarning() << "pulse called on an emitter with a particle count of zero"; - if(!m_emitting) + if (!m_emitting) m_burstLeft = seconds*1000.0;//TODO: Change name to match } void QSGParticleEmitter::burst(int num) { - if(!particleCount()) + if (!particleCount()) qWarning() << "burst called on an emitter with a particle count of zero"; m_burstQueue << qMakePair(num, QPointF(x(), y())); } void QSGParticleEmitter::burst(int num, qreal x, qreal y) { - if(!particleCount()) + if (!particleCount()) qWarning() << "burst called on an emitter with a particle count of zero"; m_burstQueue << qMakePair(num, QPointF(x, y)); } @@ -131,12 +131,12 @@ void QSGParticleEmitter::burst(int num, qreal x, qreal y) void QSGParticleEmitter::setMaxParticleCount(int arg) { if (m_maxParticleCount != arg) { - if(arg < 0 && m_maxParticleCount >= 0){ + if (arg < 0 && m_maxParticleCount >= 0){ connect(this, SIGNAL(particlesPerSecondChanged(qreal)), this, SIGNAL(particleCountChanged())); connect(this, SIGNAL(particleDurationChanged(int)), this, SIGNAL(particleCountChanged())); - }else if(arg >= 0 && m_maxParticleCount < 0){ + }else if (arg >= 0 && m_maxParticleCount < 0){ disconnect(this, SIGNAL(particlesPerSecondChanged(qreal)), this, SIGNAL(particleCountChanged())); disconnect(this, SIGNAL(particleDurationChanged(int)), @@ -149,7 +149,7 @@ void QSGParticleEmitter::setMaxParticleCount(int arg) int QSGParticleEmitter::particleCount() const { - if(m_maxParticleCount >= 0) + if (m_maxParticleCount >= 0) return m_maxParticleCount; return m_particlesPerSecond*((m_particleDuration+m_particleDurationVariation)/1000.0); } |