Commit 8703f6e3f98f81e8d500d8c494a6ef50374b3162
Committed by
David Steele
1 parent
50858ef7
Use new TouchData API
Change-Id: Ia8cc676eeb95ec2673995026cddca8850693d04e
Showing
25 changed files
with
157 additions
and
219 deletions
demo/dali-table-view.cpp
| @@ -241,7 +241,7 @@ void DaliTableView::Initialize( Application& application ) | @@ -241,7 +241,7 @@ void DaliTableView::Initialize( Application& application ) | ||
| 241 | mScrollView.SetAxisAutoLock( true ); | 241 | mScrollView.SetAxisAutoLock( true ); |
| 242 | mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete ); | 242 | mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete ); |
| 243 | mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart ); | 243 | mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart ); |
| 244 | - mScrollView.TouchedSignal().Connect( this, &DaliTableView::OnScrollTouched ); | 244 | + mScrollView.TouchSignal().Connect( this, &DaliTableView::OnScrollTouched ); |
| 245 | 245 | ||
| 246 | mScrollViewLayer = Layer::New(); | 246 | mScrollViewLayer = Layer::New(); |
| 247 | 247 | ||
| @@ -476,7 +476,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | @@ -476,7 +476,7 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit | ||
| 476 | content.SetKeyboardFocusable(true); | 476 | content.SetKeyboardFocusable(true); |
| 477 | 477 | ||
| 478 | // connect to the touch events | 478 | // connect to the touch events |
| 479 | - content.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed ); | 479 | + content.TouchSignal().Connect( this, &DaliTableView::OnTilePressed ); |
| 480 | content.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered ); | 480 | content.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered ); |
| 481 | 481 | ||
| 482 | return content; | 482 | return content; |
| @@ -496,12 +496,16 @@ Toolkit::ImageView DaliTableView::NewStencilImage() | @@ -496,12 +496,16 @@ Toolkit::ImageView DaliTableView::NewStencilImage() | ||
| 496 | return stencil; | 496 | return stencil; |
| 497 | } | 497 | } |
| 498 | 498 | ||
| 499 | -bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event ) | 499 | +bool DaliTableView::OnTilePressed( Actor actor, const TouchData& event ) |
| 500 | +{ | ||
| 501 | + return DoTilePress( actor, event.GetState( 0 ) ); | ||
| 502 | +} | ||
| 503 | + | ||
| 504 | +bool DaliTableView::DoTilePress( Actor actor, PointState::Type pointState ) | ||
| 500 | { | 505 | { |
| 501 | bool consumed = false; | 506 | bool consumed = false; |
| 502 | 507 | ||
| 503 | - const TouchPoint& point = event.GetPoint( 0 ); | ||
| 504 | - if( TouchPoint::Down == point.state ) | 508 | + if( PointState::DOWN == pointState ) |
| 505 | { | 509 | { |
| 506 | mPressedActor = actor; | 510 | mPressedActor = actor; |
| 507 | consumed = true; | 511 | consumed = true; |
| @@ -509,7 +513,7 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event ) | @@ -509,7 +513,7 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event ) | ||
| 509 | 513 | ||
| 510 | // A button press is only valid if the Down & Up events | 514 | // A button press is only valid if the Down & Up events |
| 511 | // both occurred within the button. | 515 | // both occurred within the button. |
| 512 | - if( ( TouchPoint::Up == point.state ) && | 516 | + if( ( PointState::UP == pointState ) && |
| 513 | ( mPressedActor == actor ) ) | 517 | ( mPressedActor == actor ) ) |
| 514 | { | 518 | { |
| 515 | // ignore Example button presses when scrolling or button animating. | 519 | // ignore Example button presses when scrolling or button animating. |
| @@ -581,10 +585,9 @@ void DaliTableView::OnScrollComplete( const Dali::Vector2& position ) | @@ -581,10 +585,9 @@ void DaliTableView::OnScrollComplete( const Dali::Vector2& position ) | ||
| 581 | accessibilityManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) ); | 585 | accessibilityManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) ); |
| 582 | } | 586 | } |
| 583 | 587 | ||
| 584 | -bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event ) | 588 | +bool DaliTableView::OnScrollTouched( Actor actor, const TouchData& event ) |
| 585 | { | 589 | { |
| 586 | - const TouchPoint& point = event.GetPoint( 0 ); | ||
| 587 | - if( TouchPoint::Down == point.state ) | 590 | + if( PointState::DOWN == event.GetState( 0 ) ) |
| 588 | { | 591 | { |
| 589 | mPressedActor = actor; | 592 | mPressedActor = actor; |
| 590 | } | 593 | } |
| @@ -901,9 +904,7 @@ void DaliTableView::OnFocusedActorActivated( Dali::Actor activatedActor ) | @@ -901,9 +904,7 @@ void DaliTableView::OnFocusedActorActivated( Dali::Actor activatedActor ) | ||
| 901 | mPressedActor = activatedActor; | 904 | mPressedActor = activatedActor; |
| 902 | 905 | ||
| 903 | // Activate the current focused actor; | 906 | // Activate the current focused actor; |
| 904 | - TouchEvent touchEventUp; | ||
| 905 | - touchEventUp.points.push_back( TouchPoint ( 0, TouchPoint::Up, 0.0f, 0.0f ) ); | ||
| 906 | - OnTilePressed(mPressedActor, touchEventUp); | 907 | + DoTilePress( mPressedActor, PointState::UP ); |
| 907 | } | 908 | } |
| 908 | } | 909 | } |
| 909 | 910 |
demo/dali-table-view.h
| @@ -163,7 +163,17 @@ private: // Application callbacks & implementation | @@ -163,7 +163,17 @@ private: // Application callbacks & implementation | ||
| 163 | * | 163 | * |
| 164 | * @return Consume flag | 164 | * @return Consume flag |
| 165 | */ | 165 | */ |
| 166 | - bool OnTilePressed( Dali::Actor actor, const Dali::TouchEvent& event ); | 166 | + bool OnTilePressed( Dali::Actor actor, const Dali::TouchData& event ); |
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * Called by OnTilePressed & Accessibility to do the appropriate action. | ||
| 170 | + * | ||
| 171 | + * @param[in] actor The Actor representing this tile. | ||
| 172 | + * @param[in] state The Touch state | ||
| 173 | + * | ||
| 174 | + * @return Consume flag | ||
| 175 | + */ | ||
| 176 | + bool DoTilePress( Dali::Actor actor, Dali::PointState::Type state ); | ||
| 167 | 177 | ||
| 168 | /** | 178 | /** |
| 169 | * Signal emitted when any tile has been hovered | 179 | * Signal emitted when any tile has been hovered |
| @@ -214,7 +224,7 @@ private: // Application callbacks & implementation | @@ -214,7 +224,7 @@ private: // Application callbacks & implementation | ||
| 214 | * | 224 | * |
| 215 | * @return Consume flag | 225 | * @return Consume flag |
| 216 | */ | 226 | */ |
| 217 | - bool OnScrollTouched( Dali::Actor actor, const Dali::TouchEvent& event ); | 227 | + bool OnScrollTouched( Dali::Actor actor, const Dali::TouchData& event ); |
| 218 | 228 | ||
| 219 | /** | 229 | /** |
| 220 | * Setup the effect on the scroll view | 230 | * Setup the effect on the scroll view |
examples/benchmark/benchmark.cpp
| @@ -285,7 +285,7 @@ public: | @@ -285,7 +285,7 @@ public: | ||
| 285 | mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f ); | 285 | mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f ); |
| 286 | 286 | ||
| 287 | // Respond to a click anywhere on the stage | 287 | // Respond to a click anywhere on the stage |
| 288 | - stage.GetRootLayer().TouchedSignal().Connect( this, &Benchmark::OnTouch ); | 288 | + stage.GetRootLayer().TouchSignal().Connect( this, &Benchmark::OnTouch ); |
| 289 | 289 | ||
| 290 | if( gUseMesh ) | 290 | if( gUseMesh ) |
| 291 | { | 291 | { |
| @@ -303,7 +303,7 @@ public: | @@ -303,7 +303,7 @@ public: | ||
| 303 | ShowAnimation(); | 303 | ShowAnimation(); |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | - bool OnTouch( Actor actor, const TouchEvent& touch ) | 306 | + bool OnTouch( Actor actor, const TouchData& touch ) |
| 307 | { | 307 | { |
| 308 | // quit the application | 308 | // quit the application |
| 309 | mApplication.Quit(); | 309 | mApplication.Quit(); |
examples/blocks/blocks-example.cpp
| @@ -289,8 +289,8 @@ private: | @@ -289,8 +289,8 @@ private: | ||
| 289 | 289 | ||
| 290 | mPaddle.SetPosition( stageSize * Vector3( PADDLE_START_POSITION ) ); | 290 | mPaddle.SetPosition( stageSize * Vector3( PADDLE_START_POSITION ) ); |
| 291 | mContentLayer.Add(mPaddle); | 291 | mContentLayer.Add(mPaddle); |
| 292 | - mPaddle.TouchedSignal().Connect(this, &ExampleController::OnTouchPaddle); | ||
| 293 | - mContentLayer.TouchedSignal().Connect(this, &ExampleController::OnTouchLayer); | 292 | + mPaddle.TouchSignal().Connect(this, &ExampleController::OnTouchPaddle); |
| 293 | + mContentLayer.TouchSignal().Connect(this, &ExampleController::OnTouchLayer); | ||
| 294 | 294 | ||
| 295 | const float margin(BALL_SIZE.width * stageSize.width * 0.5f); | 295 | const float margin(BALL_SIZE.width * stageSize.width * 0.5f); |
| 296 | 296 | ||
| @@ -579,15 +579,15 @@ private: | @@ -579,15 +579,15 @@ private: | ||
| 579 | * @param[in] actor The actor touched | 579 | * @param[in] actor The actor touched |
| 580 | * @param[in] event The touch event | 580 | * @param[in] event The touch event |
| 581 | */ | 581 | */ |
| 582 | - bool OnTouchPaddle(Actor actor, const TouchEvent& event) | 582 | + bool OnTouchPaddle(Actor actor, const TouchData& event) |
| 583 | { | 583 | { |
| 584 | if(event.GetPointCount()>0) | 584 | if(event.GetPointCount()>0) |
| 585 | { | 585 | { |
| 586 | - const TouchPoint& point = event.GetPoint(0); | ||
| 587 | - if(point.state==TouchPoint::Down) // Commence dragging | 586 | + if( event.GetState( 0 ) == PointState::DOWN ) // Commence dragging |
| 588 | { | 587 | { |
| 589 | // Get point where user touched paddle (relative to paddle's center) | 588 | // Get point where user touched paddle (relative to paddle's center) |
| 590 | - mRelativeDragPoint = Vector3(point.screen.x, point.screen.y, 0.0f); | 589 | + Vector2 screenPoint = event.GetScreenPosition( 0 ); |
| 590 | + mRelativeDragPoint = screenPoint; | ||
| 591 | mRelativeDragPoint -= actor.GetCurrentPosition(); | 591 | mRelativeDragPoint -= actor.GetCurrentPosition(); |
| 592 | 592 | ||
| 593 | mDragActor = actor; | 593 | mDragActor = actor; |
| @@ -605,17 +605,16 @@ private: | @@ -605,17 +605,16 @@ private: | ||
| 605 | * @param[in] actor The actor touched | 605 | * @param[in] actor The actor touched |
| 606 | * @param[in] event The touch event | 606 | * @param[in] event The touch event |
| 607 | */ | 607 | */ |
| 608 | - bool OnTouchLayer(Actor actor, const TouchEvent& event) | 608 | + bool OnTouchLayer(Actor actor, const TouchData& event) |
| 609 | { | 609 | { |
| 610 | if(event.GetPointCount()>0) | 610 | if(event.GetPointCount()>0) |
| 611 | { | 611 | { |
| 612 | - const TouchPoint& point = event.GetPoint(0); | ||
| 613 | if(mDragActor) | 612 | if(mDragActor) |
| 614 | { | 613 | { |
| 615 | - Vector3 position(point.screen.x, point.screen.y, 0.0f); | 614 | + Vector3 position( event.GetScreenPosition( 0 ) ); |
| 616 | mPaddle.SetPosition( position - mRelativeDragPoint ); | 615 | mPaddle.SetPosition( position - mRelativeDragPoint ); |
| 617 | 616 | ||
| 618 | - if(point.state==TouchPoint::Up) // Stop dragging | 617 | + if( event.GetState( 0 ) == PointState::UP ) // Stop dragging |
| 619 | { | 618 | { |
| 620 | mDragAnimation = Animation::New(0.25f); | 619 | mDragAnimation = Animation::New(0.25f); |
| 621 | mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.0f, 1.0f, 1.0f), AlphaFunction::EASE_IN); | 620 | mDragAnimation.AnimateTo( Property(mDragActor, Actor::Property::SCALE), Vector3(1.0f, 1.0f, 1.0f), AlphaFunction::EASE_IN); |
examples/bubble-effect/bubble-effect-example.cpp
| @@ -150,7 +150,7 @@ private: | @@ -150,7 +150,7 @@ private: | ||
| 150 | mTimerForBubbleEmission.TickSignal().Connect(this, &BubbleEffectExample::OnTimerTick); | 150 | mTimerForBubbleEmission.TickSignal().Connect(this, &BubbleEffectExample::OnTimerTick); |
| 151 | 151 | ||
| 152 | // Connect the callback to the touch signal on the background | 152 | // Connect the callback to the touch signal on the background |
| 153 | - mBackground.TouchedSignal().Connect( this, &BubbleEffectExample::OnTouch ); | 153 | + mBackground.TouchSignal().Connect( this, &BubbleEffectExample::OnTouch ); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | 156 | ||
| @@ -205,24 +205,22 @@ private: | @@ -205,24 +205,22 @@ private: | ||
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | // Callback function of the touch signal on the background | 207 | // Callback function of the touch signal on the background |
| 208 | - bool OnTouch(Dali::Actor actor, const Dali::TouchEvent& event) | 208 | + bool OnTouch(Dali::Actor actor, const Dali::TouchData& event) |
| 209 | { | 209 | { |
| 210 | - const TouchPoint &point = event.GetPoint(0); | ||
| 211 | - switch(point.state) | 210 | + switch( event.GetState( 0 ) ) |
| 212 | { | 211 | { |
| 213 | - case TouchPoint::Down: | 212 | + case PointState::DOWN: |
| 214 | { | 213 | { |
| 215 | - mCurrentTouchPosition = point.screen; | ||
| 216 | - mEmitPosition = point.screen; | 214 | + mCurrentTouchPosition = mEmitPosition = event.GetScreenPosition( 0 ); |
| 217 | mTimerForBubbleEmission.Start(); | 215 | mTimerForBubbleEmission.Start(); |
| 218 | mNonMovementCount = 0; | 216 | mNonMovementCount = 0; |
| 219 | 217 | ||
| 220 | break; | 218 | break; |
| 221 | } | 219 | } |
| 222 | - case TouchPoint::Motion: | 220 | + case PointState::MOTION: |
| 223 | { | 221 | { |
| 224 | - Vector2 displacement = point.screen - mCurrentTouchPosition; | ||
| 225 | - mCurrentTouchPosition = point.screen; | 222 | + Vector2 displacement = event.GetScreenPosition( 0 ) - mCurrentTouchPosition; |
| 223 | + mCurrentTouchPosition = event.GetScreenPosition( 0 ); | ||
| 226 | //emit multiple bubbles along the moving direction when the finger moves quickly | 224 | //emit multiple bubbles along the moving direction when the finger moves quickly |
| 227 | float step = std::min(5.f, displacement.Length()); | 225 | float step = std::min(5.f, displacement.Length()); |
| 228 | for( float i=0.25f; i<step; i=i+1.f) | 226 | for( float i=0.25f; i<step; i=i+1.f) |
| @@ -231,9 +229,9 @@ private: | @@ -231,9 +229,9 @@ private: | ||
| 231 | } | 229 | } |
| 232 | break; | 230 | break; |
| 233 | } | 231 | } |
| 234 | - case TouchPoint::Up: | ||
| 235 | - case TouchPoint::Leave: | ||
| 236 | - case TouchPoint::Interrupted: | 232 | + case PointState::UP: |
| 233 | + case PointState::LEAVE: | ||
| 234 | + case PointState::INTERRUPTED: | ||
| 237 | { | 235 | { |
| 238 | mTimerForBubbleEmission.Stop(); | 236 | mTimerForBubbleEmission.Stop(); |
| 239 | mEmitAnimation.Play(); | 237 | mEmitAnimation.Play(); |
| @@ -241,8 +239,7 @@ private: | @@ -241,8 +239,7 @@ private: | ||
| 241 | mAnimateComponentCount = 0; | 239 | mAnimateComponentCount = 0; |
| 242 | break; | 240 | break; |
| 243 | } | 241 | } |
| 244 | - case TouchPoint::Stationary: | ||
| 245 | - case TouchPoint::Last: | 242 | + case PointState::STATIONARY: |
| 246 | default: | 243 | default: |
| 247 | { | 244 | { |
| 248 | break; | 245 | break; |
examples/buttons/buttons-example.cpp
| @@ -108,7 +108,6 @@ class ButtonsController: public ConnectionTracker | @@ -108,7 +108,6 @@ class ButtonsController: public ConnectionTracker | ||
| 108 | contentTable.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 108 | contentTable.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 109 | contentTable.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 109 | contentTable.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 110 | contentTable.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) ); | 110 | contentTable.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) ); |
| 111 | -// contentTable.TouchedSignal().Connect( this, &ButtonsController::OnTouchEvent ); | ||
| 112 | 111 | ||
| 113 | for( unsigned int i = 0; i < contentTable.GetRows(); ++i ) | 112 | for( unsigned int i = 0; i < contentTable.GetRows(); ++i ) |
| 114 | { | 113 | { |
| @@ -480,35 +479,7 @@ class ButtonsController: public ConnectionTracker | @@ -480,35 +479,7 @@ class ButtonsController: public ConnectionTracker | ||
| 480 | return true; | 479 | return true; |
| 481 | } | 480 | } |
| 482 | 481 | ||
| 483 | - bool OnTouchEvent( Actor actor, const TouchEvent& event ) | ||
| 484 | - { | ||
| 485 | - if( 1u == event.GetPointCount() ) | ||
| 486 | - { | ||
| 487 | - const TouchPoint::State state = event.GetPoint(0u).state; | ||
| 488 | - | ||
| 489 | - // Clamp to integer values; this is to reduce flicking due to pixel misalignment | ||
| 490 | - const float localPoint = static_cast<float>( static_cast<int>( event.GetPoint( 0 ).local.y ) ); | ||
| 491 | - | ||
| 492 | - if( TouchPoint::Down == state ) | ||
| 493 | - { | ||
| 494 | - mLastPoint = localPoint; | ||
| 495 | - mAnimation = Animation::New( 0.25f ); | ||
| 496 | - } | ||
| 497 | - else if( TouchPoint::Motion == state ) | ||
| 498 | - { | ||
| 499 | - if( mAnimation ) | ||
| 500 | - { | ||
| 501 | - mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunction::LINEAR ); | ||
| 502 | - mAnimation.Play(); | ||
| 503 | - mLastPoint = localPoint; | ||
| 504 | - } | ||
| 505 | - } | ||
| 506 | - } | ||
| 507 | - | ||
| 508 | - return true; | ||
| 509 | - } | ||
| 510 | - | ||
| 511 | - private: | 482 | +private: |
| 512 | 483 | ||
| 513 | Application& mApplication; | 484 | Application& mApplication; |
| 514 | Toolkit::Control mView; ///< The View instance. | 485 | Toolkit::Control mView; ///< The View instance. |
examples/compressed-texture-formats/compressed-texture-formats-example.cpp
| @@ -108,10 +108,10 @@ public: | @@ -108,10 +108,10 @@ public: | ||
| 108 | stage.Add( table ); | 108 | stage.Add( table ); |
| 109 | 109 | ||
| 110 | // Respond to a click anywhere on the stage | 110 | // Respond to a click anywhere on the stage |
| 111 | - stage.GetRootLayer().TouchedSignal().Connect( this, &CompressedTextureFormatsController::OnTouch ); | 111 | + stage.GetRootLayer().TouchSignal().Connect( this, &CompressedTextureFormatsController::OnTouch ); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | - bool OnTouch( Actor actor, const TouchEvent& touch ) | 114 | + bool OnTouch( Actor actor, const TouchData& touch ) |
| 115 | { | 115 | { |
| 116 | // quit the application | 116 | // quit the application |
| 117 | mApplication.Quit(); | 117 | mApplication.Quit(); |
examples/hello-world/hello-world-example.cpp
| @@ -51,10 +51,10 @@ public: | @@ -51,10 +51,10 @@ public: | ||
| 51 | stage.Add( textLabel ); | 51 | stage.Add( textLabel ); |
| 52 | 52 | ||
| 53 | // Respond to a click anywhere on the stage | 53 | // Respond to a click anywhere on the stage |
| 54 | - stage.GetRootLayer().TouchedSignal().Connect( this, &HelloWorldController::OnTouch ); | 54 | + stage.GetRootLayer().TouchSignal().Connect( this, &HelloWorldController::OnTouch ); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | - bool OnTouch( Actor actor, const TouchEvent& touch ) | 57 | + bool OnTouch( Actor actor, const TouchData& touch ) |
| 58 | { | 58 | { |
| 59 | // quit the application | 59 | // quit the application |
| 60 | mApplication.Quit(); | 60 | mApplication.Quit(); |
examples/homescreen-benchmark/homescreen-benchmark.cpp
| @@ -438,10 +438,10 @@ public: | @@ -438,10 +438,10 @@ public: | ||
| 438 | stage.Add(mScrollParent); | 438 | stage.Add(mScrollParent); |
| 439 | 439 | ||
| 440 | // Respond to a click anywhere on the stage | 440 | // Respond to a click anywhere on the stage |
| 441 | - stage.GetRootLayer().TouchedSignal().Connect( this, &HomescreenBenchmark::OnTouch ); | 441 | + stage.GetRootLayer().TouchSignal().Connect( this, &HomescreenBenchmark::OnTouch ); |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | - bool OnTouch( Actor actor, const TouchEvent& touch ) | 444 | + bool OnTouch( Actor actor, const TouchData& touch ) |
| 445 | { | 445 | { |
| 446 | // quit the application | 446 | // quit the application |
| 447 | mApplication.Quit(); | 447 | mApplication.Quit(); |
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
| @@ -295,7 +295,7 @@ public: | @@ -295,7 +295,7 @@ public: | ||
| 295 | imagePrevious.SetOpacity( 0.6f ); | 295 | imagePrevious.SetOpacity( 0.6f ); |
| 296 | controlsLayer.Add( imagePrevious ); | 296 | controlsLayer.Add( imagePrevious ); |
| 297 | imagePrevious.SetName( PREVIOUS_BUTTON_ID ); | 297 | imagePrevious.SetName( PREVIOUS_BUTTON_ID ); |
| 298 | - imagePrevious.TouchedSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); | 298 | + imagePrevious.TouchSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); |
| 299 | 299 | ||
| 300 | // Next image button: | 300 | // Next image button: |
| 301 | Toolkit::ImageView imageNext = Toolkit::ImageView::New( playImage ); | 301 | Toolkit::ImageView imageNext = Toolkit::ImageView::New( playImage ); |
| @@ -305,7 +305,7 @@ public: | @@ -305,7 +305,7 @@ public: | ||
| 305 | imageNext.SetOpacity( 0.6f ); | 305 | imageNext.SetOpacity( 0.6f ); |
| 306 | controlsLayer.Add( imageNext ); | 306 | controlsLayer.Add( imageNext ); |
| 307 | imageNext.SetName( NEXT_BUTTON_ID ); | 307 | imageNext.SetName( NEXT_BUTTON_ID ); |
| 308 | - imageNext.TouchedSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); | 308 | + imageNext.TouchSignal().Connect( this, &ImageScalingAndFilteringController::OnControlTouched ); |
| 309 | 309 | ||
| 310 | // Buttons to popup selectors for fitting and sampling modes: | 310 | // Buttons to popup selectors for fitting and sampling modes: |
| 311 | 311 | ||
| @@ -535,14 +535,13 @@ public: | @@ -535,14 +535,13 @@ public: | ||
| 535 | } | 535 | } |
| 536 | } | 536 | } |
| 537 | 537 | ||
| 538 | - bool OnControlTouched( Actor actor, const TouchEvent& event ) | 538 | + bool OnControlTouched( Actor actor, const TouchData& event ) |
| 539 | { | 539 | { |
| 540 | if(event.GetPointCount() > 0) | 540 | if(event.GetPointCount() > 0) |
| 541 | { | 541 | { |
| 542 | - const TouchPoint& point = event.GetPoint(0); | ||
| 543 | - switch(point.state) | 542 | + switch( event.GetState( 0 ) ) |
| 544 | { | 543 | { |
| 545 | - case TouchPoint::Up: | 544 | + case PointState::UP: |
| 546 | { | 545 | { |
| 547 | const std::string & name = actor.GetName(); | 546 | const std::string & name = actor.GetName(); |
| 548 | if( name == NEXT_BUTTON_ID ) | 547 | if( name == NEXT_BUTTON_ID ) |
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| @@ -461,7 +461,7 @@ public: | @@ -461,7 +461,7 @@ public: | ||
| 461 | ImageView image = CreateImageView( imageSource.configuration.path, imageSize.x, imageSize.y, fittingMode ); | 461 | ImageView image = CreateImageView( imageSource.configuration.path, imageSize.x, imageSize.y, fittingMode ); |
| 462 | image.SetPosition( Vector3( imagePosition.x, imagePosition.y, 0 ) ); | 462 | image.SetPosition( Vector3( imagePosition.x, imagePosition.y, 0 ) ); |
| 463 | image.SetSize( imageSize ); | 463 | image.SetSize( imageSize ); |
| 464 | - image.TouchedSignal().Connect( this, &ImageScalingIrregularGridController::OnTouchImage ); | 464 | + image.TouchSignal().Connect( this, &ImageScalingIrregularGridController::OnTouchImage ); |
| 465 | mFittingModes[image.GetId()] = fittingMode; | 465 | mFittingModes[image.GetId()] = fittingMode; |
| 466 | mResourceUrls[image.GetId()] = imageSource.configuration.path; | 466 | mResourceUrls[image.GetId()] = imageSource.configuration.path; |
| 467 | mSizes[image.GetId()] = imageSize; | 467 | mSizes[image.GetId()] = imageSize; |
| @@ -477,12 +477,11 @@ public: | @@ -477,12 +477,11 @@ public: | ||
| 477 | * @param[in] actor The actor touched | 477 | * @param[in] actor The actor touched |
| 478 | * @param[in] event The TouchEvent. | 478 | * @param[in] event The TouchEvent. |
| 479 | */ | 479 | */ |
| 480 | - bool OnTouchImage( Actor actor, const TouchEvent& event ) | 480 | + bool OnTouchImage( Actor actor, const TouchData& event ) |
| 481 | { | 481 | { |
| 482 | - if( (event.points.size() > 0) && (!mScrolling) ) | 482 | + if( ( event.GetPointCount() > 0 ) && ( !mScrolling ) ) |
| 483 | { | 483 | { |
| 484 | - TouchPoint point = event.points[0]; | ||
| 485 | - if(point.state == TouchPoint::Up) | 484 | + if( event.GetState( 0 ) == PointState::UP ) |
| 486 | { | 485 | { |
| 487 | // Spin the image a few times: | 486 | // Spin the image a few times: |
| 488 | Animation animation = Animation::New(SPIN_DURATION); | 487 | Animation animation = Animation::New(SPIN_DURATION); |
examples/image-view-pixel-area/image-view-pixel-area-example.cpp
| @@ -74,13 +74,12 @@ private: | @@ -74,13 +74,12 @@ private: | ||
| 74 | animation.Play(); | 74 | animation.Play(); |
| 75 | 75 | ||
| 76 | // Respond to a click anywhere on the stage | 76 | // Respond to a click anywhere on the stage |
| 77 | - stage.GetRootLayer().TouchedSignal().Connect( this, &ImageViewPixelAreaApp::OnTouch ); | 77 | + stage.GetRootLayer().TouchSignal().Connect( this, &ImageViewPixelAreaApp::OnTouch ); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | - bool OnTouch( Actor actor, const TouchEvent& touch ) | 80 | + bool OnTouch( Actor actor, const TouchData& touch ) |
| 81 | { | 81 | { |
| 82 | - const TouchPoint &point = touch.GetPoint(0); | ||
| 83 | - if(point.state == TouchPoint::Down) | 82 | + if( touch.GetState( 0 ) == PointState::DOWN ) |
| 84 | { | 83 | { |
| 85 | mIndex++; | 84 | mIndex++; |
| 86 | for( int i=0; i<3;i++ ) | 85 | for( int i=0; i<3;i++ ) |
examples/logging/logging-example.cpp
| @@ -174,7 +174,6 @@ class LoggingController: public ConnectionTracker | @@ -174,7 +174,6 @@ class LoggingController: public ConnectionTracker | ||
| 174 | contentTable.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 174 | contentTable.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 175 | contentTable.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 175 | contentTable.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 176 | contentTable.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) ); | 176 | contentTable.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) ); |
| 177 | -// contentTable.TouchedSignal().Connect( this, &LoggingController::OnTouchEvent ); | ||
| 178 | 177 | ||
| 179 | for( unsigned int i = 0; i < contentTable.GetRows(); ++i ) | 178 | for( unsigned int i = 0; i < contentTable.GetRows(); ++i ) |
| 180 | { | 179 | { |
| @@ -639,35 +638,7 @@ class LoggingController: public ConnectionTracker | @@ -639,35 +638,7 @@ class LoggingController: public ConnectionTracker | ||
| 639 | return true; | 638 | return true; |
| 640 | } | 639 | } |
| 641 | 640 | ||
| 642 | - bool OnTouchEvent( Actor actor, const TouchEvent& event ) | ||
| 643 | - { | ||
| 644 | - if( 1u == event.GetPointCount() ) | ||
| 645 | - { | ||
| 646 | - const TouchPoint::State state = event.GetPoint(0u).state; | ||
| 647 | - | ||
| 648 | - // Clamp to integer values; this is to reduce flicking due to pixel misalignment | ||
| 649 | - const float localPoint = static_cast<float>( static_cast<int>( event.GetPoint( 0 ).local.y ) ); | ||
| 650 | - | ||
| 651 | - if( TouchPoint::Down == state ) | ||
| 652 | - { | ||
| 653 | - mLastPoint = localPoint; | ||
| 654 | - mAnimation = Animation::New( 0.25f ); | ||
| 655 | - } | ||
| 656 | - else if( TouchPoint::Motion == state ) | ||
| 657 | - { | ||
| 658 | - if( mAnimation ) | ||
| 659 | - { | ||
| 660 | - mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunction::LINEAR ); | ||
| 661 | - mAnimation.Play(); | ||
| 662 | - mLastPoint = localPoint; | ||
| 663 | - } | ||
| 664 | - } | ||
| 665 | - } | ||
| 666 | - | ||
| 667 | - return true; | ||
| 668 | - } | ||
| 669 | - | ||
| 670 | - private: | 641 | +private: |
| 671 | 642 | ||
| 672 | struct LoggerState | 643 | struct LoggerState |
| 673 | { | 644 | { |
examples/magnifier/magnifier-example.cpp
| @@ -213,7 +213,7 @@ public: | @@ -213,7 +213,7 @@ public: | ||
| 213 | APPLICATION_TITLE ); | 213 | APPLICATION_TITLE ); |
| 214 | 214 | ||
| 215 | mContent.SetLeaveRequired(true); | 215 | mContent.SetLeaveRequired(true); |
| 216 | - mContent.TouchedSignal().Connect( this, &ExampleController::OnTouched ); | 216 | + mContent.TouchSignal().Connect( this, &ExampleController::OnTouched ); |
| 217 | 217 | ||
| 218 | // Create magnifier (controlled by human touch) | 218 | // Create magnifier (controlled by human touch) |
| 219 | Layer overlay = Layer::New(); | 219 | Layer overlay = Layer::New(); |
| @@ -300,33 +300,32 @@ public: | @@ -300,33 +300,32 @@ public: | ||
| 300 | * @param[in] actor The actor that received the touch | 300 | * @param[in] actor The actor that received the touch |
| 301 | * @param[in] event The touch-event information | 301 | * @param[in] event The touch-event information |
| 302 | */ | 302 | */ |
| 303 | - bool OnTouched( Actor actor, const TouchEvent& event ) | 303 | + bool OnTouched( Actor actor, const TouchData& event ) |
| 304 | { | 304 | { |
| 305 | if(event.GetPointCount() > 0) | 305 | if(event.GetPointCount() > 0) |
| 306 | { | 306 | { |
| 307 | - const TouchPoint& point = event.GetPoint(0); | ||
| 308 | - switch(point.state) | 307 | + switch( event.GetState( 0 ) ) |
| 309 | { | 308 | { |
| 310 | - case TouchPoint::Down: | ||
| 311 | - case TouchPoint::Motion: | 309 | + case PointState::DOWN: |
| 310 | + case PointState::MOTION: | ||
| 312 | { | 311 | { |
| 313 | ShowMagnifier(); | 312 | ShowMagnifier(); |
| 314 | break; | 313 | break; |
| 315 | } | 314 | } |
| 316 | - case TouchPoint::Up: | ||
| 317 | - case TouchPoint::Leave: | ||
| 318 | - case TouchPoint::Interrupted: | 315 | + case PointState::UP: |
| 316 | + case PointState::LEAVE: | ||
| 317 | + case PointState::INTERRUPTED: | ||
| 319 | { | 318 | { |
| 320 | HideMagnifier(); | 319 | HideMagnifier(); |
| 321 | break; | 320 | break; |
| 322 | } | 321 | } |
| 323 | - default: | 322 | + case PointState::STATIONARY: |
| 324 | { | 323 | { |
| 325 | break; | 324 | break; |
| 326 | } | 325 | } |
| 327 | } // end switch | 326 | } // end switch |
| 328 | 327 | ||
| 329 | - Vector3 touchPoint(point.screen); | 328 | + Vector3 touchPoint( event.GetScreenPosition( 0 ) ); |
| 330 | 329 | ||
| 331 | SetMagnifierPosition(touchPoint - mStageSize * 0.5f); | 330 | SetMagnifierPosition(touchPoint - mStageSize * 0.5f); |
| 332 | } | 331 | } |
examples/mesh-sorting/mesh-sorting-example.cpp
| @@ -187,7 +187,7 @@ public: | @@ -187,7 +187,7 @@ public: | ||
| 187 | 187 | ||
| 188 | meshActor.RegisterProperty("uHue", i/(float)NUMBER_OF_SAMPLES); | 188 | meshActor.RegisterProperty("uHue", i/(float)NUMBER_OF_SAMPLES); |
| 189 | 189 | ||
| 190 | - meshActor.TouchedSignal().Connect(this, &ExampleController::OnTouched); | 190 | + meshActor.TouchSignal().Connect(this, &ExampleController::OnTouched); |
| 191 | std::ostringstream oss; | 191 | std::ostringstream oss; |
| 192 | oss << "Mesh Actor " << i; | 192 | oss << "Mesh Actor " << i; |
| 193 | meshActor.SetName(oss.str()); | 193 | meshActor.SetName(oss.str()); |
| @@ -196,7 +196,7 @@ public: | @@ -196,7 +196,7 @@ public: | ||
| 196 | 196 | ||
| 197 | mActors[NUMBER_OF_SAMPLES-2].GetRendererAt(0).SetTextures( firstTextureSet ); | 197 | mActors[NUMBER_OF_SAMPLES-2].GetRendererAt(0).SetTextures( firstTextureSet ); |
| 198 | 198 | ||
| 199 | - stage.GetRootLayer().TouchedSignal().Connect(this, &ExampleController::OnStageTouched); | 199 | + stage.GetRootLayer().TouchSignal().Connect(this, &ExampleController::OnStageTouched); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | void PrintDepths() | 202 | void PrintDepths() |
| @@ -227,9 +227,9 @@ public: | @@ -227,9 +227,9 @@ public: | ||
| 227 | printf("\n"); | 227 | printf("\n"); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | - bool OnTouched( Actor actor, const TouchEvent& event ) | 230 | + bool OnTouched( Actor actor, const TouchData& event ) |
| 231 | { | 231 | { |
| 232 | - if( event.GetPoint(0).state == TouchPoint::Finished ) | 232 | + if( event.GetState( 0 ) == PointState::UP ) |
| 233 | { | 233 | { |
| 234 | int index = actor.GetProperty<int>(actor.GetPropertyIndex("index")); | 234 | int index = actor.GetProperty<int>(actor.GetPropertyIndex("index")); |
| 235 | 235 | ||
| @@ -244,9 +244,9 @@ public: | @@ -244,9 +244,9 @@ public: | ||
| 244 | return true; | 244 | return true; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | - bool OnStageTouched( Actor rootLayer, const TouchEvent& event ) | 247 | + bool OnStageTouched( Actor rootLayer, const TouchData& event ) |
| 248 | { | 248 | { |
| 249 | - if( event.GetPoint(0).state == TouchPoint::Finished ) | 249 | + if( event.GetState( 0 ) == PointState::UP ) |
| 250 | { | 250 | { |
| 251 | switch( mZMode ) | 251 | switch( mZMode ) |
| 252 | { | 252 | { |
examples/metaball-explosion/metaball-explosion-example.cpp
| @@ -192,7 +192,7 @@ public: | @@ -192,7 +192,7 @@ public: | ||
| 192 | /** | 192 | /** |
| 193 | * Touch event function | 193 | * Touch event function |
| 194 | */ | 194 | */ |
| 195 | - bool OnTouch( Actor actor, const TouchEvent& touch ); | 195 | + bool OnTouch( Actor actor, const TouchData& touch ); |
| 196 | 196 | ||
| 197 | /** | 197 | /** |
| 198 | * Key event function | 198 | * Key event function |
| @@ -344,7 +344,7 @@ void MetaballExplosionController::Create( Application& app ) | @@ -344,7 +344,7 @@ void MetaballExplosionController::Create( Application& app ) | ||
| 344 | mTimerDispersion.TickSignal().Connect(this, &MetaballExplosionController::OnTimerDispersionTick); | 344 | mTimerDispersion.TickSignal().Connect(this, &MetaballExplosionController::OnTimerDispersionTick); |
| 345 | 345 | ||
| 346 | // Connect the callback to the touch signal on the mesh actor | 346 | // Connect the callback to the touch signal on the mesh actor |
| 347 | - stage.GetRootLayer().TouchedSignal().Connect( this, &MetaballExplosionController::OnTouch ); | 347 | + stage.GetRootLayer().TouchSignal().Connect( this, &MetaballExplosionController::OnTouch ); |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | Geometry MetaballExplosionController::CreateGeometry() | 350 | Geometry MetaballExplosionController::CreateGeometry() |
| @@ -681,31 +681,32 @@ void MetaballExplosionController::SetPositionToMetaballs(Vector2 & metaballCente | @@ -681,31 +681,32 @@ void MetaballExplosionController::SetPositionToMetaballs(Vector2 & metaballCente | ||
| 681 | mCompositionActor.SetProperty( mPositionIndex, metaballCenter ); | 681 | mCompositionActor.SetProperty( mPositionIndex, metaballCenter ); |
| 682 | } | 682 | } |
| 683 | 683 | ||
| 684 | -bool MetaballExplosionController::OnTouch( Actor actor, const TouchEvent& touch ) | 684 | +bool MetaballExplosionController::OnTouch( Actor actor, const TouchData& touch ) |
| 685 | { | 685 | { |
| 686 | - const TouchPoint &point = touch.GetPoint(0); | ||
| 687 | float aspectR = mScreenSize.y / mScreenSize.x; | 686 | float aspectR = mScreenSize.y / mScreenSize.x; |
| 688 | 687 | ||
| 689 | - switch( point.state ) | 688 | + switch( touch.GetState( 0 ) ) |
| 690 | { | 689 | { |
| 691 | - case TouchPoint::Down: | 690 | + case PointState::DOWN: |
| 692 | { | 691 | { |
| 693 | ResetMetaballs(true); | 692 | ResetMetaballs(true); |
| 694 | 693 | ||
| 695 | - Vector2 metaballCenter = Vector2((point.screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - point.screen.y) / mScreenSize.y) - 0.5) * 2.0; | 694 | + const Vector2 screen = touch.GetScreenPosition( 0 ); |
| 695 | + Vector2 metaballCenter = Vector2((screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - screen.y) / mScreenSize.y) - 0.5) * 2.0; | ||
| 696 | SetPositionToMetaballs(metaballCenter); | 696 | SetPositionToMetaballs(metaballCenter); |
| 697 | 697 | ||
| 698 | break; | 698 | break; |
| 699 | } | 699 | } |
| 700 | - case TouchPoint::Motion: | 700 | + case PointState::MOTION: |
| 701 | { | 701 | { |
| 702 | - Vector2 metaballCenter = Vector2((point.screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - point.screen.y) / mScreenSize.y) - 0.5) * 2.0; | 702 | + const Vector2 screen = touch.GetScreenPosition( 0 ); |
| 703 | + Vector2 metaballCenter = Vector2((screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - screen.y) / mScreenSize.y) - 0.5) * 2.0; | ||
| 703 | SetPositionToMetaballs(metaballCenter); | 704 | SetPositionToMetaballs(metaballCenter); |
| 704 | break; | 705 | break; |
| 705 | } | 706 | } |
| 706 | - case TouchPoint::Up: | ||
| 707 | - case TouchPoint::Leave: | ||
| 708 | - case TouchPoint::Interrupted: | 707 | + case PointState::UP: |
| 708 | + case PointState::LEAVE: | ||
| 709 | + case PointState::INTERRUPTED: | ||
| 709 | { | 710 | { |
| 710 | mTimerDispersion.Start(); | 711 | mTimerDispersion.Start(); |
| 711 | break; | 712 | break; |
examples/metaball-refrac/metaball-refrac-example.cpp
| @@ -164,7 +164,7 @@ public: | @@ -164,7 +164,7 @@ public: | ||
| 164 | ~MetaballRefracController(); | 164 | ~MetaballRefracController(); |
| 165 | 165 | ||
| 166 | void Create( Application& app ); | 166 | void Create( Application& app ); |
| 167 | - bool OnTouch( Actor actor, const TouchEvent& touch ); | 167 | + bool OnTouch( Actor actor, const TouchData& touch ); |
| 168 | void OnKeyEvent(const KeyEvent& event); | 168 | void OnKeyEvent(const KeyEvent& event); |
| 169 | 169 | ||
| 170 | void SetGravity(const Vector2 & gravity); | 170 | void SetGravity(const Vector2 & gravity); |
| @@ -283,7 +283,7 @@ void MetaballRefracController::Create( Application& app ) | @@ -283,7 +283,7 @@ void MetaballRefracController::Create( Application& app ) | ||
| 283 | CreateAnimations(); | 283 | CreateAnimations(); |
| 284 | 284 | ||
| 285 | // Connect the callback to the touch signal on the mesh actor | 285 | // Connect the callback to the touch signal on the mesh actor |
| 286 | - stage.GetRootLayer().TouchedSignal().Connect( this, &MetaballRefracController::OnTouch ); | 286 | + stage.GetRootLayer().TouchSignal().Connect( this, &MetaballRefracController::OnTouch ); |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | /** | 289 | /** |
| @@ -759,13 +759,12 @@ void MetaballRefracController::SetPositionToMetaballs(Vector2 & metaballCenter) | @@ -759,13 +759,12 @@ void MetaballRefracController::SetPositionToMetaballs(Vector2 & metaballCenter) | ||
| 759 | } | 759 | } |
| 760 | } | 760 | } |
| 761 | 761 | ||
| 762 | -bool MetaballRefracController::OnTouch( Actor actor, const TouchEvent& touch ) | 762 | +bool MetaballRefracController::OnTouch( Actor actor, const TouchData& touch ) |
| 763 | { | 763 | { |
| 764 | - const TouchPoint &point = touch.GetPoint(0); | ||
| 765 | float aspectR = mScreenSize.y / mScreenSize.x; | 764 | float aspectR = mScreenSize.y / mScreenSize.x; |
| 766 | - switch(point.state) | 765 | + switch( touch.GetState( 0 ) ) |
| 767 | { | 766 | { |
| 768 | - case TouchPoint::Down: | 767 | + case PointState::DOWN: |
| 769 | { | 768 | { |
| 770 | StopAfterClickAnimations(); | 769 | StopAfterClickAnimations(); |
| 771 | for (int i = 0 ; i < METABALL_NUMBER ; i++) | 770 | for (int i = 0 ; i < METABALL_NUMBER ; i++) |
| @@ -776,17 +775,18 @@ bool MetaballRefracController::OnTouch( Actor actor, const TouchEvent& touch ) | @@ -776,17 +775,18 @@ bool MetaballRefracController::OnTouch( Actor actor, const TouchEvent& touch ) | ||
| 776 | //We draw with the refraction-composition shader | 775 | //We draw with the refraction-composition shader |
| 777 | mRendererRefraction.SetTextures(mTextureSetRefraction); | 776 | mRendererRefraction.SetTextures(mTextureSetRefraction); |
| 778 | mRendererRefraction.SetShader( mShaderRefraction ); | 777 | mRendererRefraction.SetShader( mShaderRefraction ); |
| 779 | - mCurrentTouchPosition = point.screen; | 778 | + mCurrentTouchPosition = touch.GetScreenPosition( 0 ); |
| 780 | 779 | ||
| 781 | //we use the click position for the metaballs | 780 | //we use the click position for the metaballs |
| 782 | - Vector2 metaballCenter = Vector2((point.screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - point.screen.y) / mScreenSize.y) - 0.5) * 2.0; | 781 | + Vector2 metaballCenter = Vector2((mCurrentTouchPosition.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - mCurrentTouchPosition.y) / mScreenSize.y) - 0.5) * 2.0; |
| 783 | SetPositionToMetaballs(metaballCenter); | 782 | SetPositionToMetaballs(metaballCenter); |
| 784 | break; | 783 | break; |
| 785 | } | 784 | } |
| 786 | - case TouchPoint::Motion: | 785 | + case PointState::MOTION: |
| 787 | { | 786 | { |
| 788 | - Vector2 displacement = point.screen - mCurrentTouchPosition; | ||
| 789 | - mCurrentTouchPosition = point.screen; | 787 | + Vector2 screen = touch.GetScreenPosition( 0 ); |
| 788 | + Vector2 displacement = screen - mCurrentTouchPosition; | ||
| 789 | + mCurrentTouchPosition = screen; | ||
| 790 | 790 | ||
| 791 | mMetaballPosVariationTo.x += (displacement.x / mScreenSize.x) * 2.2; | 791 | mMetaballPosVariationTo.x += (displacement.x / mScreenSize.x) * 2.2; |
| 792 | mMetaballPosVariationTo.y += (- displacement.y / mScreenSize.y) * 2.2; | 792 | mMetaballPosVariationTo.y += (- displacement.y / mScreenSize.y) * 2.2; |
| @@ -803,13 +803,13 @@ bool MetaballRefracController::OnTouch( Actor actor, const TouchEvent& touch ) | @@ -803,13 +803,13 @@ bool MetaballRefracController::OnTouch( Actor actor, const TouchEvent& touch ) | ||
| 803 | mPositionVarAnimation[1].Play(); | 803 | mPositionVarAnimation[1].Play(); |
| 804 | 804 | ||
| 805 | //we use the click position for the metaballs | 805 | //we use the click position for the metaballs |
| 806 | - Vector2 metaballCenter = Vector2((point.screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - point.screen.y) / mScreenSize.y) - 0.5) * 2.0; | 806 | + Vector2 metaballCenter = Vector2((screen.x / mScreenSize.x) - 0.5, (aspectR * (mScreenSize.y - screen.y) / mScreenSize.y) - 0.5) * 2.0; |
| 807 | SetPositionToMetaballs(metaballCenter); | 807 | SetPositionToMetaballs(metaballCenter); |
| 808 | break; | 808 | break; |
| 809 | } | 809 | } |
| 810 | - case TouchPoint::Up: | ||
| 811 | - case TouchPoint::Leave: | ||
| 812 | - case TouchPoint::Interrupted: | 810 | + case PointState::UP: |
| 811 | + case PointState::LEAVE: | ||
| 812 | + case PointState::INTERRUPTED: | ||
| 813 | { | 813 | { |
| 814 | //Stop click animations | 814 | //Stop click animations |
| 815 | StopClickAnimations(); | 815 | StopClickAnimations(); |
examples/perf-scroll/perf-scroll.cpp
| @@ -284,7 +284,7 @@ public: | @@ -284,7 +284,7 @@ public: | ||
| 284 | mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f ); | 284 | mSize = Vector3( stageSize.x / mColumnsPerPage, stageSize.y / mRowsPerPage, 0.0f ); |
| 285 | 285 | ||
| 286 | // Respond to a click anywhere on the stage | 286 | // Respond to a click anywhere on the stage |
| 287 | - stage.GetRootLayer().TouchedSignal().Connect( this, &PerfScroll::OnTouch ); | 287 | + stage.GetRootLayer().TouchSignal().Connect( this, &PerfScroll::OnTouch ); |
| 288 | 288 | ||
| 289 | mParent = Actor::New(); | 289 | mParent = Actor::New(); |
| 290 | mParent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 290 | mParent.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| @@ -302,7 +302,7 @@ public: | @@ -302,7 +302,7 @@ public: | ||
| 302 | ShowAnimation(); | 302 | ShowAnimation(); |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | - bool OnTouch( Actor actor, const TouchEvent& touch ) | 305 | + bool OnTouch( Actor actor, const TouchData& touch ) |
| 306 | { | 306 | { |
| 307 | // quit the application | 307 | // quit the application |
| 308 | mApplication.Quit(); | 308 | mApplication.Quit(); |
examples/refraction-effect/refraction-effect-example.cpp
| @@ -294,7 +294,7 @@ private: | @@ -294,7 +294,7 @@ private: | ||
| 294 | mContent.Add( mMeshActor ); | 294 | mContent.Add( mMeshActor ); |
| 295 | 295 | ||
| 296 | // Connect the callback to the touch signal on the mesh actor | 296 | // Connect the callback to the touch signal on the mesh actor |
| 297 | - mContent.TouchedSignal().Connect( this, &RefractionEffectExample::OnTouch ); | 297 | + mContent.TouchSignal().Connect( this, &RefractionEffectExample::OnTouch ); |
| 298 | 298 | ||
| 299 | // shader used when the finger is touching the screen. render refraction effect | 299 | // shader used when the finger is touching the screen. render refraction effect |
| 300 | mShaderRefraction = Shader::New( VERTEX_SHADER_REFRACTION, FRAGMENT_SHADER_REFRACTION ); | 300 | mShaderRefraction = Shader::New( VERTEX_SHADER_REFRACTION, FRAGMENT_SHADER_REFRACTION ); |
| @@ -348,16 +348,15 @@ private: | @@ -348,16 +348,15 @@ private: | ||
| 348 | return true; | 348 | return true; |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | - bool OnTouch( Actor actor , const TouchEvent& event ) | 351 | + bool OnTouch( Actor actor, const TouchData& event ) |
| 352 | { | 352 | { |
| 353 | - const TouchPoint &point = event.GetPoint(0); | ||
| 354 | - switch(point.state) | 353 | + switch( event.GetState( 0 ) ) |
| 355 | { | 354 | { |
| 356 | - case TouchPoint::Down: | 355 | + case PointState::DOWN: |
| 357 | { | 356 | { |
| 358 | mRenderer.SetShader( mShaderRefraction ); | 357 | mRenderer.SetShader( mShaderRefraction ); |
| 359 | 358 | ||
| 360 | - SetLightXYOffset( point.screen ); | 359 | + SetLightXYOffset( event.GetScreenPosition( 0 ) ); |
| 361 | 360 | ||
| 362 | mLightAnimation.Play(); | 361 | mLightAnimation.Play(); |
| 363 | 362 | ||
| @@ -372,15 +371,15 @@ private: | @@ -372,15 +371,15 @@ private: | ||
| 372 | 371 | ||
| 373 | break; | 372 | break; |
| 374 | } | 373 | } |
| 375 | - case TouchPoint::Motion: | 374 | + case PointState::MOTION: |
| 376 | { | 375 | { |
| 377 | // make the light position following the finger movement | 376 | // make the light position following the finger movement |
| 378 | - SetLightXYOffset( point.screen ); | 377 | + SetLightXYOffset( event.GetScreenPosition( 0 ) ); |
| 379 | break; | 378 | break; |
| 380 | } | 379 | } |
| 381 | - case TouchPoint::Up: | ||
| 382 | - case TouchPoint::Leave: | ||
| 383 | - case TouchPoint::Interrupted: | 380 | + case PointState::UP: |
| 381 | + case PointState::LEAVE: | ||
| 382 | + case PointState::INTERRUPTED: | ||
| 384 | { | 383 | { |
| 385 | mLightAnimation.Pause(); | 384 | mLightAnimation.Pause(); |
| 386 | 385 | ||
| @@ -394,9 +393,7 @@ private: | @@ -394,9 +393,7 @@ private: | ||
| 394 | mStrenghAnimation.Play(); | 393 | mStrenghAnimation.Play(); |
| 395 | break; | 394 | break; |
| 396 | } | 395 | } |
| 397 | - case TouchPoint::Stationary: | ||
| 398 | - case TouchPoint::Last: | ||
| 399 | - default: | 396 | + case PointState::STATIONARY: |
| 400 | { | 397 | { |
| 401 | break; | 398 | break; |
| 402 | } | 399 | } |
examples/scroll-view/scroll-view-example.cpp
| @@ -459,7 +459,7 @@ private: | @@ -459,7 +459,7 @@ private: | ||
| 459 | actor.SetParentOrigin(ParentOrigin::CENTER); | 459 | actor.SetParentOrigin(ParentOrigin::CENTER); |
| 460 | actor.SetAnchorPoint(AnchorPoint::CENTER); | 460 | actor.SetAnchorPoint(AnchorPoint::CENTER); |
| 461 | 461 | ||
| 462 | - actor.TouchedSignal().Connect( this, &ExampleController::OnTouchImage ); | 462 | + actor.TouchSignal().Connect( this, &ExampleController::OnTouchImage ); |
| 463 | return actor; | 463 | return actor; |
| 464 | } | 464 | } |
| 465 | 465 | ||
| @@ -489,12 +489,11 @@ private: | @@ -489,12 +489,11 @@ private: | ||
| 489 | * @param[in] actor The actor touched | 489 | * @param[in] actor The actor touched |
| 490 | * @param[in] event The TouchEvent. | 490 | * @param[in] event The TouchEvent. |
| 491 | */ | 491 | */ |
| 492 | - bool OnTouchImage( Actor actor, const TouchEvent& event ) | 492 | + bool OnTouchImage( Actor actor, const TouchData& event ) |
| 493 | { | 493 | { |
| 494 | - if( (event.points.size() > 0) && (!mScrolling) ) | 494 | + if( (event.GetPointCount() > 0) && (!mScrolling) ) |
| 495 | { | 495 | { |
| 496 | - TouchPoint point = event.points[0]; | ||
| 497 | - if(point.state == TouchPoint::Up) | 496 | + if( event.GetState( 0 ) == PointState::UP ) |
| 498 | { | 497 | { |
| 499 | // Spin the Image a few times. | 498 | // Spin the Image a few times. |
| 500 | Animation animation = Animation::New(SPIN_DURATION); | 499 | Animation animation = Animation::New(SPIN_DURATION); |
examples/super-blur-bloom/super-blur-bloom-example.cpp
| @@ -130,17 +130,16 @@ private: | @@ -130,17 +130,16 @@ private: | ||
| 130 | mBloomView.Add( mBloomActor ); | 130 | mBloomView.Add( mBloomActor ); |
| 131 | 131 | ||
| 132 | // Connect the callback to the touch signal on the background | 132 | // Connect the callback to the touch signal on the background |
| 133 | - mSuperBlurView.TouchedSignal().Connect( this, &BlurExample::OnTouch ); | ||
| 134 | - mBloomView.TouchedSignal().Connect( this, &BlurExample::OnTouch ); | 133 | + mSuperBlurView.TouchSignal().Connect( this, &BlurExample::OnTouch ); |
| 134 | + mBloomView.TouchSignal().Connect( this, &BlurExample::OnTouch ); | ||
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | // Callback function of the touch signal on the background | 137 | // Callback function of the touch signal on the background |
| 138 | - bool OnTouch(Dali::Actor actor, const Dali::TouchEvent& event) | 138 | + bool OnTouch(Dali::Actor actor, const Dali::TouchData& event) |
| 139 | { | 139 | { |
| 140 | - const TouchPoint &point = event.GetPoint(0); | ||
| 141 | - switch(point.state) | 140 | + switch( event.GetState( 0 ) ) |
| 142 | { | 141 | { |
| 143 | - case TouchPoint::Down: | 142 | + case PointState::DOWN: |
| 144 | { | 143 | { |
| 145 | if( mAnimation ) | 144 | if( mAnimation ) |
| 146 | { | 145 | { |
| @@ -159,9 +158,9 @@ private: | @@ -159,9 +158,9 @@ private: | ||
| 159 | mAnimation.Play(); | 158 | mAnimation.Play(); |
| 160 | break; | 159 | break; |
| 161 | } | 160 | } |
| 162 | - case TouchPoint::Up: | ||
| 163 | - case TouchPoint::Leave: | ||
| 164 | - case TouchPoint::Interrupted: | 161 | + case PointState::UP: |
| 162 | + case PointState::LEAVE: | ||
| 163 | + case PointState::INTERRUPTED: | ||
| 165 | { | 164 | { |
| 166 | if( mAnimation ) | 165 | if( mAnimation ) |
| 167 | { | 166 | { |
| @@ -180,10 +179,8 @@ private: | @@ -180,10 +179,8 @@ private: | ||
| 180 | mAnimation.Play(); | 179 | mAnimation.Play(); |
| 181 | break; | 180 | break; |
| 182 | } | 181 | } |
| 183 | - case TouchPoint::Motion: | ||
| 184 | - case TouchPoint::Stationary: | ||
| 185 | - case TouchPoint::Last: | ||
| 186 | - default: | 182 | + case PointState::MOTION: |
| 183 | + case PointState::STATIONARY: | ||
| 187 | { | 184 | { |
| 188 | break; | 185 | break; |
| 189 | } | 186 | } |
examples/text-field/text-field-example.cpp
| @@ -136,7 +136,7 @@ public: | @@ -136,7 +136,7 @@ public: | ||
| 136 | popup.SetSize( width, 0.0f ); | 136 | popup.SetSize( width, 0.0f ); |
| 137 | popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); | 137 | popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); |
| 138 | popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT ); | 138 | popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT ); |
| 139 | - popup.TouchedSignal().Connect( this, &TextFieldExample::OnPopupTouched ); | 139 | + popup.TouchSignal().Connect( this, &TextFieldExample::OnPopupTouched ); |
| 140 | 140 | ||
| 141 | return popup; | 141 | return popup; |
| 142 | } | 142 | } |
| @@ -159,15 +159,14 @@ public: | @@ -159,15 +159,14 @@ public: | ||
| 159 | mField.Reset(); | 159 | mField.Reset(); |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | - bool OnPopupTouched( Actor actor, const TouchEvent& event ) | 162 | + bool OnPopupTouched( Actor actor, const TouchData& event ) |
| 163 | { | 163 | { |
| 164 | // End edit mode for TextField if parent Popup touched. | 164 | // End edit mode for TextField if parent Popup touched. |
| 165 | if(event.GetPointCount() > 0) | 165 | if(event.GetPointCount() > 0) |
| 166 | { | 166 | { |
| 167 | - const TouchPoint& point = event.GetPoint(0); | ||
| 168 | - switch(point.state) | 167 | + switch( event.GetState( 0 ) ) |
| 169 | { | 168 | { |
| 170 | - case TouchPoint::Down: | 169 | + case PointState::DOWN: |
| 171 | { | 170 | { |
| 172 | // Update the folder text and lose focus for Key events | 171 | // Update the folder text and lose focus for Key events |
| 173 | if( mButton && mField ) | 172 | if( mButton && mField ) |
examples/text-label-emojis/text-label-emojis.cpp
| @@ -63,7 +63,7 @@ public: | @@ -63,7 +63,7 @@ public: | ||
| 63 | mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | 63 | mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 64 | mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 64 | mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 65 | mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 65 | mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 66 | - mTableView.TouchedSignal().Connect( this, &EmojiExample::OnTouchEvent ); | 66 | + mTableView.TouchSignal().Connect( this, &EmojiExample::OnTouch ); |
| 67 | stage.Add( mTableView ); | 67 | stage.Add( mTableView ); |
| 68 | 68 | ||
| 69 | for( unsigned int index = 0u; index < NUMBER_OF_EMOJIS; ++index ) | 69 | for( unsigned int index = 0u; index < NUMBER_OF_EMOJIS; ++index ) |
| @@ -81,21 +81,21 @@ public: | @@ -81,21 +81,21 @@ public: | ||
| 81 | } | 81 | } |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | - bool OnTouchEvent( Actor actor, const TouchEvent& event ) | 84 | + bool OnTouch( Actor actor, const TouchData& event ) |
| 85 | { | 85 | { |
| 86 | if( 1u == event.GetPointCount() ) | 86 | if( 1u == event.GetPointCount() ) |
| 87 | { | 87 | { |
| 88 | - const TouchPoint::State state = event.GetPoint(0u).state; | 88 | + const PointState::Type state = event.GetState( 0 ); |
| 89 | 89 | ||
| 90 | // Clamp to integer values; this is to reduce flicking due to pixel misalignment | 90 | // Clamp to integer values; this is to reduce flicking due to pixel misalignment |
| 91 | - const float localPoint = static_cast<float>( static_cast<int>( event.GetPoint( 0 ).local.y ) ); | 91 | + const float localPoint = static_cast<float>( static_cast<int>( event.GetLocalPosition( 0 ).y ) ); |
| 92 | 92 | ||
| 93 | - if( TouchPoint::Down == state ) | 93 | + if( PointState::DOWN == state ) |
| 94 | { | 94 | { |
| 95 | mLastPoint = localPoint; | 95 | mLastPoint = localPoint; |
| 96 | mAnimation = Animation::New( 0.25f ); | 96 | mAnimation = Animation::New( 0.25f ); |
| 97 | } | 97 | } |
| 98 | - else if( TouchPoint::Motion == state ) | 98 | + else if( PointState::MOTION == state ) |
| 99 | { | 99 | { |
| 100 | if( mAnimation ) | 100 | if( mAnimation ) |
| 101 | { | 101 | { |
examples/text-label-multi-language/text-label-multi-language-example.cpp
| @@ -66,7 +66,7 @@ public: | @@ -66,7 +66,7 @@ public: | ||
| 66 | mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | 66 | mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 67 | mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT ); | 67 | mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 68 | mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | 68 | mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 69 | - mTableView.TouchedSignal().Connect( this, &TextLabelMultiLanguageExample::OnTouchEvent ); | 69 | + mTableView.TouchSignal().Connect( this, &TextLabelMultiLanguageExample::OnTouch ); |
| 70 | stage.Add( mTableView ); | 70 | stage.Add( mTableView ); |
| 71 | 71 | ||
| 72 | for( unsigned int index = 0u; index < NUMBER_OF_LANGUAGES; ++index ) | 72 | for( unsigned int index = 0u; index < NUMBER_OF_LANGUAGES; ++index ) |
| @@ -84,21 +84,21 @@ public: | @@ -84,21 +84,21 @@ public: | ||
| 84 | } | 84 | } |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | - bool OnTouchEvent( Actor actor, const TouchEvent& event ) | 87 | + bool OnTouch( Actor actor, const TouchData& event ) |
| 88 | { | 88 | { |
| 89 | if( 1u == event.GetPointCount() ) | 89 | if( 1u == event.GetPointCount() ) |
| 90 | { | 90 | { |
| 91 | - const TouchPoint::State state = event.GetPoint(0u).state; | 91 | + const PointState::Type state = event.GetState( 0 ); |
| 92 | 92 | ||
| 93 | // Clamp to integer values; this is to reduce flicking due to pixel misalignment | 93 | // Clamp to integer values; this is to reduce flicking due to pixel misalignment |
| 94 | - const float localPoint = static_cast<float>( static_cast<int>( event.GetPoint( 0 ).local.y ) ); | 94 | + const float localPoint = static_cast<float>( static_cast<int>( event.GetLocalPosition( 0 ).y ) ); |
| 95 | 95 | ||
| 96 | - if( TouchPoint::Down == state ) | 96 | + if( PointState::DOWN == state ) |
| 97 | { | 97 | { |
| 98 | mLastPoint = localPoint; | 98 | mLastPoint = localPoint; |
| 99 | mAnimation = Animation::New( 0.25f ); | 99 | mAnimation = Animation::New( 0.25f ); |
| 100 | } | 100 | } |
| 101 | - else if( TouchPoint::Motion == state ) | 101 | + else if( PointState::MOTION == state ) |
| 102 | { | 102 | { |
| 103 | if( mAnimation ) | 103 | if( mAnimation ) |
| 104 | { | 104 | { |
examples/tilt/tilt-example.cpp
| @@ -56,7 +56,7 @@ public: | @@ -56,7 +56,7 @@ public: | ||
| 56 | stage.Add( mTextLabel ); | 56 | stage.Add( mTextLabel ); |
| 57 | 57 | ||
| 58 | // Respond to a click anywhere on the stage | 58 | // Respond to a click anywhere on the stage |
| 59 | - stage.GetRootLayer().TouchedSignal().Connect( this, &TiltController::OnTouch ); | 59 | + stage.GetRootLayer().TouchSignal().Connect( this, &TiltController::OnTouch ); |
| 60 | 60 | ||
| 61 | CreateSensor(); | 61 | CreateSensor(); |
| 62 | } | 62 | } |
| @@ -71,7 +71,7 @@ public: | @@ -71,7 +71,7 @@ public: | ||
| 71 | } | 71 | } |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | - bool OnTouch( Actor actor, const TouchEvent& touch ) | 74 | + bool OnTouch( Actor actor, const TouchData& touch ) |
| 75 | { | 75 | { |
| 76 | // quit the application | 76 | // quit the application |
| 77 | mApplication.Quit(); | 77 | mApplication.Quit(); |