X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fperf-scroll%2Fperf-scroll.cpp;h=503dcc582ed030939c29a654405d6e3380c0e6f6;hb=2e182925204bf3ef9f2a36cbfbf998e79fbafaf5;hp=ddfd9b831a19010baa834a59a4933ab7e755ae56;hpb=de02cf1d81d8a6fc40b2d7b55174a1651c658759;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/perf-scroll/perf-scroll.cpp b/examples/perf-scroll/perf-scroll.cpp index ddfd9b8..503dcc5 100644 --- a/examples/perf-scroll/perf-scroll.cpp +++ b/examples/perf-scroll/perf-scroll.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 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. @@ -15,9 +15,8 @@ * */ -#include #include - +#include #include "shared/utility.h" using namespace Dali; @@ -243,8 +242,11 @@ public: // Respond to a click anywhere on the stage stage.GetRootLayer().TouchSignal().Connect( this, &PerfScroll::OnTouch ); + // Respond to key events + stage.KeyEventSignal().Connect( this, &PerfScroll::OnKeyEvent ); + mParent = Actor::New(); - mParent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mParent.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); stage.Add(mParent); if( gUseMesh ) @@ -279,8 +281,14 @@ public: for( size_t i(0); i( mRowsPerPage ) * mColumnsPerPage ) ) { duration = durationPerActor; delay = delayBetweenActors * count; } 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( 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( 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 ) ); } @@ -435,6 +443,17 @@ public: mHide.FinishedSignal().Connect( this, &PerfScroll::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; @@ -452,15 +471,6 @@ private: Animation mHide; }; -void RunTest( Application& application ) -{ - PerfScroll 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 ); @@ -482,7 +492,8 @@ int DALI_EXPORT_API main( int argc, char **argv ) } } - RunTest( application ); + PerfScroll test( application ); + application.MainLoop(); return 0; }