Use Handle::GetCurrentProperty instead of Devel API
[platform/core/uifw/dali-demo.git] / examples / blocks / blocks-example.cpp
index 9cf4395..e22260d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,17 +31,17 @@ using namespace DemoHelper;
 
 namespace
 {
-const char* BACKGROUND_IMAGE( DALI_IMAGE_DIR "background-blocks.jpg" );
-const char* TOOLBAR_IMAGE( DALI_IMAGE_DIR "top-bar.png" );
+const char* BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-blocks.jpg" );
+const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" );
 const char* APPLICATION_TITLE( "DALi Blocks" );
-const char* BALL_IMAGE = DALI_IMAGE_DIR "blocks-ball.png";
-const char* PADDLE_IMAGE = DALI_IMAGE_DIR "blocks-paddle.png";
-const char* PADDLE_HANDLE_IMAGE = DALI_IMAGE_DIR "blocks-paddle-handle.png";
+const char* BALL_IMAGE = DEMO_IMAGE_DIR "blocks-ball.png";
+const char* PADDLE_IMAGE = DEMO_IMAGE_DIR "blocks-paddle.png";
+const char* PADDLE_HANDLE_IMAGE = DEMO_IMAGE_DIR "blocks-paddle-handle.png";
 
-const char* BRICK_IMAGE_PATH[] =    { DALI_IMAGE_DIR "blocks-brick-1.png",
-                                      DALI_IMAGE_DIR "blocks-brick-2.png",
-                                      DALI_IMAGE_DIR "blocks-brick-3.png",
-                                      DALI_IMAGE_DIR "blocks-brick-4.png" };
+const char* BRICK_IMAGE_PATH[] =    { DEMO_IMAGE_DIR "blocks-brick-1.png",
+                                      DEMO_IMAGE_DIR "blocks-brick-2.png",
+                                      DEMO_IMAGE_DIR "blocks-brick-3.png",
+                                      DEMO_IMAGE_DIR "blocks-brick-4.png" };
 
 const int TOTAL_BRICKS(4);                                                  ///< Total bricks in game.
 const Vector3 ICON_SIZE(100.0f, 100.0f, 0.0f);
@@ -56,8 +56,8 @@ const Vector3 PADDLE_COLLISION_MARGIN(0.0f, 0.0f, 0.0f);                    ///<
 const Vector3 BRICK_COLLISION_MARGIN(0.0f, 0.0f, 0.0f);                     ///< Collision margin for ball-brick detection.
 const Vector3 INITIAL_BALL_DIRECTION(1.0f, 1.0f, 0.0f);                     ///< Initial ball direction.
 
-const std::string WOBBLE_PROPERTY_NAME("wobble-property");                  ///< Wobble property name.
-const std::string COLLISION_PROPERTY_NAME("collision-property");            ///< Collision property name.
+const std::string WOBBLE_PROPERTY_NAME("wobbleProperty");                  ///< Wobble property name.
+const std::string COLLISION_PROPERTY_NAME("collisionProperty");            ///< Collision property name.
 
 const Vector2 BRICK_SIZE(0.1f, 0.05f );                                     ///< Brick size relative to width of stage.
 const Vector2 BALL_SIZE( 0.05f, 0.05f );                                    ///< Ball size relative to width of stage.
@@ -73,65 +73,6 @@ const int TOTAL_LEVELS(3);                                                  ///<
 // constraints ////////////////////////////////////////////////////////////////
 
 /**
- * CollisionConstraint generates a collision vector
- * between two actors a and b, assuming they're rectangular
- * based on their size.
- */
-struct CollisionConstraint
-{
-  /**
-   * Collision Constraint constructor
-   * The adjust (optional) parameter can be used to add a margin
-   * to the actors. A +ve size will result in larger collisions,
-   * while a -ve size will result in tighter collisions.
-   *
-   * @param[in] adjust (optional) Adjusts the rectangular size detection
-   */
-  CollisionConstraint(Vector3 adjust = Vector3::ZERO)
-  : mAdjust(adjust)
-  {
-  }
-
-  /**
-   * Generates collision vector indicating whether Actor's A and B
-   * have overlapped eachother, and the relative position of Actor B to A.
-   *
-   * @param[in] current The current collision-property (ignored)
-   * @param[in] propertyA Actor A's Position property.
-   * @param[in] propertyB Actor B's Position property.
-   * @param[in] propertySizeA Actor A's Size property.
-   * @param[in] propertySizeB Actor B's Size property.
-   * @return The collision vector is returned.
-   */
-  Vector3 operator()(const Vector3& current,
-                     const PropertyInput& propertyA,
-                     const PropertyInput& propertyB,
-                     const PropertyInput& propertySizeA,
-                     const PropertyInput& propertySizeB)
-  {
-    const Vector3& a = propertyA.GetVector3();
-    const Vector3& b = propertyB.GetVector3();
-    const Vector3& sizeA = propertySizeA.GetVector3();
-    const Vector3& sizeB = propertySizeB.GetVector3();
-    const Vector3 sizeComb = (sizeA + sizeB + mAdjust) * 0.5f;
-
-    // get collision relative to a.
-    Vector3 delta = b - a;
-
-    // Check if not overlapping Actors.
-    if( (fabsf(delta.x) > sizeComb.width) ||
-        (fabsf(delta.y) > sizeComb.height) )
-    {
-      delta = Vector3::ZERO; // not overlapping
-    }
-
-    return delta; // overlapping, return overlap vector relative to actor a.
-  }
-
-  const Vector3 mAdjust;            ///< Size Adjustment value
-};
-
-/**
  * CollisionCircleRectangleConstraint generates a collision vector
  * between two actors a (circle) and b (rectangle)
  */
@@ -157,23 +98,20 @@ struct CollisionCircleRectangleConstraint
    * Generates collision vector indicating whether Actor's A and B
    * have overlapped eachother, and the relative position of Actor B to A.
    *
-   * @param[in] current The current collision-property (ignored)
-   * @param[in] propertyA Actor A's Position property.
-   * @param[in] propertyB Actor B's Position property.
-   * @param[in] propertySizeA Actor A's Size property.
-   * @param[in] propertySizeB Actor B's Size property.
+   * @param[in,out] current The current collision-property
+   * @param[in] inputs Contains:
+   *                    Actor A's Position property.
+   *                    Actor B's Position property.
+   *                    Actor A's Size property.
+   *                    Actor B's Size property.
    * @return The collision vector is returned.
    */
-  Vector3 operator()(const Vector3& current,
-                     const PropertyInput& propertyA,
-                     const PropertyInput& propertyB,
-                     const PropertyInput& propertySizeA,
-                     const PropertyInput& propertySizeB)
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-    const Vector3& a = propertyA.GetVector3();
-    const Vector3 b = propertyB.GetVector3() + mAdjustPosition;
-    const Vector3& sizeA = propertySizeA.GetVector3();
-    const Vector3& sizeB = propertySizeB.GetVector3();
+    const Vector3& a = inputs[0]->GetVector3();
+    const Vector3 b = inputs[1]->GetVector3() + mAdjustPosition;
+    const Vector3& sizeA = inputs[2]->GetVector3();
+    const Vector3& sizeB = inputs[3]->GetVector3();
     const Vector3 sizeA2 = sizeA * 0.5f; // circle radius
     const Vector3 sizeB2 = (sizeB + mAdjustSize) * 0.5f; // rectangle half rectangle.
 
@@ -211,10 +149,12 @@ struct CollisionCircleRectangleConstraint
     if(delta.Length() < sizeA2.x)
     {
       delta.Normalize();
-      return delta;
+      current = delta;
+    }
+    else
+    {
+      current = Vector3::ZERO;
     }
-
-    return Vector3::ZERO;
   }
 
   const Vector3 mAdjustPosition;            ///< Position Adjustment value
@@ -236,30 +176,27 @@ struct WobbleConstraint
    *
    * @param[in] deviation The max. deviation of wobble effect in degrees.
    */
-  WobbleConstraint(float deviation)
-  : mDeviation(Radian(Degree(deviation)))
+  WobbleConstraint( Degree deviation )
+  : mDeviation( deviation )
   {
 
   }
 
   /**
-   * @param[in] current The current rotation property (ignored)
-   * @param[in] propertyWobble The wobble property (value from 0.0f to 1.0f)
+   * @param[in,out] current The current rotation property
+   * @param[in] inputs Contains the wobble property (value from 0.0f to 1.0f)
    * @return The rotation (quaternion) is generated.
    */
-  Quaternion operator()(const Quaternion& current,
-                     const PropertyInput& propertyWobble)
+  void operator()( Quaternion& current, const PropertyInputContainer& inputs )
   {
-    const float& wobble = propertyWobble.GetFloat();
+    const float& wobble = inputs[0]->GetFloat();
 
     float f = sinf(wobble * 10.0f) * (1.0f-wobble);
 
-    Quaternion q(mDeviation * f, Vector3::ZAXIS);
-
-    return q;
+    current = Quaternion(mDeviation * f, Vector3::ZAXIS);
   }
 
-  const float mDeviation;           ///< Deviation factor in radians.
+  Radian mDeviation;           ///< Deviation factor in radians.
 };
 
 } // unnamed namespace
@@ -277,7 +214,29 @@ public:
    */
   ExampleController( Application& application )
   : mApplication( application ),
-    mView()
+    mView(),
+    mContentLayer(),
+    mBall(),
+    mBallStartPosition(),
+    mBallVelocity(),
+    mBallAnimation(),
+    mPaddle(),
+    mPaddleImage(),
+    mPaddleHandle(),
+    mPaddleHitMargin(),
+    mWobbleAnimation(),
+    mWobbleProperty( Property::INVALID_INDEX ),
+    mLevelContainer(),
+    mBrickImageMap(),
+    mDragAnimation(),
+    mDragActor(),
+    mRelativeDragPoint(),
+    mDestroyAnimationMap(),
+    mPaddleFullSize(),
+    mLevel( 0 ),
+    mLives( TOTAL_LIVES ),
+    mBrickCount( 0 )
+
   {
     // Connect to the Application's Init and orientation changed signal
     mApplication.InitSignal().Connect(this, &ExampleController::Create);
@@ -291,6 +250,9 @@ public:
   {
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
 
+    // Hide the indicator bar
+    application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
+
     // Creates a default view with a default tool bar.
     // The view is added to the stage.
     Toolkit::ToolBar toolBar;
@@ -346,42 +308,40 @@ private:
     mPaddleImage.SetSize( mPaddleFullSize );
 
     mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f);
-    Constraint wobbleConstraint = Constraint::New<Quaternion>( Actor::Property::Rotation,
-                                                    LocalSource(mWobbleProperty),
-                                                    WobbleConstraint(10.0f));
-    mPaddle.ApplyConstraint(wobbleConstraint);
+    Constraint wobbleConstraint = Constraint::New<Quaternion>( mPaddle, Actor::Property::ORIENTATION, WobbleConstraint(Degree( 10.0f )));
+    wobbleConstraint.AddSource( LocalSource(mWobbleProperty) );
+    wobbleConstraint.Apply();
 
     mPaddle.SetPosition( stageSize * Vector3( PADDLE_START_POSITION ) );
     mContentLayer.Add(mPaddle);
-    mPaddle.TouchedSignal().Connect(this, &ExampleController::OnTouchPaddle);
-    mContentLayer.TouchedSignal().Connect(this, &ExampleController::OnTouchLayer);
+    mPaddle.TouchSignal().Connect(this, &ExampleController::OnTouchPaddle);
+    mContentLayer.TouchSignal().Connect(this, &ExampleController::OnTouchLayer);
 
     const float margin(BALL_SIZE.width * stageSize.width * 0.5f);
 
     // Set up notifications for ball's collisions against walls.
-    PropertyNotification leftNotification = mBall.AddPropertyNotification( Actor::Property::PositionX, LessThanCondition(margin) );
+    PropertyNotification leftNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_X, LessThanCondition(margin) );
     leftNotification.NotifySignal().Connect( this, &ExampleController::OnHitLeftWall );
 
-    PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::Property::PositionX, GreaterThanCondition(stageSize.width - margin) );
+    PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(stageSize.width - margin) );
     rightNotification.NotifySignal().Connect( this, &ExampleController::OnHitRightWall );
 
-    PropertyNotification topNotification = mBall.AddPropertyNotification( Actor::Property::PositionY, LessThanCondition(margin) );
+    PropertyNotification topNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_Y, LessThanCondition(margin) );
     topNotification.NotifySignal().Connect( this, &ExampleController::OnHitTopWall );
 
-    PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::Property::PositionY, GreaterThanCondition(stageSize.height + margin) );
+    PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_Y, GreaterThanCondition(stageSize.height + margin) );
     bottomNotification.NotifySignal().Connect( this, &ExampleController::OnHitBottomWall );
 
     // Set up notification for ball colliding against paddle.
     Actor delegate = Actor::New();
     stage.Add(delegate);
     Property::Index property = delegate.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO);
-    Constraint constraint = Constraint::New<Vector3>( property,
-                                                    Source(mBall, Actor::Property::Position),
-                                                    Source(mPaddle, Actor::Property::Position),
-                                                    Source(mBall, Actor::Property::Size),
-                                                    Source(mPaddle, Actor::Property::Size),
-                                                    CollisionCircleRectangleConstraint( -Vector3(0.0f, mPaddleHitMargin.height * 0.575f, 0.0f),-Vector3(mPaddleHitMargin) ));
-    delegate.ApplyConstraint(constraint);
+    Constraint constraint = Constraint::New<Vector3>( delegate, property, CollisionCircleRectangleConstraint( -Vector3(0.0f, mPaddleHitMargin.height * 0.575f, 0.0f),-Vector3(mPaddleHitMargin) ) );
+    constraint.AddSource( Source(mBall, Actor::Property::POSITION) );
+    constraint.AddSource( Source(mPaddle, Actor::Property::POSITION) );
+    constraint.AddSource( Source(mBall, Actor::Property::SIZE) );
+    constraint.AddSource( Source(mPaddle, Actor::Property::SIZE) );
+    constraint.Apply();
 
     PropertyNotification paddleNotification = delegate.AddPropertyNotification( property, GreaterThanCondition(0.0f) );
     paddleNotification.NotifySignal().Connect( this, &ExampleController::OnHitPaddle );
@@ -421,11 +381,23 @@ private:
     mLevelContainer = Actor::New();
     mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER );
     mLevelContainer.SetParentOrigin( ParentOrigin::CENTER );
-    mLevelContainer.SetSizeMode( SIZE_EQUAL_TO_PARENT );
+    mLevelContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
     mContentLayer.Add( mLevelContainer );
 
     mBrickCount = 0;
 
+    if( mBrickImageMap.Empty() )
+    {
+      Vector2 stageSize(Stage::GetCurrent().GetSize());
+      const Vector2 brickSize(BRICK_SIZE * Vector2(stageSize.x, stageSize.x));
+
+      mBrickImageMap["desiredWidth"] = static_cast<int>( brickSize.width );
+      mBrickImageMap["desiredHeight"] = static_cast<int>( brickSize.height );
+      mBrickImageMap["fittingMode"] = "SCALE_TO_FILL";
+      mBrickImageMap["samplingMode"] = "BOX_THEN_LINEAR";
+    }
+
     switch(level%TOTAL_LEVELS)
     {
       case 0:
@@ -583,28 +555,21 @@ private:
    */
   Actor CreateBrick( const Vector2& position, int type )
   {
-    Vector2 stageSize(Stage::GetCurrent().GetSize());
-    const Vector2 brickSize(BRICK_SIZE * Vector2(stageSize.x, stageSize.x));
-
-    ImageAttributes attr;
-    attr.SetSize( 128, 64 );
-    attr.SetScalingMode( ImageAttributes::ScaleToFill );
-    Image img = ResourceImage::New(BRICK_IMAGE_PATH[type], attr);
-    ImageActor brick = ImageActor::New(img);
+    mBrickImageMap["url"] = BRICK_IMAGE_PATH[type];
+    ImageView brick = ImageView::New();
+    brick.SetProperty( ImageView::Property::IMAGE, mBrickImageMap );
     brick.SetParentOrigin(ParentOrigin::TOP_LEFT);
     brick.SetAnchorPoint(AnchorPoint::CENTER);
-    brick.SetSize( brickSize );
     brick.SetPosition( Vector3( position ) );
 
     // Add a constraint on the brick between it and the ball generating a collision-property
     Property::Index property = brick.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO);
-    Constraint constraint = Constraint::New<Vector3>( property,
-                                                    Source(mBall, Actor::Property::Position),
-                                                    Source(brick, Actor::Property::Position),
-                                                    Source(mBall, Actor::Property::Size),
-                                                    Source(brick, Actor::Property::Size),
-                                                    CollisionCircleRectangleConstraint(BRICK_COLLISION_MARGIN));
-    brick.ApplyConstraint(constraint);
+    Constraint constraint = Constraint::New<Vector3>( brick, property, CollisionCircleRectangleConstraint(BRICK_COLLISION_MARGIN) );
+    constraint.AddSource( Source(mBall, Actor::Property::POSITION) );
+    constraint.AddSource( Source(brick, Actor::Property::POSITION) );
+    constraint.AddSource( Source(mBall, Actor::Property::SIZE) );
+    constraint.AddSource( Source(brick, Actor::Property::SIZE) );
+    constraint.Apply();
 
     // Now add a notification on this collision-property
 
@@ -619,10 +584,9 @@ private:
    *
    * @param[in] filename the path of the image.
    */
-  ImageActor CreateImage(const std::string& filename)
+  ImageView CreateImage(const std::string& filename)
   {
-    Image img = ResourceImage::New(filename);
-    ImageActor actor = ImageActor::New(img);
+    ImageView actor = ImageView::New(filename);
     actor.SetParentOrigin(ParentOrigin::TOP_LEFT);
     actor.SetAnchorPoint(AnchorPoint::CENTER);
     return actor;
@@ -639,7 +603,7 @@ private:
     }
 
     mBallAnimation = Animation::New(MAX_ANIMATION_DURATION);
-    mBallAnimation.AnimateBy( Property( mBall, Actor::Property::Position ), mBallVelocity * MAX_ANIMATION_DURATION);
+    mBallAnimation.AnimateBy( Property( mBall, Actor::Property::POSITION ), mBallVelocity * MAX_ANIMATION_DURATION);
     mBallAnimation.Play();
   }
 
@@ -648,21 +612,21 @@ private:
    * @param[in] actor The actor touched
    * @param[in] event The touch event
    */
-  bool OnTouchPaddle(Actor actor, const TouchEvent& event)
+  bool OnTouchPaddle(Actor actor, const TouchData& event)
   {
     if(event.GetPointCount()>0)
     {
-      const TouchPoint& point = event.GetPoint(0);
-      if(point.state==TouchPoint::Down) // Commence dragging
+      if( event.GetState( 0 ) == PointState::DOWN ) // Commence dragging
       {
         // Get point where user touched paddle (relative to paddle's center)
-        mRelativeDragPoint = Vector3(point.screen.x, point.screen.y, 0.0f);
+        Vector2 screenPoint = event.GetScreenPosition( 0 );
+        mRelativeDragPoint = screenPoint;
         mRelativeDragPoint -= actor.GetCurrentPosition();
 
         mDragActor = actor;
         mDragAnimation = Animation::New(0.25f);
-        mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::Scale), Vector3(1.1f, 1.1f, 1.0f), AlphaFunctions::EaseOut);
-        mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunctions::EaseOut);
+        mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.1f, 1.1f, 1.0f), AlphaFunction::EASE_OUT);
+        mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunction::EASE_OUT);
         mDragAnimation.Play();
       }
     }
@@ -674,21 +638,20 @@ private:
    * @param[in] actor The actor touched
    * @param[in] event The touch event
    */
-  bool OnTouchLayer(Actor actor, const TouchEvent& event)
+  bool OnTouchLayer(Actor actor, const TouchData& event)
   {
     if(event.GetPointCount()>0)
     {
-      const TouchPoint& point = event.GetPoint(0);
       if(mDragActor)
       {
-        Vector3 position(point.screen.x, point.screen.y, 0.0f);
+        Vector3 position( event.GetScreenPosition( 0 ) );
         mPaddle.SetPosition( position - mRelativeDragPoint );
 
-        if(point.state==TouchPoint::Up) // Stop dragging
+        if( event.GetState( 0 ) == PointState::UP ) // Stop dragging
         {
           mDragAnimation = Animation::New(0.25f);
-          mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::Scale), Vector3(1.0f, 1.0f, 1.0f), AlphaFunctions::EaseIn);
-          mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunctions::EaseOut);
+          mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.0f, 1.0f, 1.0f), AlphaFunction::EASE_IN);
+          mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunction::EASE_OUT);
           mDragAnimation.Play();
           mDragActor.Reset();
         }
@@ -745,8 +708,8 @@ private:
       mBallVelocity = Vector3::ZERO;
 
       Animation shrink = Animation::New(0.5f);
-      shrink.AnimateTo( Property(mPaddle, Actor::Property::SizeWidth), mPaddleFullSize.x * f + mPaddleHitMargin.x);
-      shrink.AnimateTo( Property(mPaddleImage, Actor::Property::SizeWidth), mPaddleFullSize.x * f );
+      shrink.AnimateTo( Property(mPaddle, Actor::Property::SIZE_WIDTH), mPaddleFullSize.x * f + mPaddleHitMargin.x);
+      shrink.AnimateTo( Property(mPaddleImage, Actor::Property::SIZE_WIDTH), mPaddleFullSize.x * f );
 
       shrink.FinishedSignal().Connect( this, &ExampleController::OnPaddleShrunk );
       shrink.Play();
@@ -763,7 +726,7 @@ private:
     mBall.SetPosition( mBallStartPosition );
     mBall.SetColor( Vector4(1.0f, 1.0f, 1.0f, 0.1f) );
     Animation appear = Animation::New(0.5f);
-    appear.AnimateTo( Property(mBall, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 1.0f) );
+    appear.AnimateTo( Property(mBall, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f) );
     appear.Play();
 
     if(!mLives)
@@ -779,7 +742,7 @@ private:
   void OnHitPaddle(PropertyNotification& source)
   {
     Actor delegate = Actor::DownCast(source.GetTarget());
-    Vector3 collisionVector = delegate.GetProperty<Vector3>(source.GetTargetProperty());
+    Vector3 collisionVector = delegate.GetCurrentProperty< Vector3 >( source.GetTargetProperty() );
     Vector3 ballRelativePosition(mBall.GetCurrentPosition() - mPaddle.GetCurrentPosition());
     ballRelativePosition.Normalize();
 
@@ -814,7 +777,7 @@ private:
   void OnHitBrick(PropertyNotification& source)
   {
     Actor brick = Actor::DownCast(source.GetTarget());
-    Vector3 collisionVector = brick.GetProperty<Vector3>(source.GetTargetProperty());
+    Vector3 collisionVector = brick.GetCurrentProperty< Vector3 >( source.GetTargetProperty() );
 
     const float normalVelocity = fabsf(mBallVelocity.Dot(collisionVector));
     mBallVelocity += collisionVector * normalVelocity * 2.0f;
@@ -830,7 +793,7 @@ private:
 
     // fade brick (destroy)
     Animation destroyAnimation = Animation::New(0.5f);
-    destroyAnimation.AnimateTo( Property( brick, Actor::Property::ColorAlpha ), 0.0f, AlphaFunctions::EaseIn );
+    destroyAnimation.AnimateTo( Property( brick, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunction::EASE_IN );
     destroyAnimation.Play();
     destroyAnimation.FinishedSignal().Connect( this, &ExampleController::OnBrickDestroyed );
     mDestroyAnimationMap[destroyAnimation] = brick;
@@ -872,19 +835,20 @@ private:
 private:
 
   Application& mApplication;                            ///< Application instance
-  Toolkit::View mView;                                  ///< The View instance.
+  Toolkit::Control mView;                               ///< The View instance.
   Layer mContentLayer;                                  ///< The content layer (contains game actors)
-  ImageActor mBall;                                     ///< The Moving ball image.
+  ImageView mBall;                                      ///< The Moving ball image.
   Vector3 mBallStartPosition;                           ///< Ball Start position
   Vector3 mBallVelocity;                                ///< Ball's current direction.
   Animation mBallAnimation;                             ///< Ball's animation
   Actor mPaddle;                                        ///< The paddle including hit area.
-  ImageActor mPaddleImage;                              ///< The paddle's image.
-  ImageActor mPaddleHandle;                             ///< The paddle's handle (where the user touches)
+  ImageView mPaddleImage;                               ///< The paddle's image.
+  ImageView mPaddleHandle;                              ///< The paddle's handle (where the user touches)
   Vector2 mPaddleHitMargin;                             ///< The paddle hit margin.
   Animation mWobbleAnimation;                           ///< Paddle's animation when hit (wobbles)
   Property::Index mWobbleProperty;                      ///< The wobble property (generated from animation)
   Actor mLevelContainer;                                ///< The level container (contains bricks)
+  Property::Map mBrickImageMap;                       ///< The property map used to load the brick
 
   // actor - dragging functionality
 
@@ -905,9 +869,9 @@ void RunTest(Application& app)
   app.MainLoop();
 }
 
-int main(int argc, char **argv)
+int DALI_EXPORT_API main(int argc, char **argv)
 {
-  Application app = Application::New(&argc, &argv);
+  Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);
 
   RunTest(app);