Exemplo n.º 1
0
        /// <summary>
        /// Manages the listener logic
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime)
        {
            var touchCollection = TouchPanel.GetState();

            foreach (var touchLocation in touchCollection)
            {
                switch (touchLocation.State)
                {
                case TouchLocationState.Pressed:
                    TouchStarted?.Invoke(this, new TouchEventArgs(_screenTransformationMatrixProvider, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Moved:
                    TouchMoved?.Invoke(this, new TouchEventArgs(_screenTransformationMatrixProvider, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Released:
                    TouchEnded?.Invoke(this, new TouchEventArgs(_screenTransformationMatrixProvider, gameTime.TotalGameTime, touchLocation));
                    break;

                case TouchLocationState.Invalid:
                    TouchCancelled?.Invoke(this, new TouchEventArgs(_screenTransformationMatrixProvider, gameTime.TotalGameTime, touchLocation));
                    break;
                }
            }
        }
Exemplo n.º 2
0
 protected void SingleTouchCancelled()
 {
     TouchCancelled?.Invoke(FirstTouch);
 }