Changed blocks example to use ImageView.
[platform/core/uifw/dali-demo.git] / examples / blocks / blocks-example.cpp
index db050fe..0da125b 100644 (file)
@@ -226,8 +226,6 @@ public:
    */
   void Create(Application& application)
   {
-    DemoHelper::RequestThemeChange();
-
     Stage::GetCurrent().KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
 
     // Creates a default view with a default tool bar.
@@ -358,8 +356,8 @@ private:
     mLevelContainer = Actor::New();
     mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER );
     mLevelContainer.SetParentOrigin( ParentOrigin::CENTER );
-    mLevelContainer.SetRelayoutEnabled( true );
     mLevelContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
     mContentLayer.Add( mLevelContainer );
 
     mBrickCount = 0;
@@ -525,10 +523,9 @@ private:
     const Vector2 brickSize(BRICK_SIZE * Vector2(stageSize.x, stageSize.x));
 
     Image img = ResourceImage::New( BRICK_IMAGE_PATH[type], Dali::ImageDimensions( 128, 64 ), Dali::FittingMode::SCALE_TO_FILL, Dali::SamplingMode::BOX_THEN_LINEAR );
-    ImageActor brick = ImageActor::New(img);
+    ImageView brick = ImageView::New(img);
     brick.SetParentOrigin(ParentOrigin::TOP_LEFT);
     brick.SetAnchorPoint(AnchorPoint::CENTER);
-    brick.SetRelayoutEnabled( false );
     brick.SetSize( brickSize );
     brick.SetPosition( Vector3( position ) );
 
@@ -554,13 +551,11 @@ 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);
-    actor.SetRelayoutEnabled( false );
     return actor;
   }
 
@@ -597,8 +592,8 @@ private:
 
         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();
       }
     }
@@ -623,8 +618,8 @@ private:
         if(point.state==TouchPoint::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();
         }
@@ -766,7 +761,7 @@ private:
 
     // fade brick (destroy)
     Animation destroyAnimation = Animation::New(0.5f);
-    destroyAnimation.AnimateTo( Property( brick, Actor::Property::COLOR_ALPHA ), 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;
@@ -808,15 +803,15 @@ 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)
@@ -843,7 +838,7 @@ void RunTest(Application& app)
 
 int main(int argc, char **argv)
 {
-  Application app = Application::New(&argc, &argv);
+  Application app = Application::New(&argc, &argv, DALI_DEMO_THEME_PATH);
 
   RunTest(app);