X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fbezier-curve%2Fbezier-curve-example.cpp;h=d92bab97f218d259eb45f779bd10e89c9183ee61;hb=4f818cd12c9bf2773d44e5cfdc2fc0a344abf7f5;hp=cf316168ffaa35856476f750243ec6a7547fa50b;hpb=cc86309efaef5f77c85ece1199f95e08534e4a32;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/bezier-curve/bezier-curve-example.cpp b/examples/bezier-curve/bezier-curve-example.cpp index cf31616..d92bab9 100644 --- a/examples/bezier-curve/bezier-curve-example.cpp +++ b/examples/bezier-curve/bezier-curve-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. @@ -17,6 +17,7 @@ #include #include +#include #include "shared/view.h" #include @@ -148,13 +149,10 @@ public: // The Init signal is received once (only) during the Application lifetime void Create( Application& application ) { - // Hide the indicator bar - application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + Window window = mApplication.GetWindow(); + window.KeyEventSignal().Connect( this, &BezierCurveExample::OnKeyEvent ); - Stage stage = Stage::GetCurrent(); - stage.KeyEventSignal().Connect( this, &BezierCurveExample::OnKeyEvent ); - - CreateBackground(stage); + CreateBackground(window); mControlPointScale = 0.5f; mControlPointZoomScale = mControlPointScale * 2.0f; @@ -163,7 +161,7 @@ public: mContentLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mContentLayer.TouchSignal().Connect(this, &BezierCurveExample::OnTouchLayer); mContentLayer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); - stage.Add( mContentLayer ); + window.Add( mContentLayer ); // 6 rows: title, grid, coords, play, anim1, anim2 TableView contentLayout = TableView::New(5, 1); @@ -230,7 +228,7 @@ public: .Add( Visual::Property::TYPE, Visual::IMAGE ) .Add( ImageVisual::Property::URL, ANIMATION_BACKGROUND ) ); animRail.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); - animRail.SetSizeModeFactor( Vector3( 0.666f, 0.2f, 1.0f ) ); + animRail.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( 0.666f, 0.2f, 1.0f ) ); animRail.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); animContainer.Add( animRail ); @@ -277,7 +275,7 @@ public: UpdateCurve(); } - void CreateBackground( Stage stage ) + void CreateBackground( Window window ) { Toolkit::Control background = Dali::Toolkit::Control::New(); background.SetProperty( Actor::Property::ANCHOR_POINT, Dali::AnchorPoint::CENTER ); @@ -288,7 +286,7 @@ public: map.Insert( Visual::Property::TYPE, Visual::COLOR ); map.Insert( ColorVisual::Property::MIX_COLOR, Vector4( 253/255.0f, 245/255.0f, 230/255.0f, 1.0f ) ); background.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map ); - stage.Add( background ); + window.Add( background ); } void CreateCubic(Actor parent) @@ -302,7 +300,7 @@ public: Property::Map curveVertexFormat; curveVertexFormat["aPosition"] = Property::VECTOR2; - mCurveVertices = PropertyBuffer::New( curveVertexFormat ); + mCurveVertices = VertexBuffer::New( curveVertexFormat ); Vector2 vertexData[2] = { Vector2(-0.5f, 0.5f), Vector2( 0.5f, -0.5f ) }; mCurveVertices.SetData( vertexData, 2 ); @@ -318,7 +316,7 @@ public: Actor CreateControlPoint( Actor parent, const char* url, Vector3 position) { Actor actor = ImageView::New( url ); - actor.SetScale( mControlPointScale); + actor.SetProperty( Actor::Property::SCALE, mControlPointScale); actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); // Curve and line drawing works off current value (i.e. last update frame's value). Need to animate to ensure // initial position is baked to both frames before initially drawing the curve. @@ -336,7 +334,7 @@ public: return actor; } - Actor CreateControlLine( PropertyBuffer vertexBuffer ) + Actor CreateControlLine( VertexBuffer vertexBuffer ) { Actor line = Actor::New(); line.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); @@ -357,17 +355,17 @@ public: mControlPoint1 = CreateControlPoint( parent, CIRCLE1_IMAGE, CONTROL_POINT1_ORIGIN ); - mControlPoint1Id = mControlPoint1.GetId(); + mControlPoint1Id = mControlPoint1.GetProperty< int >( Actor::Property::ID ); mControlPoint2 = CreateControlPoint( parent, CIRCLE2_IMAGE, CONTROL_POINT2_ORIGIN ); - mControlPoint2Id = mControlPoint2.GetId(); + mControlPoint2Id = mControlPoint2.GetProperty< int >( Actor::Property::ID ); Property::Map lineVertexFormat; lineVertexFormat["aPosition"] = Property::VECTOR2; - mLine1Vertices = PropertyBuffer::New( lineVertexFormat ); - mLine2Vertices = PropertyBuffer::New( lineVertexFormat ); + mLine1Vertices = VertexBuffer::New( lineVertexFormat ); + mLine2Vertices = VertexBuffer::New( lineVertexFormat ); mControlLine1 = CreateControlLine( mLine1Vertices ); mControlLine2 = CreateControlLine( mLine2Vertices ); @@ -382,7 +380,7 @@ public: { TextLabel progressionLabel = TextLabel::New( "Progression" ); progressionLabel.SetProperty( TextLabel::Property::POINT_SIZE, AXIS_LABEL_POINT_SIZE ); - progressionLabel.SetOrientation( Degree(-90.0f), Vector3::ZAXIS ); + progressionLabel.SetProperty( Actor::Property::ORIENTATION, Quaternion( Radian( Degree(-90.0f) ), Vector3::ZAXIS ) ); progressionLabel.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT ); progressionLabel.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT ); CreateLine( progressionLabel, ParentOrigin::BOTTOM_LEFT ); @@ -494,7 +492,7 @@ public: } } - bool OnTouchControlPoint( Actor controlPoint, const TouchData& event ) + bool OnTouchControlPoint( Actor controlPoint, const TouchEvent& event ) { if( event.GetPointCount() > 0 ) { @@ -512,7 +510,7 @@ public: return false; // Don't mark this as consumed - let the layer get the touch } - bool OnTouchLayer( Actor actor, const TouchData& event ) + bool OnTouchLayer( Actor actor, const TouchEvent& event ) { if( event.GetPointCount() > 0 ) { @@ -520,7 +518,7 @@ public: { Vector3 position( event.GetScreenPosition( 0 ) ); - mDragActor.SetPosition( position - Vector3( mRelativeDragPoint ) ); + mDragActor.SetProperty( Actor::Property::POSITION, position - Vector3( mRelativeDragPoint ) ); if( event.GetState( 0 ) == PointState::UP ) // Stop dragging { @@ -575,7 +573,7 @@ public: void OnKeyEvent(const KeyEvent& event) { - if( event.state == KeyEvent::Down && (IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK )) ) + if( event.GetState() == KeyEvent::DOWN && (IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK )) ) { mApplication.Quit(); } @@ -597,9 +595,9 @@ private: Timer mTimer; Animation mDragAnimation; Animation mBezierAnimation; - PropertyBuffer mCurveVertices; - PropertyBuffer mLine1Vertices; - PropertyBuffer mLine2Vertices; + VertexBuffer mCurveVertices; + VertexBuffer mLine1Vertices; + VertexBuffer mLine2Vertices; Vector2 mRelativeDragPoint; Vector2 mLastControlPointPosition1; Vector2 mLastControlPointPosition2;