X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fbenchmark%2Fbenchmark.cpp;h=6282b5199f98cccecdfcedf7825932399817372d;hb=refs%2Fchanges%2F41%2F234641%2F1;hp=cd3c332360dabc4f371dddca238f815c2c4dc45c;hpb=8b8df4bd98ecbf5226c2f06d477aec784d326860;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/benchmark/benchmark.cpp b/examples/benchmark/benchmark.cpp index cd3c332..6282b51 100644 --- a/examples/benchmark/benchmark.cpp +++ b/examples/benchmark/benchmark.cpp @@ -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(); @@ -359,7 +362,7 @@ public: { 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::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 )); } @@ -367,7 +370,7 @@ public: { 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::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; @@ -464,15 +478,6 @@ private: Animation mHide; }; -void RunTest( Application& application ) -{ - Benchmark test( application ); - - application.MainLoop(); -} - -// Entry point for Linux & Tizen applications -// int DALI_EXPORT_API main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); @@ -502,7 +507,8 @@ int DALI_EXPORT_API main( int argc, char **argv ) } } - RunTest( application ); + Benchmark test( application ); + application.MainLoop(); return 0; }