Further Setter/Getter public API removal from Dali::Actor
[platform/core/uifw/dali-demo.git] / examples / benchmark / benchmark.cpp
index 8ad4c5b..c4d4cf2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -244,6 +244,9 @@ public:
     // Respond to a click anywhere on the stage
     stage.GetRootLayer().TouchSignal().Connect( this, &Benchmark::OnTouch );
 
+    // Respond to key events
+    stage.KeyEventSignal().Connect( this, &Benchmark::OnKeyEvent );
+
     if( gUseMesh )
     {
       CreateMeshActors();
@@ -277,7 +280,7 @@ public:
     for( size_t i(0); i<actorCount; ++i )
     {
       mImageView[i] = ImageView::New(ImagePath(i));
-      mImageView[i].SetSize(Vector3(0.0f,0.0f,0.0f));
+      mImageView[i].SetProperty( Actor::Property::SIZE, Vector3(0.0f,0.0f,0.0f) );
       mImageView[i].SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
       stage.Add(mImageView[i]);
     }
@@ -304,7 +307,7 @@ public:
     {
       mActor[i] = Actor::New();
       mActor[i].AddRenderer( renderers[i % numImages] );
-      mActor[i].SetSize(0.0f,0.0f,0.0f);
+      mActor[i].SetProperty( Actor::Property::SIZE, Vector3(0.0f,0.0f,0.0f) );
       stage.Add(mActor[i]);
     }
   }
@@ -357,17 +360,17 @@ public:
         }
         if( gUseMesh )
         {
-          mActor[count].SetPosition( initialPosition );
-          mActor[count].SetSize( Vector3(0.0f,0.0f,0.0f) );
-          mActor[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS));
+          mActor[count].SetProperty( Actor::Property::POSITION, initialPosition );
+          mActor[count].SetProperty( Actor::Property::SIZE, Vector3(0.0f,0.0f,0.0f) );
+          mActor[count].SetProperty( Actor::Property::ORIENTATION, Quaternion( Radian(0.0f),Vector3::XAXIS) );
           mShow.AnimateTo( Property( mActor[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
           mShow.AnimateTo( Property( mActor[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
         }
         else
         {
-          mImageView[count].SetPosition( initialPosition );
-          mImageView[count].SetSize( Vector3(0.0f,0.0f,0.0f) );
-          mImageView[count].SetOrientation( Quaternion( Radian(0.0f),Vector3::XAXIS));
+          mImageView[count].SetProperty( Actor::Property::POSITION, initialPosition );
+          mImageView[count].SetProperty( Actor::Property::SIZE, Vector3(0.0f,0.0f,0.0f) );
+          mImageView[count].SetProperty( Actor::Property::ORIENTATION, Quaternion( Radian(0.0f),Vector3::XAXIS) );
           mShow.AnimateTo( Property( mImageView[count], Actor::Property::POSITION), Vector3(xpos+mSize.x*0.5f, ypos+mSize.y*0.5f, 0.0f), AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
           mShow.AnimateTo( Property( mImageView[count], Actor::Property::SIZE), mSize, AlphaFunction::EASE_OUT_BACK, TimePeriod( delay, duration ));
         }
@@ -414,7 +417,7 @@ public:
 
     unsigned int totalColumns = mColumnsPerPage * mPageCount;
 
-    float finalZ = Dali::Stage::GetCurrent().GetRenderTaskList().GetTask(0).GetCameraActor().GetCurrentWorldPosition().z;
+    float finalZ = Dali::Stage::GetCurrent().GetRenderTaskList().GetTask(0).GetCameraActor().GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ).z;
     float totalDuration( 5.0f);
     float durationPerActor( 0.5f );
     float delayBetweenActors = ( totalDuration - durationPerActor) / (mRowsPerPage*mColumnsPerPage);
@@ -448,6 +451,17 @@ public:
     mHide.FinishedSignal().Connect( this, &Benchmark::OnAnimationEnd );
   }
 
+  void OnKeyEvent( const KeyEvent& event )
+  {
+    if( event.state == KeyEvent::Down )
+    {
+      if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
+      {
+        mApplication.Quit();
+      }
+    }
+  }
+
 private:
   Application&  mApplication;