changeset 7289:6eaeae29f418

Fix for RT-34962 Ensemble: Speed Gauge stops animation after going back to main screen Reviewed by jasper potts Tested with Ensemble
author Lisa.Selle@oracle.com
date Wed, 11 Jun 2014 15:21:05 -0400
parents b7698ff4b6e3
children 1bb43e54af7a
files apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/brickbreaker/BrickBreakerApp.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/brickbreaker/Level.java apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/gauge/SpeedGaugeApp.java
diffstat 3 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/brickbreaker/BrickBreakerApp.java	Wed Jun 11 12:09:58 2014 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/brickbreaker/BrickBreakerApp.java	Wed Jun 11 15:21:05 2014 -0400
@@ -86,6 +86,11 @@
         currentMainFrame.endGame();
     }
 
+    public void play() {
+        MainFrame currentMainFrame = getMainFrame();
+        currentMainFrame.restartGame();
+    }
+
     public static void main(String[] args) {
         Application.launch(args);
     }
@@ -154,6 +159,15 @@
             }
         }
 
+        public void restartGame() {
+            if (splash != null) {
+                splash.start();
+            }
+            if (level != null) {
+                level.restart();
+            }
+        }
+
         // Current state of the game. The next values are available
         // 0 - Splash
         public static final int SPLASH = 0;
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/brickbreaker/Level.java	Wed Jun 11 12:09:58 2014 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/brickbreaker/Level.java	Wed Jun 11 15:21:05 2014 -0400
@@ -329,10 +329,17 @@
     }
 
     public void stop() {
-        startingTimeline.stop();
+        startingTimeline.pause();
         animationTimer.stop();
     }
 
+    public void restart() {
+        if (message.isVisible()) {
+            startingTimeline.play();
+        }
+        animationTimer.start();
+    }
+
     private void initLevel() {
         String[] level = LevelData.getLevelData(levelNumber);
         for (int row = 0; row < level.length; row++) {
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/gauge/SpeedGaugeApp.java	Wed Jun 11 12:09:58 2014 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/graphics2d/gauge/SpeedGaugeApp.java	Wed Jun 11 15:21:05 2014 -0400
@@ -119,6 +119,10 @@
         timer.stop();
     }
 
+    public void play() {
+        timer.start();
+    }
+
     /**
      * @param args the command line arguments
      */