X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Frendering-basic-light%2Frendering-basic-light-example.cpp;h=b82d38d6bc37e7b532f143f2f512faba3d1a766e;hb=1a473d5189ca7e7d55aca3a64a8a4ff2dc3b6c67;hp=02daf2ff05649553dbd80f8f6e639bb6bcb02a87;hpb=cc86309efaef5f77c85ece1199f95e08534e4a32;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/rendering-basic-light/rendering-basic-light-example.cpp b/examples/rendering-basic-light/rendering-basic-light-example.cpp index 02daf2f..b82d38d 100644 --- a/examples/rendering-basic-light/rendering-basic-light-example.cpp +++ b/examples/rendering-basic-light/rendering-basic-light-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 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. @@ -157,17 +157,17 @@ public: // The Init signal is received once (only) during the Application lifetime void Create( Application& application ) { - // Get a handle to the stage - Stage stage = Stage::GetCurrent(); - stage.SetBackgroundColor( Color::BLACK ); + // Get a handle to the window + Window window = application.GetWindow(); + window.SetBackgroundColor( Color::BLACK ); mLabel = TextLabel::New( material[MaterialID].name ); mLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER ); mLabel.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, 0.0f, 0.5f ) ); - mLabel.SetSize( stage.GetSize().x * 0.5f, stage.GetSize().y * 0.083f ); + mLabel.SetProperty( Actor::Property::SIZE, Vector2( window.GetSize().GetWidth() * 0.5f, window.GetSize().GetHeight() * 0.083f ) ); mLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); mLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); mLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f )); - stage.Add( mLabel ); + window.Add( mLabel ); mButton = PushButton::New(); mButton.SetProperty( Button::Property::LABEL, "Exit" ); mButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); @@ -176,7 +176,7 @@ public: mButton.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, 0.1f, 0.5f ) ); mButton.SetStyleName(CUSTOM_BASIC_LIGHT_THEME); mButton.SetProperty( Actor::Property::COLOR, Vector4( material[MaterialID].diffuse) + Vector4( 0.0f, 0.0f, 0.0f, 1.0f ) ); - stage.Add(mButton); + window.Add(mButton); // Step 1. Create shader CreateCubeShader(); @@ -193,17 +193,17 @@ public: // Step 5. Play animation to rotate the cube PlayAnimation(); - // Respond to a click anywhere on the stage - stage.GetRootLayer().TouchSignal().Connect( this, &BasicLightController::OnTouch ); + // Respond to a click anywhere on the window + window.GetRootLayer().TouchedSignal().Connect( this, &BasicLightController::OnTouch ); // Respond to key events - stage.KeyEventSignal().Connect( this, &BasicLightController::OnKeyEvent ); + window.KeyEventSignal().Connect( this, &BasicLightController::OnKeyEvent ); } /** * This function will change the material of the cube when touched */ - bool OnTouch( Actor actor, const TouchData& touch ) + bool OnTouch( Actor actor, const TouchEvent& touch ) { if(touch.GetState(0) == PointState::UP) { @@ -237,7 +237,7 @@ public: */ 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 ) ) { @@ -308,7 +308,7 @@ public: property.Insert( "aPosition", Property::VECTOR3 ); property.Insert( "aNormal", Property::VECTOR3 ); - PropertyBuffer vertexBuffer = PropertyBuffer::New( property ); + VertexBuffer vertexBuffer = VertexBuffer::New( property ); vertexBuffer.SetData( vertices, sizeof(vertices) / sizeof(Vertex) ); @@ -373,16 +373,16 @@ public: */ void CreateActor() { - Stage stage = Stage::GetCurrent(); + Window window = mApplication.GetWindow(); - float quarterStageWidth = stage.GetSize().x * 0.25f; + float quarterWindowWidth = window.GetSize().GetWidth() * 0.25f; mActor = Actor::New(); mActor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 1.0f, 0.6f, 1.0f ) ); mActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); mActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - mActor.SetSize( Vector3( quarterStageWidth, quarterStageWidth, quarterStageWidth ) ); + mActor.SetProperty( Actor::Property::SIZE, Vector3( quarterWindowWidth, quarterWindowWidth, quarterWindowWidth ) ); mActor.AddRenderer( mRenderer ); - stage.Add( mActor ); + window.Add( mActor ); } /**