Example #1
0
        public override void Update(GameTime gameTime)
        {
            var touchCollection = TouchPanel.GetState();

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

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

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

                case TouchLocationState.Invalid:
                    TouchCancelled?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;
                }
            }
        }
Example #2
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;
                }
            }
        }
        public override void Update(GameTime gameTime)
        {
            var touchCollection = TouchPanel.GetState();

            if (TouchPanel.IsGestureAvailable)
            {
                var gesture = TouchPanel.ReadGesture();
                if (gesture.GestureType == GestureType.Tap)
                {
                    int x = 0;
                }
                if (gesture.GestureType == GestureType.DoubleTap)
                {
                    int y = 0;
                }
            }

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

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

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

                case TouchLocationState.Invalid:
                    TouchCancelled?.Invoke(this, new TouchEventArgs(ViewportAdapter, gameTime.TotalGameTime, touchLocation));
                    break;
                }
            }
        }
Example #4
0
 protected void SingleTouchCancelled()
 {
     TouchCancelled?.Invoke(FirstTouch);
 }