public:
BubbleEffectExample(Application &app)
: mApp(app),
- mBackgroundImage(),
mBackground(),
mBubbleEmitter(),
mEmitAnimation(),
// 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();
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 );
{
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;
}
private:
Application& mApp;
- Image mBackgroundImage;
Dali::Toolkit::Control mBackground;
Toolkit::BubbleEmitter mBubbleEmitter;