X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fpre-render-callback%2Fpre-render-callback-example.cpp;h=57b3bdb6d12f9eeae4771fe59902d8e1f68d968e;hb=c70446e9b125ae8bb236b4cbc3fd3f8b548459cd;hp=6ca853ebf365ec093bc1d7a27397f70f93a70a35;hpb=80cdb8fb6a112954c040613d61417b12185dc5bd;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/pre-render-callback/pre-render-callback-example.cpp b/examples/pre-render-callback/pre-render-callback-example.cpp index 6ca853e..57b3bdb 100644 --- a/examples/pre-render-callback/pre-render-callback-example.cpp +++ b/examples/pre-render-callback/pre-render-callback-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -34,8 +34,8 @@ void AddText( Control textContainer, std::string text, unsigned int yIndex ) auto label = TextLabel::New(text); label.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER ); label.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); - label.SetSize( 300,TEXT_HEIGHT ); - label.SetY( yIndex*TEXT_HEIGHT ); + label.SetProperty( Actor::Property::SIZE, Vector2( 300,TEXT_HEIGHT ) ); + label.SetProperty( Actor::Property::POSITION_Y, yIndex*TEXT_HEIGHT ); textContainer.Add( label ); } @@ -49,7 +49,7 @@ public: */ PreRenderCallbackController ( Application& application ) : mApplication( application ), - mStage(), + mWindow(), mTapDetector(), mKeepPreRender(false), mRotateTextCharacter(0), @@ -89,16 +89,13 @@ private: */ void Create( Application& application ) { - mStage = Stage::GetCurrent(); - mStage.SetBackgroundColor( Color::WHITE ); - mStage.KeyEventSignal().Connect( this, &PreRenderCallbackController::OnKeyEvent ); - - // Hide the indicator bar. - mApplication.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + mWindow = application.GetWindow(); + mWindow.SetBackgroundColor( Color::WHITE ); + mWindow.KeyEventSignal().Connect( this, &PreRenderCallbackController::OnKeyEvent ); // Detect taps on the root layer. mTapDetector = TapGestureDetector::New(); - mTapDetector.Attach( mStage.GetRootLayer() ); + mTapDetector.Attach( mWindow.GetRootLayer() ); mTapDetector.DetectedSignal().Connect( this, &PreRenderCallbackController::OnTap ); CreateAnimatingScene(); @@ -114,10 +111,10 @@ private: mSpinner = TextLabel::New(""); mSpinner.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); mSpinner.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); - mSpinner.SetSize(100,100); + mSpinner.SetProperty( Actor::Property::SIZE, Vector2(100,100) ); - mStage.Add(mSpinner); - mStage.Add(textContainer); + mWindow.Add(mSpinner); + mWindow.Add(textContainer); DevelApplication::AddIdleWithReturnValue( application, MakeCallback( this, &PreRenderCallbackController::OnIdle ) ); } @@ -125,7 +122,7 @@ private: void CreateAnimatingScene() { mSceneActor = Layer::New(); - mSceneActor.SetBehavior( Layer::LAYER_3D ); + mSceneActor.SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D ); mSceneActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); // Create and add images to the scene actor: @@ -168,13 +165,13 @@ private: mSceneAnimation.SetLooping(true); mSceneAnimation.Play(); - mSceneActor.SetSize(250.0f, 250.0f); - mSceneActor.SetPosition(0.0f, 0.0f, 130.0f); + mSceneActor.SetProperty( Actor::Property::SIZE, Vector2(250.0f, 250.0f) ); + mSceneActor.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 130.0f ) ); Quaternion p( Degree( -6.0f ), Vector3::XAXIS ); Quaternion q( Degree( 20.0f ), Vector3::YAXIS ); mSceneActor.SetProperty( Actor::Property::ORIENTATION, p * q ); - mStage.Add( mSceneActor ); + mWindow.Add( mSceneActor ); } void OnTap( Actor /* actor */, const TapGesture& /* tap */ ) @@ -190,21 +187,21 @@ private: */ void OnKeyEvent( const KeyEvent& event ) { - if( event.state == KeyEvent::Down ) + if( event.GetState() == KeyEvent::DOWN ) { if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) ) { mApplication.Quit(); } - else if( event.keyPressedName.compare("1") == 0) + else if( event.GetKeyName().compare("1") == 0) { Adaptor::Get().SetPreRenderCallback( MakeCallback( this, &PreRenderCallbackController::OnPreRender ) ); } - else if( event.keyPressedName.compare("2") == 0) + else if( event.GetKeyName().compare("2") == 0) { Adaptor::Get().SetPreRenderCallback( NULL ); } - else if( event.keyPressedName.compare("3") == 0) + else if( event.GetKeyName().compare("3") == 0) { mKeepPreRender = !mKeepPreRender; } @@ -234,7 +231,7 @@ private: private: Application& mApplication; - Stage mStage; + Window mWindow; TapGestureDetector mTapDetector; ///< Tap detector to enable the PreRenderCallback bool mKeepPreRender; int mRotateTextCharacter;