X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fline-mesh%2Fline-mesh-example.cpp;h=ff3aace3e713adfe740a36cb3a0504c25e3affbd;hb=708a5e016f973900a20a885914d3b70741fa80d9;hp=922da415a2c0c8cb2a3db5b8df19a365a60e123e;hpb=e93c7dc0fa84baca2c3c31df6fa83ceccd5d40af;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/line-mesh/line-mesh-example.cpp b/examples/line-mesh/line-mesh-example.cpp index 922da41..ff3aace 100644 --- a/examples/line-mesh/line-mesh-example.cpp +++ b/examples/line-mesh/line-mesh-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. @@ -16,10 +16,9 @@ */ // EXTERNAL INCLUDES -#include +#include #include -#include -#include +#include // INTERNAL INCLUDES #include "shared/view.h" @@ -122,7 +121,7 @@ public: */ ExampleController( Application& application ) : mApplication( application ), - mStageSize(), + mWindowSize(), mShader(), mGeometry(), mRenderer(), @@ -153,7 +152,7 @@ public: */ void Create( Application& application ) { - Stage stage = Stage::GetCurrent(); + Window window = application.GetWindow(); // initial settings mPrimitiveType = Geometry::LINES; @@ -162,16 +161,13 @@ public: CreateRadioButtons(); - stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); + window.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent); - mStageSize = stage.GetSize(); + mWindowSize = window.GetSize(); Initialise(); - // Hide the indicator bar - application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); - - stage.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f)); + window.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f)); } /** @@ -179,12 +175,12 @@ public: */ void Initialise() { - Stage stage = Stage::GetCurrent(); + Window window = mApplication.GetWindow(); // destroy mesh actor and its resources if already exists if( mMeshActor ) { - stage.Remove( mMeshActor ); + window.Remove( mMeshActor ); mMeshActor.Reset(); } @@ -197,15 +193,16 @@ public: mMeshActor = Actor::New(); mMeshActor.AddRenderer( mRenderer ); - mMeshActor.SetSize(200, 200); + mMeshActor.SetProperty( Actor::Property::SIZE, Vector2(200, 200) ); + mMeshActor.SetProperty( DevelActor::Property::UPDATE_SIZE_HINT, Vector2(400, 400) ); Property::Index morphAmountIndex = mMeshActor.RegisterProperty( "uMorphAmount", 0.0f ); mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, 0 ); - mMeshActor.SetParentOrigin( ParentOrigin::CENTER ); - mMeshActor.SetAnchorPoint( AnchorPoint::CENTER ); - stage.Add( mMeshActor ); + mMeshActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + mMeshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + window.Add( mMeshActor ); Animation animation = Animation::New(5); KeyFrames keyFrames = KeyFrames::New(); @@ -222,16 +219,16 @@ public: */ void CreateRadioButtons() { - Stage stage = Stage::GetCurrent(); + Window window = mApplication.GetWindow(); Toolkit::TableView modeSelectTableView = Toolkit::TableView::New( 4, 1 ); - modeSelectTableView.SetParentOrigin( ParentOrigin::TOP_LEFT ); - modeSelectTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + modeSelectTableView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + modeSelectTableView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); modeSelectTableView.SetFitHeight( 0 ); modeSelectTableView.SetFitHeight( 1 ); modeSelectTableView.SetFitHeight( 2 ); modeSelectTableView.SetCellPadding( Vector2( 6.0f, 0.0f ) ); - modeSelectTableView.SetScale( Vector3( 0.8f, 0.8f, 0.8f )); + modeSelectTableView.SetProperty( Actor::Property::SCALE, Vector3( 0.8f, 0.8f, 0.8f )); const char* labels[] = { @@ -246,13 +243,13 @@ public: radio.SetProperty( Toolkit::Button::Property::LABEL, Property::Map() - .Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT ) + .Add( Toolkit::Visual::Property::TYPE, Toolkit::Visual::TEXT ) .Add( Toolkit::TextVisual::Property::TEXT, labels[i] ) .Add( Toolkit::TextVisual::Property::TEXT_COLOR, Vector4( 0.8f, 0.8f, 0.8f, 1.0f ) ) ); - radio.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radio.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + radio.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + radio.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); radio.SetProperty( Toolkit::Button::Property::SELECTED, i == 0 ); radio.PressedSignal().Connect( this, &ExampleController::OnButtonPressed ); mButtons[i] = radio; @@ -261,28 +258,28 @@ public: Toolkit::TableView elementCountTableView = Toolkit::TableView::New( 1, 3 ); elementCountTableView.SetCellPadding( Vector2( 6.0f, 0.0f ) ); - elementCountTableView.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); - elementCountTableView.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); + elementCountTableView.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT ); + elementCountTableView.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT ); elementCountTableView.SetFitHeight( 0 ); elementCountTableView.SetFitWidth( 0 ); elementCountTableView.SetFitWidth( 1 ); elementCountTableView.SetFitWidth( 2 ); mMinusButton = Toolkit::PushButton::New(); mMinusButton.SetProperty( Toolkit::Button::Property::LABEL, "<<" ); - mMinusButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - mMinusButton.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); + mMinusButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + mMinusButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); Toolkit::PushButton mPlusButton = Toolkit::PushButton::New(); mPlusButton.SetProperty( Toolkit::Button::Property::LABEL, ">>" ); - mPlusButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - mPlusButton.SetAnchorPoint( AnchorPoint::CENTER_RIGHT ); + mPlusButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + mPlusButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_RIGHT ); mMinusButton.ClickedSignal().Connect( this, &ExampleController::OnButtonClicked ); mPlusButton.ClickedSignal().Connect( this, &ExampleController::OnButtonClicked ); mIndicesCountLabel = Toolkit::TextLabel::New(); - mIndicesCountLabel.SetParentOrigin( ParentOrigin::CENTER ); - mIndicesCountLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + mIndicesCountLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + mIndicesCountLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); std::stringstream str; str << mCurrentIndexCount; @@ -296,8 +293,8 @@ public: elementCountTableView.AddChild( mIndicesCountLabel, Toolkit::TableView::CellPosition( 0, 1 ) ); elementCountTableView.AddChild( mPlusButton, Toolkit::TableView::CellPosition( 0, 2 ) ); - stage.Add(modeSelectTableView); - stage.Add(elementCountTableView); + window.Add(modeSelectTableView); + window.Add(elementCountTableView); } /** @@ -379,7 +376,7 @@ public: private: Application& mApplication; ///< Application instance - Vector3 mStageSize; ///< The size of the stage + Vector3 mWindowSize; ///< The size of the window Shader mShader; Geometry mGeometry; @@ -394,20 +391,10 @@ private: int mMaxIndexCount; }; -void RunTest( Application& application ) -{ - ExampleController test( application ); - - application.MainLoop(); -} - -// Entry point for Linux & SLP applications -// int DALI_EXPORT_API main( int argc, char **argv ) { Application application = Application::New( &argc, &argv ); - - RunTest( application ); - + ExampleController test( application ); + application.MainLoop(); return 0; }