Changes following "Changed bubble effect to use new texture API" 95/99995/10
authorFerran Sole <ferran.sole@samsung.com>
Thu, 24 Nov 2016 15:43:22 +0000 (15:43 +0000)
committerFerran Sole <ferran.sole@samsung.com>
Mon, 28 Nov 2016 08:13:56 +0000 (00:13 -0800)
Change-Id: I1e329a43d1d6026bdfe41facd67d8228561ae713

examples/bubble-effect/bubble-effect-example.cpp
examples/new-window/new-window-example.cpp

index 5cb3625..8de8a42 100644 (file)
@@ -62,7 +62,6 @@ class BubbleEffectExample : public ConnectionTracker
 public:
   BubbleEffectExample(Application &app)
   : mApp(app),
-    mBackgroundImage(),
     mBackground(),
     mBubbleEmitter(),
     mEmitAnimation(),
@@ -128,11 +127,11 @@ private:
 
     // Create and initialize the BubbleEmitter object
     mBubbleEmitter = Toolkit::BubbleEmitter::New( stageSize,
-                                                  DemoHelper::LoadImage( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ),
+                                                  DemoHelper::LoadTexture( BUBBLE_SHAPE_IMAGES[mCurrentBubbleShapeImageId] ),
                                                   DEFAULT_NUMBER_OF_BUBBLES,
                                                   DEFAULT_BUBBLE_SIZE);
-    mBackgroundImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[mCurrentBackgroundImageId] );
-    mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta );
+
+    mBubbleEmitter.SetBackground( DemoHelper::LoadStageFillingTexture( BACKGROUND_IMAGES[mCurrentBackgroundImageId] ), mHSVDelta );
 
     // Get the root actor of all bubbles, and add it to stage.
     Actor bubbleRoot = mBubbleEmitter.GetRootActor();
@@ -140,8 +139,10 @@ private:
     bubbleRoot.SetZ(0.1f); // Make sure the bubbles displayed on top og the background.
     content.Add( bubbleRoot );
 
-    // Add the background image actor to stage
-    mBackground.SetBackgroundImage( mBackgroundImage );
+    // Set the application background
+    mBackground.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
+      .Add( Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::IMAGE )
+      .Add( Dali::Toolkit::ImageVisual::Property::URL, BACKGROUND_IMAGES[mCurrentBackgroundImageId] ));
 
     // Set up the timer to emit bubble regularly when the finger is touched down but not moved
     mTimerForBubbleEmission = Timer::New( mTimerInterval );
@@ -251,15 +252,19 @@ private:
   {
     if(button == mChangeBackgroundButton)
     {
-      mBackgroundImage = DemoHelper::LoadStageFillingImage( BACKGROUND_IMAGES[ ++mCurrentBackgroundImageId % NUM_BACKGROUND_IMAGES  ] );
+      mCurrentBackgroundImageId = (mCurrentBackgroundImageId+1) % NUM_BACKGROUND_IMAGES;
 
-      mBubbleEmitter.SetBackground( mBackgroundImage, mHSVDelta );
+      //Update bubble emitter background
+      mBubbleEmitter.SetBackground( DemoHelper::LoadStageFillingTexture( BACKGROUND_IMAGES[ mCurrentBackgroundImageId  ] ), mHSVDelta );
 
-      mBackground.SetBackgroundImage( mBackgroundImage );
+      // Set the application background
+      mBackground.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map()
+      .Add( Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::IMAGE )
+      .Add( Dali::Toolkit::ImageVisual::Property::URL, BACKGROUND_IMAGES[mCurrentBackgroundImageId] ));
     }
     else if( button == mChangeBubbleShapeButton )
     {
-      mBubbleEmitter.SetShapeImage( DemoHelper::LoadImage( BUBBLE_SHAPE_IMAGES[ ++mCurrentBubbleShapeImageId % NUM_BUBBLE_SHAPE_IMAGES ] ) );
+      mBubbleEmitter.SetBubbleShape( DemoHelper::LoadTexture( BUBBLE_SHAPE_IMAGES[ ++mCurrentBubbleShapeImageId % NUM_BUBBLE_SHAPE_IMAGES ] ) );
     }
     return true;
   }
@@ -281,7 +286,6 @@ private:
 private:
 
   Application&               mApp;
-  Image                      mBackgroundImage;
   Dali::Toolkit::Control     mBackground;
 
   Toolkit::BubbleEmitter     mBubbleEmitter;
index 08dff10..7e6c625 100644 (file)
@@ -243,10 +243,10 @@ void NewWindowController::Destroy( Application& app )
 void NewWindowController::AddBubbles( Actor& parentActor, const Vector2& stageSize)
 {
   mEmitter = Toolkit::BubbleEmitter::New( stageSize,
-                                          DemoHelper::LoadImage( DEMO_IMAGE_DIR "bubble-ball.png" ),
+                                          DemoHelper::LoadTexture( DEMO_IMAGE_DIR "bubble-ball.png" ),
                                           200, Vector2( 5.0f, 5.0f ) );
 
-  Image background = DemoHelper::LoadImage(BACKGROUND_IMAGE);
+  Texture background = DemoHelper::LoadTexture(BACKGROUND_IMAGE);
   mEmitter.SetBackground( background, Vector3(0.5f, 0.f,0.5f) );
   mEmitter.SetBubbleDensity( 9.f );
   Actor bubbleRoot = mEmitter.GetRootActor();