Commit 020cc51564a0ee0b4bb74b4cdafc246787478b56
Merge remote-tracking branch 'origin/tizen' into new_text
Conflicts: examples/item-view/item-view-example.cpp examples/path-animation/path-animation.cpp Change-Id: I6a266274f476748bf34a97652964f501f44fe00c
Showing
18 changed files
with
325 additions
and
217 deletions
README
demo/dali-table-view.cpp
| ... | ... | @@ -248,7 +248,7 @@ void DaliTableView::Initialize( Application& application ) |
| 248 | 248 | mScrollView.SetParentOrigin( ParentOrigin::CENTER ); |
| 249 | 249 | // Note: Currently, changing mScrollView to use SizeMode RELATIVE_TO_PARENT |
| 250 | 250 | // will cause scroll ends to appear in the wrong position. |
| 251 | - mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::Size, Dali::ParentSource( Dali::Actor::Property::Size ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) ); | |
| 251 | + mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) ); | |
| 252 | 252 | mScrollView.SetAxisAutoLock( true ); |
| 253 | 253 | mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete ); |
| 254 | 254 | mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart ); |
| ... | ... | @@ -470,8 +470,8 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit |
| 470 | 470 | TextLabel label = TextLabel::New(); |
| 471 | 471 | label.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 472 | 472 | label.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 473 | - label.SetProperty( TextLabel::PROPERTY_MULTI_LINE, true ); | |
| 474 | - label.SetProperty( TextLabel::PROPERTY_TEXT, title ); | |
| 473 | + label.SetProperty( TextLabel::Property::MULTI_LINE, true ); | |
| 474 | + label.SetProperty( TextLabel::Property::TEXT, title ); | |
| 475 | 475 | label.SetColor( Color::BLACK ); |
| 476 | 476 | tile.Add( label ); |
| 477 | 477 | |
| ... | ... | @@ -715,9 +715,9 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis |
| 715 | 715 | dfActor.SetPosition( actorPos ); |
| 716 | 716 | |
| 717 | 717 | // Define bubble horizontal parallax and vertical wrapping |
| 718 | - Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::Position, | |
| 718 | + Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::POSITION, | |
| 719 | 719 | Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), |
| 720 | - Dali::ParentSource( Dali::Actor::Property::Size ), | |
| 720 | + Dali::ParentSource( Dali::Actor::Property::SIZE ), | |
| 721 | 721 | AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.25f ), randSize ) ); |
| 722 | 722 | dfActor.ApplyConstraint( animConstraint ); |
| 723 | 723 | |
| ... | ... | @@ -728,7 +728,7 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage dis |
| 728 | 728 | Vector3 toPos( actorPos ); |
| 729 | 729 | toPos.y -= ( size.y + randSize ); |
| 730 | 730 | keyframes.Add( 1.0f, toPos ); |
| 731 | - animation.AnimateBetween( Property( dfActor, Actor::Property::Position ), keyframes ); | |
| 731 | + animation.AnimateBetween( Property( dfActor, Actor::Property::POSITION ), keyframes ); | |
| 732 | 732 | animation.SetLooping( true ); |
| 733 | 733 | animation.Play(); |
| 734 | 734 | mBackgroundAnimations.push_back( animation ); |
| ... | ... | @@ -926,5 +926,3 @@ bool DaliTableView::OnTileHovered( Actor actor, const HoverEvent& event ) |
| 926 | 926 | KeyboardFocusManager::Get().SetCurrentFocusActor( actor ); |
| 927 | 927 | return true; |
| 928 | 928 | } |
| 929 | - | |
| 930 | - | ... | ... |
examples/blocks/blocks-example.cpp
| ... | ... | @@ -346,7 +346,7 @@ private: |
| 346 | 346 | mPaddleImage.SetSize( mPaddleFullSize ); |
| 347 | 347 | |
| 348 | 348 | mWobbleProperty = mPaddle.RegisterProperty(WOBBLE_PROPERTY_NAME, 0.0f); |
| 349 | - Constraint wobbleConstraint = Constraint::New<Quaternion>( Actor::Property::Rotation, | |
| 349 | + Constraint wobbleConstraint = Constraint::New<Quaternion>( Actor::Property::ROTATION, | |
| 350 | 350 | LocalSource(mWobbleProperty), |
| 351 | 351 | WobbleConstraint(10.0f)); |
| 352 | 352 | mPaddle.ApplyConstraint(wobbleConstraint); |
| ... | ... | @@ -359,16 +359,16 @@ private: |
| 359 | 359 | const float margin(BALL_SIZE.width * stageSize.width * 0.5f); |
| 360 | 360 | |
| 361 | 361 | // Set up notifications for ball's collisions against walls. |
| 362 | - PropertyNotification leftNotification = mBall.AddPropertyNotification( Actor::Property::PositionX, LessThanCondition(margin) ); | |
| 362 | + PropertyNotification leftNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_X, LessThanCondition(margin) ); | |
| 363 | 363 | leftNotification.NotifySignal().Connect( this, &ExampleController::OnHitLeftWall ); |
| 364 | 364 | |
| 365 | - PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::Property::PositionX, GreaterThanCondition(stageSize.width - margin) ); | |
| 365 | + PropertyNotification rightNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(stageSize.width - margin) ); | |
| 366 | 366 | rightNotification.NotifySignal().Connect( this, &ExampleController::OnHitRightWall ); |
| 367 | 367 | |
| 368 | - PropertyNotification topNotification = mBall.AddPropertyNotification( Actor::Property::PositionY, LessThanCondition(margin) ); | |
| 368 | + PropertyNotification topNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_Y, LessThanCondition(margin) ); | |
| 369 | 369 | topNotification.NotifySignal().Connect( this, &ExampleController::OnHitTopWall ); |
| 370 | 370 | |
| 371 | - PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::Property::PositionY, GreaterThanCondition(stageSize.height + margin) ); | |
| 371 | + PropertyNotification bottomNotification = mBall.AddPropertyNotification( Actor::Property::POSITION_Y, GreaterThanCondition(stageSize.height + margin) ); | |
| 372 | 372 | bottomNotification.NotifySignal().Connect( this, &ExampleController::OnHitBottomWall ); |
| 373 | 373 | |
| 374 | 374 | // Set up notification for ball colliding against paddle. |
| ... | ... | @@ -376,10 +376,10 @@ private: |
| 376 | 376 | stage.Add(delegate); |
| 377 | 377 | Property::Index property = delegate.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO); |
| 378 | 378 | Constraint constraint = Constraint::New<Vector3>( property, |
| 379 | - Source(mBall, Actor::Property::Position), | |
| 380 | - Source(mPaddle, Actor::Property::Position), | |
| 381 | - Source(mBall, Actor::Property::Size), | |
| 382 | - Source(mPaddle, Actor::Property::Size), | |
| 379 | + Source(mBall, Actor::Property::POSITION), | |
| 380 | + Source(mPaddle, Actor::Property::POSITION), | |
| 381 | + Source(mBall, Actor::Property::SIZE), | |
| 382 | + Source(mPaddle, Actor::Property::SIZE), | |
| 383 | 383 | CollisionCircleRectangleConstraint( -Vector3(0.0f, mPaddleHitMargin.height * 0.575f, 0.0f),-Vector3(mPaddleHitMargin) )); |
| 384 | 384 | delegate.ApplyConstraint(constraint); |
| 385 | 385 | |
| ... | ... | @@ -599,10 +599,10 @@ private: |
| 599 | 599 | // Add a constraint on the brick between it and the ball generating a collision-property |
| 600 | 600 | Property::Index property = brick.RegisterProperty(COLLISION_PROPERTY_NAME, Vector3::ZERO); |
| 601 | 601 | Constraint constraint = Constraint::New<Vector3>( property, |
| 602 | - Source(mBall, Actor::Property::Position), | |
| 603 | - Source(brick, Actor::Property::Position), | |
| 604 | - Source(mBall, Actor::Property::Size), | |
| 605 | - Source(brick, Actor::Property::Size), | |
| 602 | + Source(mBall, Actor::Property::POSITION), | |
| 603 | + Source(brick, Actor::Property::POSITION), | |
| 604 | + Source(mBall, Actor::Property::SIZE), | |
| 605 | + Source(brick, Actor::Property::SIZE), | |
| 606 | 606 | CollisionCircleRectangleConstraint(BRICK_COLLISION_MARGIN)); |
| 607 | 607 | brick.ApplyConstraint(constraint); |
| 608 | 608 | |
| ... | ... | @@ -639,7 +639,7 @@ private: |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | mBallAnimation = Animation::New(MAX_ANIMATION_DURATION); |
| 642 | - mBallAnimation.AnimateBy( Property( mBall, Actor::Property::Position ), mBallVelocity * MAX_ANIMATION_DURATION); | |
| 642 | + mBallAnimation.AnimateBy( Property( mBall, Actor::Property::POSITION ), mBallVelocity * MAX_ANIMATION_DURATION); | |
| 643 | 643 | mBallAnimation.Play(); |
| 644 | 644 | } |
| 645 | 645 | |
| ... | ... | @@ -661,8 +661,8 @@ private: |
| 661 | 661 | |
| 662 | 662 | mDragActor = actor; |
| 663 | 663 | mDragAnimation = Animation::New(0.25f); |
| 664 | - mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::Scale), Vector3(1.1f, 1.1f, 1.0f), AlphaFunctions::EaseOut); | |
| 665 | - mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunctions::EaseOut); | |
| 664 | + mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.1f, 1.1f, 1.0f), AlphaFunctions::EaseOut); | |
| 665 | + mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 0.0f), AlphaFunctions::EaseOut); | |
| 666 | 666 | mDragAnimation.Play(); |
| 667 | 667 | } |
| 668 | 668 | } |
| ... | ... | @@ -687,8 +687,8 @@ private: |
| 687 | 687 | if(point.state==TouchPoint::Up) // Stop dragging |
| 688 | 688 | { |
| 689 | 689 | mDragAnimation = Animation::New(0.25f); |
| 690 | - mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::Scale), Vector3(1.0f, 1.0f, 1.0f), AlphaFunctions::EaseIn); | |
| 691 | - mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunctions::EaseOut); | |
| 690 | + mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.0f, 1.0f, 1.0f), AlphaFunctions::EaseIn); | |
| 691 | + mDragAnimation.AnimateTo( Property(mPaddleHandle, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f), AlphaFunctions::EaseOut); | |
| 692 | 692 | mDragAnimation.Play(); |
| 693 | 693 | mDragActor.Reset(); |
| 694 | 694 | } |
| ... | ... | @@ -745,8 +745,8 @@ private: |
| 745 | 745 | mBallVelocity = Vector3::ZERO; |
| 746 | 746 | |
| 747 | 747 | Animation shrink = Animation::New(0.5f); |
| 748 | - shrink.AnimateTo( Property(mPaddle, Actor::Property::SizeWidth), mPaddleFullSize.x * f + mPaddleHitMargin.x); | |
| 749 | - shrink.AnimateTo( Property(mPaddleImage, Actor::Property::SizeWidth), mPaddleFullSize.x * f ); | |
| 748 | + shrink.AnimateTo( Property(mPaddle, Actor::Property::SIZE_WIDTH), mPaddleFullSize.x * f + mPaddleHitMargin.x); | |
| 749 | + shrink.AnimateTo( Property(mPaddleImage, Actor::Property::SIZE_WIDTH), mPaddleFullSize.x * f ); | |
| 750 | 750 | |
| 751 | 751 | shrink.FinishedSignal().Connect( this, &ExampleController::OnPaddleShrunk ); |
| 752 | 752 | shrink.Play(); |
| ... | ... | @@ -763,7 +763,7 @@ private: |
| 763 | 763 | mBall.SetPosition( mBallStartPosition ); |
| 764 | 764 | mBall.SetColor( Vector4(1.0f, 1.0f, 1.0f, 0.1f) ); |
| 765 | 765 | Animation appear = Animation::New(0.5f); |
| 766 | - appear.AnimateTo( Property(mBall, Actor::Property::Color), Vector4(1.0f, 1.0f, 1.0f, 1.0f) ); | |
| 766 | + appear.AnimateTo( Property(mBall, Actor::Property::COLOR), Vector4(1.0f, 1.0f, 1.0f, 1.0f) ); | |
| 767 | 767 | appear.Play(); |
| 768 | 768 | |
| 769 | 769 | if(!mLives) |
| ... | ... | @@ -830,7 +830,7 @@ private: |
| 830 | 830 | |
| 831 | 831 | // fade brick (destroy) |
| 832 | 832 | Animation destroyAnimation = Animation::New(0.5f); |
| 833 | - destroyAnimation.AnimateTo( Property( brick, Actor::Property::ColorAlpha ), 0.0f, AlphaFunctions::EaseIn ); | |
| 833 | + destroyAnimation.AnimateTo( Property( brick, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunctions::EaseIn ); | |
| 834 | 834 | destroyAnimation.Play(); |
| 835 | 835 | destroyAnimation.FinishedSignal().Connect( this, &ExampleController::OnBrickDestroyed ); |
| 836 | 836 | mDestroyAnimationMap[destroyAnimation] = brick; | ... | ... |
examples/cluster/cluster-example.cpp
| ... | ... | @@ -707,7 +707,7 @@ public: |
| 707 | 707 | Vector2 shearCenter( Vector2(position.x + size.width * shearAnchor.x, position.y + size.height * shearAnchor.y) ); |
| 708 | 708 | Property::Index centerProperty = shaderEffect.GetPropertyIndex(shaderEffect.GetCenterPropertyName()); |
| 709 | 709 | Constraint constraint = Constraint::New<Vector2>( centerProperty, |
| 710 | - Source(mView, Actor::Property::Size), | |
| 710 | + Source(mView, Actor::Property::SIZE), | |
| 711 | 711 | ShearEffectCenterConstraint(stageSize, shearCenter) ); |
| 712 | 712 | shaderEffect.ApplyConstraint(constraint); |
| 713 | 713 | |
| ... | ... | @@ -720,12 +720,12 @@ public: |
| 720 | 720 | |
| 721 | 721 | constraint = Constraint::New<float>( angleXAxisProperty, |
| 722 | 722 | Source(mScrollView, scrollOvershootProperty), |
| 723 | - Source(mView, Actor::Property::Rotation), | |
| 723 | + Source(mView, Actor::Property::ROTATION), | |
| 724 | 724 | ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::XAXIS) ); |
| 725 | 725 | shaderEffect.ApplyConstraint(constraint); |
| 726 | 726 | constraint = Constraint::New<float>( angleYAxisProperty, |
| 727 | 727 | Source(mScrollView, scrollOvershootProperty), |
| 728 | - Source(mView, Actor::Property::Rotation), | |
| 728 | + Source(mView, Actor::Property::ROTATION), | |
| 729 | 729 | ShearEffectConstraint(stageSize, SHEAR_EFFECT_MAX_OVERSHOOT, Vector2::YAXIS) ); |
| 730 | 730 | shaderEffect.ApplyConstraint(constraint); |
| 731 | 731 | |
| ... | ... | @@ -752,7 +752,7 @@ public: |
| 752 | 752 | |
| 753 | 753 | Property::Index anglePerUnit = shaderEffect.GetPropertyIndex( shaderEffect.GetAnglePerUnitPropertyName() ); |
| 754 | 754 | shaderEffect.ApplyConstraint( Constraint::New<Vector2>( anglePerUnit, |
| 755 | - Source(mView, Actor::Property::Rotation), | |
| 755 | + Source(mView, Actor::Property::ROTATION), | |
| 756 | 756 | CarouselEffectOrientationConstraint( angleSweep ) ) ); |
| 757 | 757 | |
| 758 | 758 | break; |
| ... | ... | @@ -779,7 +779,7 @@ public: |
| 779 | 779 | // dont apply shader effect to scrollview as it might override internal shaders for bounce effect etc |
| 780 | 780 | for( std::vector<ClusterInfo>::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) |
| 781 | 781 | { |
| 782 | - Constraint constraint = Constraint::New<float>(Actor::Property::PositionZ, SphereEffectOffsetConstraint(SPHERE_EFFECT_POSITION_Z)); | |
| 782 | + Constraint constraint = Constraint::New<float>(Actor::Property::POSITION_Z, SphereEffectOffsetConstraint(SPHERE_EFFECT_POSITION_Z)); | |
| 783 | 783 | constraint.SetRemoveAction(Constraint::Discard); |
| 784 | 784 | Cluster cluster = i->mCluster; |
| 785 | 785 | SetShaderEffectRecursively( cluster, shaderEffect ); | ... | ... |
examples/cube-transition-effect/cube-transition-effect-example.cpp
| ... | ... | @@ -259,7 +259,7 @@ void CubeTransitionApp::OnInit( Application& application ) |
| 259 | 259 | mViewTimer.TickSignal().Connect( this, &CubeTransitionApp::OnTimerTick ); |
| 260 | 260 | |
| 261 | 261 | // show the first image |
| 262 | - mImageConstraint = Constraint::New<Vector3>( Actor::Property::Scale, LocalSource( Actor::Property::Size ), ParentSource( Actor::Property::Size ), ScaleToFitKeepAspectRatioConstraint() ); | |
| 262 | + mImageConstraint = Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); | |
| 263 | 263 | |
| 264 | 264 | mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); |
| 265 | 265 | mCurrentImage.SetPositionInheritanceMode( USE_PARENT_POSITION ); | ... | ... |
examples/dissolve-effect/dissolve-effect-example.cpp
| ... | ... | @@ -228,7 +228,7 @@ void DissolveEffectApp::OnInit( Application& application ) |
| 228 | 228 | mParent.SetPositionInheritanceMode( USE_PARENT_POSITION ); |
| 229 | 229 | mContent.Add( mParent ); |
| 230 | 230 | |
| 231 | - mSizeConstraint= Constraint::New<Vector3>( Actor::Property::Scale, LocalSource( Actor::Property::Size ), ParentSource( Actor::Property::Size ), ScaleToFitKeepAspectRatioConstraint() ); | |
| 231 | + mSizeConstraint= Constraint::New<Vector3>( Actor::Property::SCALE, LocalSource( Actor::Property::SIZE ), ParentSource( Actor::Property::SIZE ), ScaleToFitKeepAspectRatioConstraint() ); | |
| 232 | 232 | |
| 233 | 233 | // show the first image |
| 234 | 234 | mCurrentImage = ImageActor::New( ResourceImage::New( IMAGES[mIndex] ) ); | ... | ... |
examples/item-view/item-view-example.cpp
| ... | ... | @@ -959,11 +959,11 @@ private: |
| 959 | 959 | mMenu.Add( tableView ); |
| 960 | 960 | |
| 961 | 961 | Slider slider = Slider::New(); |
| 962 | - slider.SetProperty( Slider::LOWER_BOUND_PROPERTY, 0.0f ); | |
| 963 | - slider.SetProperty( Slider::UPPER_BOUND_PROPERTY, 3.0f ); | |
| 964 | - slider.SetProperty( Slider::VALUE_PROPERTY, mDurationSeconds ); | |
| 965 | - slider.SetProperty( Slider::VALUE_PRECISION_PROPERTY, 2 ); | |
| 966 | - slider.SetProperty( Slider::SHOW_POPUP_PROPERTY, true ); | |
| 962 | + slider.SetProperty( Slider::Property::LOWER_BOUND, 0.0f ); | |
| 963 | + slider.SetProperty( Slider::Property::UPPER_BOUND, 3.0f ); | |
| 964 | + slider.SetProperty( Slider::Property::VALUE, mDurationSeconds ); | |
| 965 | + slider.SetProperty( Slider::Property::VALUE_PRECISION, 2 ); | |
| 966 | + slider.SetProperty( Slider::Property::SHOW_POPUP, true ); | |
| 967 | 967 | slider.ValueChangedSignal().Connect( this, &ItemViewExample::SliderValueChange ); |
| 968 | 968 | tableView.AddChild( slider, TableView::CellPosition( 0, 0 ) ); |
| 969 | 969 | tableView.SetRelativeHeight( 0, 0.5f ); | ... | ... |
examples/magnifier/magnifier-example.cpp
| ... | ... | @@ -240,11 +240,11 @@ public: |
| 240 | 240 | overlay.Add( mMagnifier ); |
| 241 | 241 | |
| 242 | 242 | // Apply constraint to animate the position of the magnifier. |
| 243 | - Constraint constraint = Constraint::New<Vector3>(Actor::Property::Position, | |
| 244 | - LocalSource(Actor::Property::Size), | |
| 245 | - LocalSource(Actor::Property::ParentOrigin), | |
| 246 | - LocalSource(Actor::Property::AnchorPoint), | |
| 247 | - ParentSource(Actor::Property::Size), | |
| 243 | + Constraint constraint = Constraint::New<Vector3>(Actor::Property::POSITION, | |
| 244 | + LocalSource(Actor::Property::SIZE), | |
| 245 | + LocalSource(Actor::Property::PARENT_ORIGIN), | |
| 246 | + LocalSource(Actor::Property::ANCHOR_POINT), | |
| 247 | + ParentSource(Actor::Property::SIZE), | |
| 248 | 248 | ConfinementConstraint(ParentOrigin::CENTER, Vector2::ONE * MAGNIFIER_INDENT, Vector2::ONE * MAGNIFIER_INDENT)); |
| 249 | 249 | constraint.SetRemoveAction(Constraint::Discard); |
| 250 | 250 | mMagnifier.ApplyConstraint( constraint ); |
| ... | ... | @@ -260,15 +260,15 @@ public: |
| 260 | 260 | ContinueAnimation(); |
| 261 | 261 | |
| 262 | 262 | // Apply constraint to animate the position of the magnifier. |
| 263 | - constraint = Constraint::New<Vector3>(Actor::Property::Position, | |
| 264 | - LocalSource(Actor::Property::Size), | |
| 263 | + constraint = Constraint::New<Vector3>(Actor::Property::POSITION, | |
| 264 | + LocalSource(Actor::Property::SIZE), | |
| 265 | 265 | LocalSource(mAnimationTimeProperty), |
| 266 | 266 | MagnifierPathConstraint(mStageSize, mStageSize * 0.5f)); |
| 267 | 267 | mBouncingMagnifier.ApplyConstraint( constraint ); |
| 268 | 268 | |
| 269 | 269 | // Apply constraint to animate the source of the magnifier. |
| 270 | 270 | constraint = Constraint::New<Vector3>(mBouncingMagnifier.GetPropertyIndex( Toolkit::Magnifier::SOURCE_POSITION_PROPERTY_NAME ), |
| 271 | - LocalSource(Actor::Property::Size), | |
| 271 | + LocalSource(Actor::Property::SIZE), | |
| 272 | 272 | LocalSource(mAnimationTimeProperty), |
| 273 | 273 | MagnifierPathConstraint(mStageSize)); |
| 274 | 274 | mBouncingMagnifier.ApplyConstraint( constraint ); |
| ... | ... | @@ -355,7 +355,7 @@ public: |
| 355 | 355 | if(!mMagnifierShown) |
| 356 | 356 | { |
| 357 | 357 | Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION); |
| 358 | - animation.AnimateTo(Property(mMagnifier, Actor::Property::Scale), Vector3::ONE, AlphaFunctions::EaseIn); | |
| 358 | + animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ONE, AlphaFunctions::EaseIn); | |
| 359 | 359 | animation.Play(); |
| 360 | 360 | mMagnifierShown = true; |
| 361 | 361 | } |
| ... | ... | @@ -369,7 +369,7 @@ public: |
| 369 | 369 | if(mMagnifierShown) |
| 370 | 370 | { |
| 371 | 371 | Animation animation = Animation::New(MAGNIFIER_DISPLAY_DURATION); |
| 372 | - animation.AnimateTo(Property(mMagnifier, Actor::Property::Scale), Vector3::ZERO, AlphaFunctions::EaseOut); | |
| 372 | + animation.AnimateTo(Property(mMagnifier, Actor::Property::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut); | |
| 373 | 373 | animation.Play(); |
| 374 | 374 | mMagnifierShown = false; |
| 375 | 375 | } | ... | ... |
examples/motion-blur/motion-blur-example.cpp
| ... | ... | @@ -349,7 +349,7 @@ public: |
| 349 | 349 | mActorTapMovementAnimation = Animation::New( animDuration ); |
| 350 | 350 | if ( mMotionBlurImageActor ) |
| 351 | 351 | { |
| 352 | - mActorTapMovementAnimation.AnimateTo( Property(mMotionBlurImageActor, Actor::Property::Position), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) ); | |
| 352 | + mActorTapMovementAnimation.AnimateTo( Property(mMotionBlurImageActor, Actor::Property::POSITION), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) ); | |
| 353 | 353 | } |
| 354 | 354 | mActorTapMovementAnimation.SetEndAction( Animation::Bake ); |
| 355 | 355 | mActorTapMovementAnimation.Play(); | ... | ... |
examples/motion-stretch/motion-stretch-example.cpp
| ... | ... | @@ -261,7 +261,7 @@ public: |
| 261 | 261 | mActorTapMovementAnimation = Animation::New( animDuration ); |
| 262 | 262 | if ( mMotionStretchImageActor ) |
| 263 | 263 | { |
| 264 | - mActorTapMovementAnimation.AnimateTo( Property(mMotionStretchImageActor, Actor::Property::Position), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) ); | |
| 264 | + mActorTapMovementAnimation.AnimateTo( Property(mMotionStretchImageActor, Actor::Property::POSITION), destPos, AlphaFunctions::EaseInOutSine, TimePeriod(animDuration) ); | |
| 265 | 265 | } |
| 266 | 266 | mActorTapMovementAnimation.SetEndAction( Animation::Bake ); |
| 267 | 267 | mActorTapMovementAnimation.Play(); | ... | ... |
examples/path-animation/path-animation.cpp
| ... | ... | @@ -44,84 +44,61 @@ class PathController : public ConnectionTracker |
| 44 | 44 | public: |
| 45 | 45 | |
| 46 | 46 | PathController( Application& application ) |
| 47 | - : mApplication( application ) | |
| 48 | - { | |
| 47 | +: mApplication( application ) | |
| 48 | +{ | |
| 49 | 49 | // Connect to the Application's Init signal |
| 50 | 50 | mApplication.InitSignal().Connect( this, &PathController::Create ); |
| 51 | - } | |
| 51 | +} | |
| 52 | 52 | |
| 53 | 53 | ~PathController() |
| 54 | 54 | { |
| 55 | 55 | // Nothing to do here. |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - /** | |
| 59 | - * One-time setup in response to Application InitSignal. | |
| 60 | - */ | |
| 61 | - void Create( Application& application ) | |
| 58 | + /* | |
| 59 | + * Create a control composed of a label and an slider | |
| 60 | + * @param[in] label The text to be displayed ny the label | |
| 61 | + * @param[in] size The size of the slider | |
| 62 | + * @param[in] callback Pointer to the callback function to be called when user moves the slider | |
| 63 | + */ | |
| 64 | + Actor CreateVectorComponentControl( const std::string& label, const Vector3& size, bool(PathController::*callback)(Slider,float) ) | |
| 62 | 65 | { |
| 63 | - // Get a handle to the stage: | |
| 64 | - Stage stage = Stage::GetCurrent(); | |
| 65 | - | |
| 66 | - // Connect to input event signals: | |
| 67 | - stage.KeyEventSignal().Connect(this, &PathController::OnKeyEvent); | |
| 68 | - | |
| 69 | - // Create a default view with a default tool bar: | |
| 70 | - Toolkit::View view; ///< The View instance. | |
| 71 | - Toolkit::ToolBar toolBar; ///< The View's Toolbar. | |
| 72 | - mContentLayer = DemoHelper::CreateView( mApplication, | |
| 73 | - view, | |
| 74 | - toolBar, | |
| 75 | - BACKGROUND_IMAGE, | |
| 76 | - TOOLBAR_IMAGE, | |
| 77 | - "" ); | |
| 78 | - | |
| 79 | - mContentLayer.TouchedSignal().Connect(this, &PathController::OnTouchLayer); | |
| 80 | - | |
| 81 | - //Path | |
| 82 | - mPath = Dali::Path::New(); | |
| 83 | - mPath.AddPoint( Vector3( 10.0f, stage.GetSize().y*0.5f, 0.0f )); | |
| 84 | - mPath.AddPoint( Vector3( stage.GetSize().x*0.5f, stage.GetSize().y*0.3f, 0.0f )); | |
| 85 | - mPath.GenerateControlPoints(0.25f); | |
| 86 | - DrawPath( 200u ); | |
| 87 | - | |
| 88 | - //Actor | |
| 89 | - ImageAttributes attributes; | |
| 90 | - Image img = ResourceImage::New(ACTOR_IMAGE, attributes ); | |
| 91 | - mActor = ImageActor::New( img ); | |
| 92 | - mActor.SetPosition( Vector3( 10.0f, stage.GetSize().y*0.5f, 0.0f ) ); | |
| 93 | - mActor.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 94 | - mActor.SetSize( 100, 50, 1 ); | |
| 95 | - stage.Add( mActor ); | |
| 96 | - | |
| 97 | - mForward = Vector3::XAXIS; | |
| 98 | - CreateAnimation(); | |
| 66 | + return Actor(); // TODO | |
| 99 | 67 | } |
| 100 | 68 | |
| 101 | 69 | /** |
| 102 | - * Create an actor representing a control point of the curve | |
| 103 | - * @param[in] name Name of the actor | |
| 104 | - * @param[in] size Size of the containing actor | |
| 105 | - * @param[in] imageSize Size of the imageActor | |
| 106 | - * @param[in] color Color of the imageActor | |
| 70 | + * Crate all the GUI controls | |
| 107 | 71 | */ |
| 108 | - Actor CreateControlPoint(const std::string& name, const Vector3& size, const Vector3& imageSize, const Vector4& color ) | |
| 72 | + void CreateControls() | |
| 109 | 73 | { |
| 110 | - Actor actor = Actor::New(); | |
| 111 | - actor.SetParentOrigin( ParentOrigin::TOP_LEFT); | |
| 112 | - actor.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 113 | - actor.SetSize( size ); | |
| 114 | - actor.SetName( name ); | |
| 115 | - actor.TouchedSignal().Connect(this, &PathController::OnTouchPoint); | |
| 116 | - | |
| 117 | - ImageActor imageActor = Toolkit::CreateSolidColorActor(color); | |
| 118 | - imageActor.SetColor(Vector4(1.0f,0.0f,0.0f,1.0f)); | |
| 119 | - imageActor.SetParentOrigin( ParentOrigin::CENTER); | |
| 120 | - imageActor.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 121 | - imageActor.SetSize( imageSize ); | |
| 122 | - actor.Add(imageActor ); | |
| 123 | - | |
| 124 | - return actor; | |
| 74 | + Stage stage = Stage::GetCurrent(); | |
| 75 | + | |
| 76 | + //TextInput | |
| 77 | + Dali::Layer controlsLayer = Dali::Layer::New(); | |
| 78 | + controlsLayer.SetSize( stage.GetSize().x, stage.GetSize().y*0.3f, 0.0 ); | |
| 79 | + controlsLayer.SetPosition( 0.0f, stage.GetSize().y*0.8f, 0.0f ); | |
| 80 | + controlsLayer.SetAnchorPoint( AnchorPoint::TOP_LEFT); | |
| 81 | + controlsLayer.SetParentOrigin( ParentOrigin::TOP_LEFT); | |
| 82 | + controlsLayer.TouchedSignal().Connect(this, &PathController::OnTouchGuiLayer); | |
| 83 | + stage.Add( controlsLayer ); | |
| 84 | + | |
| 85 | + Vector3 textInputSize( stage.GetSize().x, stage.GetSize().y*0.04f, 0.0f ); | |
| 86 | + Actor control0 = CreateVectorComponentControl("x:", textInputSize, &PathController::OnSliderXValueChange ); | |
| 87 | + control0.SetY( stage.GetSize().y*0.05f ); | |
| 88 | + control0.SetAnchorPoint(AnchorPoint::TOP_LEFT); | |
| 89 | + controlsLayer.Add( control0 ); | |
| 90 | + | |
| 91 | + Actor control1 = CreateVectorComponentControl("y:", textInputSize, &PathController::OnSliderYValueChange ); | |
| 92 | + control1.SetAnchorPoint(AnchorPoint::TOP_LEFT); | |
| 93 | + control1.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); | |
| 94 | + control1.SetPosition(0.0f,stage.GetSize().y*0.01,0.0f); | |
| 95 | + control0.Add( control1 ); | |
| 96 | + | |
| 97 | + Actor control2 =CreateVectorComponentControl("z:", textInputSize, &PathController::OnSliderZValueChange ); | |
| 98 | + control2.SetAnchorPoint(AnchorPoint::TOP_LEFT); | |
| 99 | + control2.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); | |
| 100 | + control2.SetPosition(0.0f,stage.GetSize().y*0.01,0.0f); | |
| 101 | + control1.Add( control2 ); | |
| 125 | 102 | } |
| 126 | 103 | |
| 127 | 104 | /** |
| ... | ... | @@ -191,50 +168,107 @@ public: |
| 191 | 168 | |
| 192 | 169 | |
| 193 | 170 | //Create actors representing interpolation points |
| 171 | + index = 0; | |
| 194 | 172 | for( size_t i(0); i<pointCount; ++i ) |
| 195 | 173 | { |
| 196 | - if( !mKnot[i] ) | |
| 174 | + if( !mControlPoint[index] ) | |
| 197 | 175 | { |
| 198 | - std::string name( "Knot"); | |
| 199 | - name.push_back(i); | |
| 200 | - mKnot[i] = CreateControlPoint( name, Vector3(150.0f,150.0f,0.0f), Vector3(20.0f,20.0f,0.0f), Vector4(0.0f,0.0f,0.0f,1.0f) ); | |
| 201 | - mContentLayer.Add(mKnot[i] ); | |
| 176 | + mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); | |
| 177 | + mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); | |
| 178 | + mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); | |
| 179 | + mControlPoint[index].SetSize( 20.0f, 20.0f ); | |
| 180 | + mContentLayer.Add(mControlPoint[index]); | |
| 202 | 181 | } |
| 203 | 182 | |
| 204 | - mKnot[i].SetPosition( mPath.GetPoint(i) ); | |
| 183 | + std::string name( "Knot"); | |
| 184 | + name.push_back(i); | |
| 185 | + mControlPoint[index].SetName( name ); | |
| 186 | + mControlPoint[index].SetPosition( mPath.GetPoint(i) ); | |
| 187 | + mControlPoint[index].SetColor( Vector4(0.0f,0.0f,0.0f,1.0f)); | |
| 188 | + ++index; | |
| 205 | 189 | } |
| 206 | 190 | |
| 207 | 191 | //Create actors representing control points |
| 208 | 192 | size_t controlPointCount=2*(pointCount-1); |
| 209 | 193 | for( size_t i(0); i<controlPointCount; ++i ) |
| 210 | 194 | { |
| 211 | - if( !mControlPoint[i]) | |
| 195 | + if( !mControlPoint[index]) | |
| 212 | 196 | { |
| 213 | - std::string name( "ControlPoint"); | |
| 214 | - name.push_back(i); | |
| 215 | - mControlPoint[i] = CreateControlPoint( name, Vector3(150.0f,150.0f,0.0f), Vector3(20.0f,20.0f,0.0f), Vector4(1.0f,0.0f,0.0f,1.0f) ); | |
| 216 | - mContentLayer.Add(mControlPoint[i] ); | |
| 197 | + mControlPoint[index] = Toolkit::CreateSolidColorActor(Vector4(1.0f,1.0f,1.0f,1.0f)); | |
| 198 | + mControlPoint[index].SetParentOrigin( ParentOrigin::TOP_LEFT); | |
| 199 | + mControlPoint[index].SetAnchorPoint( AnchorPoint::CENTER ); | |
| 200 | + mControlPoint[index].SetSize( 20.0f, 20.0f ); | |
| 201 | + mContentLayer.Add(mControlPoint[index]); | |
| 217 | 202 | } |
| 218 | - | |
| 219 | - mControlPoint[i].SetPosition( mPath.GetControlPoint(i) ); | |
| 203 | + std::string name( "ControlPoint"); | |
| 204 | + name.push_back(i); | |
| 205 | + mControlPoint[index].SetName( name ); | |
| 206 | + mControlPoint[index].SetPosition( mPath.GetControlPoint(i) ); | |
| 207 | + mControlPoint[index].SetColor( Vector4(1.0f,0.0f,0.0f,1.0f)); | |
| 208 | + ++index; | |
| 220 | 209 | } |
| 221 | 210 | } |
| 222 | 211 | |
| 223 | - bool OnTouchPoint(Actor actor, const TouchEvent& event) | |
| 212 | + /** | |
| 213 | + * Create the path animation. | |
| 214 | + */ | |
| 215 | + void CreateAnimation() | |
| 224 | 216 | { |
| 225 | - if(event.GetPointCount()>0) | |
| 217 | + if( !mAnimation ) | |
| 226 | 218 | { |
| 227 | - const TouchPoint& point = event.GetPoint(0); | |
| 219 | + mAnimation = Animation::New( 2.0f ); | |
| 220 | + } | |
| 221 | + else | |
| 222 | + { | |
| 223 | + mAnimation.Pause(); | |
| 224 | + mAnimation.Clear(); | |
| 225 | + mActor.SetRotation( Quaternion() ); | |
| 226 | + } | |
| 228 | 227 | |
| 229 | - if(point.state==TouchPoint::Down) | |
| 228 | + mAnimation.Animate( mActor, mPath, mForward ); | |
| 229 | + mAnimation.SetLooping( true ); | |
| 230 | + mAnimation.Play(); | |
| 231 | + } | |
| 232 | + | |
| 233 | + /** | |
| 234 | + * Get closest control point.void | |
| 235 | + * @param[in] point Point from where the distance is computed | |
| 236 | + * @return The closest actor if the distance is beyond 0.5cm or an uninitialized actor otherwise | |
| 237 | + */ | |
| 238 | + Actor GetClosestActor(const Vector3& point) | |
| 239 | + { | |
| 240 | + size_t pointCount = mPath.GetPointCount(); | |
| 241 | + size_t controlPointCount = 3*pointCount - 2; | |
| 242 | + Actor result; | |
| 243 | + float minDistance = 1.0/0.0; | |
| 244 | + | |
| 245 | + for( size_t i(0); i<controlPointCount; ++i ) | |
| 246 | + { | |
| 247 | + Vector3 v = mControlPoint[i].GetCurrentPosition() - point; | |
| 248 | + float distance = v.LengthSquared(); | |
| 249 | + if( distance < minDistance ) | |
| 230 | 250 | { |
| 231 | - // Start dragging | |
| 232 | - mDragActor = actor; | |
| 251 | + result = mControlPoint[i]; | |
| 252 | + minDistance = distance; | |
| 233 | 253 | } |
| 234 | 254 | } |
| 235 | - return false; | |
| 255 | + | |
| 256 | + Vector2 dpi = Dali::Stage::GetCurrent().GetDpi(); | |
| 257 | + float distanceTreshold = 0.2f * dpi.x * 0.2f * dpi.x; | |
| 258 | + | |
| 259 | + if( minDistance < distanceTreshold ) | |
| 260 | + { | |
| 261 | + return result; | |
| 262 | + } | |
| 263 | + else | |
| 264 | + { | |
| 265 | + return Actor(); | |
| 266 | + } | |
| 236 | 267 | } |
| 237 | 268 | |
| 269 | + /** | |
| 270 | + * Callback called when the background layer is touched | |
| 271 | + */ | |
| 238 | 272 | bool OnTouchLayer(Actor actor, const TouchEvent& event) |
| 239 | 273 | { |
| 240 | 274 | if(event.GetPointCount()>0) |
| ... | ... | @@ -246,56 +280,110 @@ public: |
| 246 | 280 | //Stop dragging |
| 247 | 281 | mDragActor.Reset(); |
| 248 | 282 | } |
| 249 | - else if(!mDragActor && point.state==TouchPoint::Down && mPath.GetPointCount()<10 ) | |
| 283 | + else if(point.state==TouchPoint::Down) | |
| 250 | 284 | { |
| 251 | - // Add new point | |
| 252 | - const TouchPoint& point = event.GetPoint(0); | |
| 253 | - Vector3 newPoint = Vector3(point.screen.x, point.screen.y, 0.0f); | |
| 254 | - | |
| 255 | - size_t pointCount = mPath.GetPointCount(); | |
| 256 | - Vector3 lastPoint = mPath.GetPoint( pointCount-1); | |
| 257 | - mPath.AddPoint( newPoint ); | |
| 258 | - | |
| 259 | - Vector3 displacement = (newPoint-lastPoint)/8; | |
| 260 | - | |
| 261 | - mPath.AddControlPoint( lastPoint + displacement ); | |
| 262 | - mPath.AddControlPoint( newPoint - displacement); | |
| 285 | + Vector3 touchPoint = Vector3(event.GetPoint(0).screen.x, event.GetPoint(0).screen.y, 0.0f); | |
| 286 | + if(!mDragActor ) | |
| 287 | + { | |
| 288 | + mDragActor = GetClosestActor( touchPoint ); | |
| 289 | + if( !mDragActor && mPath.GetPointCount() < 10 ) | |
| 290 | + { | |
| 291 | + // Add new point | |
| 292 | + Vector3 lastPoint = mPath.GetPoint( mPath.GetPointCount()-1); | |
| 293 | + mPath.AddPoint( touchPoint ); | |
| 294 | + Vector3 displacement = (touchPoint-lastPoint)/8; | |
| 295 | + mPath.AddControlPoint( lastPoint + displacement ); | |
| 296 | + mPath.AddControlPoint( touchPoint - displacement); | |
| 297 | + | |
| 298 | + DrawPath( 200u ); | |
| 299 | + CreateAnimation(); | |
| 300 | + } | |
| 301 | + } | |
| 302 | + } | |
| 303 | + else if( mDragActor && point.state==TouchPoint::Motion ) | |
| 304 | + { | |
| 305 | + Vector3 touchPoint = Vector3(event.GetPoint(0).screen.x, event.GetPoint(0).screen.y, 0.0f); | |
| 306 | + std::string actorName(mDragActor.GetName()); | |
| 307 | + if( actorName.compare(0, 4, "Knot") == 0) | |
| 308 | + { | |
| 309 | + int index = actorName[4]; | |
| 310 | + mPath.GetPoint(index) = touchPoint; | |
| 311 | + } | |
| 312 | + else | |
| 313 | + { | |
| 314 | + int index = actorName[12]; | |
| 315 | + mPath.GetControlPoint(index) = touchPoint; | |
| 316 | + } | |
| 263 | 317 | |
| 264 | 318 | DrawPath( 200u ); |
| 265 | 319 | CreateAnimation(); |
| 266 | 320 | } |
| 267 | - else | |
| 268 | - { | |
| 269 | - if( mDragActor ) | |
| 270 | - { | |
| 271 | - const TouchPoint& point = event.GetPoint(0); | |
| 272 | - Vector3 newPosition = Vector3(point.screen.x, point.screen.y, 0.0f); | |
| 321 | + } | |
| 273 | 322 | |
| 274 | - std::string actorName(mDragActor.GetName()); | |
| 323 | + return true; | |
| 324 | + } | |
| 275 | 325 | |
| 276 | - if( actorName.compare(0, 4, "Knot") == 0) | |
| 277 | - { | |
| 278 | - int index = actorName[4]; | |
| 279 | - mPath.GetPoint(index) = newPosition; | |
| 280 | - } | |
| 281 | - else | |
| 282 | - { | |
| 283 | - int index = actorName[12]; | |
| 284 | - mPath.GetControlPoint(index) = newPosition; | |
| 285 | - } | |
| 326 | + bool OnTouchGuiLayer(Actor actor, const TouchEvent& event) | |
| 327 | + { | |
| 328 | + mDragActor.Reset(); | |
| 329 | + return false; | |
| 330 | + } | |
| 331 | + /** | |
| 332 | + * Callback called when user changes slider X | |
| 333 | + * @param[in] slider The slider that has generated the signal | |
| 334 | + * @param[in] value The new value | |
| 335 | + */ | |
| 336 | + bool OnSliderXValueChange( Slider s, float value) | |
| 337 | + { | |
| 338 | + if( fabs( value ) - Math::MACHINE_EPSILON_1000 < 0.0f ) | |
| 339 | + { | |
| 340 | + mForward.x = 0.0f; | |
| 341 | + } | |
| 342 | + else | |
| 343 | + { | |
| 344 | + mForward.x = value; | |
| 345 | + } | |
| 286 | 346 | |
| 287 | - DrawPath( 200u ); | |
| 288 | - CreateAnimation(); | |
| 289 | - } | |
| 290 | - } | |
| 347 | + CreateAnimation(); | |
| 348 | + return true; | |
| 349 | + } | |
| 350 | + | |
| 351 | + bool OnSliderYValueChange( Slider s, float value) | |
| 352 | + { | |
| 353 | + if( fabs( value ) - Math::MACHINE_EPSILON_1000 < 0.0f ) | |
| 354 | + { | |
| 355 | + mForward.y = 0.0f; | |
| 291 | 356 | } |
| 292 | - return false; | |
| 357 | + else | |
| 358 | + { | |
| 359 | + mForward.y = value; | |
| 360 | + } | |
| 361 | + CreateAnimation(); | |
| 362 | + return true; | |
| 293 | 363 | } |
| 294 | 364 | |
| 295 | - /** | |
| 296 | - * Main key event handler. | |
| 297 | - * Quit on escape key. | |
| 298 | - */ | |
| 365 | + /** | |
| 366 | + * Create the path animation. | |
| 367 | + */ | |
| 368 | + bool OnSliderZValueChange( Slider s, float value) | |
| 369 | + { | |
| 370 | + if( fabs( value ) - Math::MACHINE_EPSILON_1000 < 0.0f ) | |
| 371 | + { | |
| 372 | + mForward.z = 0.0f; | |
| 373 | + } | |
| 374 | + else | |
| 375 | + { | |
| 376 | + mForward.z = value; | |
| 377 | + } | |
| 378 | + | |
| 379 | + CreateAnimation(); | |
| 380 | + return true; | |
| 381 | + } | |
| 382 | + | |
| 383 | + /** | |
| 384 | + * Main key event handler. | |
| 385 | + * Quit on escape key. | |
| 386 | + */ | |
| 299 | 387 | void OnKeyEvent(const KeyEvent& event) |
| 300 | 388 | { |
| 301 | 389 | if( event.state == KeyEvent::Down ) |
| ... | ... | @@ -309,24 +397,45 @@ public: |
| 309 | 397 | } |
| 310 | 398 | |
| 311 | 399 | /** |
| 312 | - * Create the path animation. | |
| 400 | + * One-time setup in response to Application InitSignal. | |
| 313 | 401 | */ |
| 314 | - void CreateAnimation() | |
| 402 | + void Create( Application& application ) | |
| 315 | 403 | { |
| 316 | - if( !mAnimation ) | |
| 317 | - { | |
| 318 | - mAnimation = Animation::New( 2.0f ); | |
| 319 | - } | |
| 320 | - else | |
| 321 | - { | |
| 322 | - mAnimation.Pause(); | |
| 323 | - mAnimation.Clear(); | |
| 324 | - mActor.SetRotation( Quaternion() ); | |
| 325 | - } | |
| 404 | + // Get a handle to the stage: | |
| 405 | + Stage stage = Stage::GetCurrent(); | |
| 326 | 406 | |
| 327 | - mAnimation.Animate( mActor, mPath, mForward ); | |
| 328 | - mAnimation.SetLooping( true ); | |
| 329 | - mAnimation.Play(); | |
| 407 | + // Connect to input event signals: | |
| 408 | + stage.KeyEventSignal().Connect(this, &PathController::OnKeyEvent); | |
| 409 | + | |
| 410 | + // Create a default view with a default tool bar: | |
| 411 | + Toolkit::View view; ///< The View instance. | |
| 412 | + Toolkit::ToolBar toolBar; ///< The View's Toolbar. | |
| 413 | + mContentLayer = DemoHelper::CreateView( mApplication, | |
| 414 | + view, | |
| 415 | + toolBar, | |
| 416 | + BACKGROUND_IMAGE, | |
| 417 | + TOOLBAR_IMAGE, | |
| 418 | + "" ); | |
| 419 | + | |
| 420 | + mContentLayer.TouchedSignal().Connect(this, &PathController::OnTouchLayer); | |
| 421 | + | |
| 422 | + //Path | |
| 423 | + mPath = Dali::Path::New(); | |
| 424 | + mPath.AddPoint( Vector3( 10.0f, stage.GetSize().y*0.5f, 0.0f )); | |
| 425 | + mPath.AddPoint( Vector3( stage.GetSize().x*0.5f, stage.GetSize().y*0.5f, 0.0f )); | |
| 426 | + mPath.GenerateControlPoints(0.25f); | |
| 427 | + DrawPath( 200u ); | |
| 428 | + | |
| 429 | + //Actor | |
| 430 | + ImageAttributes attributes; | |
| 431 | + Image img = ResourceImage::New(ACTOR_IMAGE, attributes ); | |
| 432 | + mActor = ImageActor::New( img ); | |
| 433 | + mActor.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 434 | + mActor.SetSize( 100, 50, 1 ); | |
| 435 | + stage.Add( mActor ); | |
| 436 | + | |
| 437 | + CreateAnimation(); | |
| 438 | + CreateControls(); | |
| 330 | 439 | } |
| 331 | 440 | |
| 332 | 441 | private: |
| ... | ... | @@ -340,13 +449,14 @@ private: |
| 340 | 449 | Animation mAnimation; ///< Path animation |
| 341 | 450 | |
| 342 | 451 | MeshActor mMeshPath; ///< Mesh actor for the path |
| 343 | - MeshActor mMeshHandlers; ///< Mesh actor for the segments connecting points and control points | |
| 344 | - Actor mKnot[10]; ///< ImageActors for the interpolation points | |
| 345 | - Actor mControlPoint[18]; ///< ImageActors for the control points | |
| 452 | + MeshActor mMeshHandlers; ///< Mesh actor for the handlers of the path | |
| 453 | + | |
| 454 | + Actor mControlPoint[28]; ///< ImageActors represeting control points of the path | |
| 346 | 455 | |
| 347 | 456 | Actor mDragActor; ///< Reference to the actor currently being dragged |
| 348 | 457 | }; |
| 349 | 458 | |
| 459 | + | |
| 350 | 460 | void RunTest( Application& application ) |
| 351 | 461 | { |
| 352 | 462 | PathController test( application ); | ... | ... |
examples/radial-menu/radial-sweep-view-impl.cpp
| ... | ... | @@ -362,17 +362,17 @@ void RadialSweepViewImpl::CreateStencil( Degree initialSector ) |
| 362 | 362 | |
| 363 | 363 | // Constrain the vertices of the square mesh to sweep out a sector as the |
| 364 | 364 | // rotation angle is animated. |
| 365 | - mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(1, AnimatableVertex::Property::Position), | |
| 365 | + mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(1, AnimatableVertex::Property::POSITION), | |
| 366 | 366 | srcStart, srcStart, SquareFanConstraint(0))); |
| 367 | - mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(2, AnimatableVertex::Property::Position), | |
| 367 | + mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(2, AnimatableVertex::Property::POSITION), | |
| 368 | 368 | srcStart, srcRot, SquareFanConstraint(0))); |
| 369 | - mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(3, AnimatableVertex::Property::Position), | |
| 369 | + mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(3, AnimatableVertex::Property::POSITION), | |
| 370 | 370 | srcStart, srcRot, SquareFanConstraint(1))); |
| 371 | - mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(4, AnimatableVertex::Property::Position), | |
| 371 | + mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(4, AnimatableVertex::Property::POSITION), | |
| 372 | 372 | srcStart, srcRot, SquareFanConstraint(2))); |
| 373 | - mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(5, AnimatableVertex::Property::Position), | |
| 373 | + mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(5, AnimatableVertex::Property::POSITION), | |
| 374 | 374 | srcStart, srcRot, SquareFanConstraint(3))); |
| 375 | - mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(6, AnimatableVertex::Property::Position), | |
| 375 | + mMesh.ApplyConstraint(Constraint::New<Vector3>( mMesh.GetPropertyIndex(6, AnimatableVertex::Property::POSITION), | |
| 376 | 376 | srcStart, srcRot, SquareFanConstraint(4))); |
| 377 | 377 | |
| 378 | 378 | mStencilActor.SetDrawMode( DrawMode::STENCIL ); | ... | ... |
examples/scroll-view/scroll-view-example.cpp
| ... | ... | @@ -210,7 +210,7 @@ public: |
| 210 | 210 | |
| 211 | 211 | // Hack to force screen refresh. |
| 212 | 212 | Animation animation = Animation::New(1.0f); |
| 213 | - animation.AnimateTo(Property(mContentLayer, Actor::Property::Position), Vector3::ZERO ); | |
| 213 | + animation.AnimateTo(Property(mContentLayer, Actor::Property::POSITION), Vector3::ZERO ); | |
| 214 | 214 | animation.Play(); |
| 215 | 215 | } |
| 216 | 216 | ... | ... |
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp
| ... | ... | @@ -269,9 +269,9 @@ public: |
| 269 | 269 | |
| 270 | 270 | Property::Index angleIndex = mImageActor2.RegisterProperty("angle", Property::Value(30.0f)); |
| 271 | 271 | Source angleSrc( mImageActor2, angleIndex ); |
| 272 | - mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::Rotation, angleSrc, | |
| 272 | + mImageActor1.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ROTATION, angleSrc, | |
| 273 | 273 | RotationConstraint(-1.0f))); |
| 274 | - mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::Rotation, angleSrc, | |
| 274 | + mImageActor3.ApplyConstraint(Constraint::New<Quaternion>( Actor::Property::ROTATION, angleSrc, | |
| 275 | 275 | RotationConstraint(+1.0f))); |
| 276 | 276 | |
| 277 | 277 | mSceneAnimation = Animation::New(2.5f); | ... | ... |
examples/text-field/text-field-example.cpp
| ... | ... | @@ -78,10 +78,10 @@ public: |
| 78 | 78 | field.SetBackgroundColor( Color::BLACK ); |
| 79 | 79 | layout.SetTopPanel( field ); |
| 80 | 80 | |
| 81 | - field.SetProperty( TextField::PROPERTY_TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" ); | |
| 81 | + field.SetProperty( TextField::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" ); | |
| 82 | 82 | |
| 83 | 83 | // TODO |
| 84 | - //Property::Value fieldText = field.GetProperty( TextField::PROPERTY_TEXT ); | |
| 84 | + //Property::Value fieldText = field.GetProperty( TextField::Property::TEXT ); | |
| 85 | 85 | //std::cout << "Got text from field: " << fieldText.Get< std::string >() << std::endl; |
| 86 | 86 | } |
| 87 | 87 | ... | ... |
examples/text-label-multi-language/text-label-multi-language-example.cpp
| ... | ... | @@ -74,11 +74,11 @@ public: |
| 74 | 74 | TextLabel label = TextLabel::New(); |
| 75 | 75 | label.SetParentOrigin( ParentOrigin::CENTER ); |
| 76 | 76 | |
| 77 | - label.SetProperty( TextLabel::PROPERTY_MULTI_LINE, true ); | |
| 77 | + label.SetProperty( TextLabel::Property::MULTI_LINE, true ); | |
| 78 | 78 | |
| 79 | 79 | const std::string text = language.languageName + " " + language.languageRomanName + " " + language.text; |
| 80 | 80 | |
| 81 | - label.SetProperty( TextLabel::PROPERTY_TEXT, text ); | |
| 81 | + label.SetProperty( TextLabel::Property::TEXT, text ); | |
| 82 | 82 | mLayout.AddLabel( label ); |
| 83 | 83 | |
| 84 | 84 | mLayout.TouchedSignal().Connect( this, &TextLabelMultiLanguageExample::OnTouchEvent ); | ... | ... |
examples/text-label/text-label-example.cpp
| ... | ... | @@ -80,10 +80,10 @@ public: |
| 80 | 80 | mLabel.SetBackgroundColor( Color::BLACK ); |
| 81 | 81 | centerLayout.Add( mLabel ); |
| 82 | 82 | |
| 83 | - mLabel.SetProperty( TextLabel::PROPERTY_MULTI_LINE, true ); | |
| 84 | - mLabel.SetProperty( TextLabel::PROPERTY_TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" ); | |
| 83 | + mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); | |
| 84 | + mLabel.SetProperty( TextLabel::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" ); | |
| 85 | 85 | |
| 86 | - Property::Value labelText = mLabel.GetProperty( TextLabel::PROPERTY_TEXT ); | |
| 86 | + Property::Value labelText = mLabel.GetProperty( TextLabel::Property::TEXT ); | |
| 87 | 87 | std::cout << "Displaying text: \"" << labelText.Get< std::string >() << "\"" << std::endl; |
| 88 | 88 | } |
| 89 | 89 | |
| ... | ... | @@ -105,20 +105,20 @@ public: |
| 105 | 105 | case KEY_ZERO: // fall through |
| 106 | 106 | case KEY_ONE: |
| 107 | 107 | { |
| 108 | - mLabel.SetProperty( TextLabel::PROPERTY_RENDERING_BACKEND, event.keyCode - 10 ); | |
| 108 | + mLabel.SetProperty( TextLabel::Property::RENDERING_BACKEND, event.keyCode - 10 ); | |
| 109 | 109 | break; |
| 110 | 110 | } |
| 111 | 111 | case KEY_M: |
| 112 | 112 | { |
| 113 | - bool multiLine = mLabel.GetProperty<bool>( TextLabel::PROPERTY_MULTI_LINE ); | |
| 114 | - mLabel.SetProperty( TextLabel::PROPERTY_MULTI_LINE, !multiLine ); | |
| 113 | + bool multiLine = mLabel.GetProperty<bool>( TextLabel::Property::MULTI_LINE ); | |
| 114 | + mLabel.SetProperty( TextLabel::Property::MULTI_LINE, !multiLine ); | |
| 115 | 115 | break; |
| 116 | 116 | } |
| 117 | 117 | case KEY_L: |
| 118 | 118 | { |
| 119 | 119 | const Language& language = LANGUAGES[ mLanguageId ]; |
| 120 | 120 | |
| 121 | - mLabel.SetProperty( TextLabel::PROPERTY_TEXT, language.text ); | |
| 121 | + mLabel.SetProperty( TextLabel::Property::TEXT, language.text ); | |
| 122 | 122 | |
| 123 | 123 | if( ++mLanguageId >= NUMBER_OF_LANGUAGES ) |
| 124 | 124 | { | ... | ... |
shared/view.h
| ... | ... | @@ -65,7 +65,7 @@ Dali::Layer CreateToolbar( Dali::Toolkit::ToolBar& toolBar, |
| 65 | 65 | Dali::Layer toolBarLayer = Dali::Layer::New(); |
| 66 | 66 | toolBarLayer.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER ); |
| 67 | 67 | toolBarLayer.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER ); |
| 68 | - toolBarLayer.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::Size, Dali::ParentSource( Dali::Actor::Property::Size ), Dali::SourceWidthFixedHeight( style.mToolBarHeight ) ) ); | |
| 68 | + toolBarLayer.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::SourceWidthFixedHeight( style.mToolBarHeight ) ) ); | |
| 69 | 69 | toolBarLayer.SetSize( 0.0f, style.mToolBarHeight ); |
| 70 | 70 | |
| 71 | 71 | // Raise tool bar layer to the top. | ... | ... |