Augment Samegame with resource efficient particle system
authorAlan Alpert <alan.alpert@nokia.com>
Mon, 12 Dec 2011 01:32:32 +0000 (11:32 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 14 Dec 2011 03:48:07 +0000 (04:48 +0100)
The particle system cannot automatically turn itself off when it's not
needed, however it is easy enough to do so manually. This change does so
in SameGame as an example.

Task-number: QTBUG-22923
Change-Id: I5f2b3e572222f03c9412fd24c40276529e7d0e7e
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
examples/declarative/samegame/SamegameCore/BoomBlock.qml
examples/declarative/samegame/SamegameCore/GameArea.qml

index e5d4f40..1ea5c47 100644 (file)
@@ -104,7 +104,7 @@ Item {
 
         State {
             name: "DeathState"; when: dying == true
-            StateChangeScript { script: particles.pulse(100); }
+            StateChangeScript { script: {particleSystem.paused = false; particles.pulse(100);} }
             PropertyChanges { target: img; opacity: 0 }
             StateChangeScript { script: block.destroy(1000); }
         }
index 9a8f68a..5628ee0 100644 (file)
@@ -63,6 +63,7 @@ Item {
     }
     ParticleSystem{ 
         id: particleSystem;
+        onEmptyChanged: if (empty) paused = true;
         z:2
         ImageParticle {
             groups: ["red"]