Indiefreaks.Xna.Input.TouchMap.Update C# (CSharp) Method

Update() private method

private Update ( List touches, TouchLocation &touch ) : void
touches List
touch TouchLocation
return void
        private void Update(List<TouchLocation> touches, ref TouchLocation? touch)
        {
            foreach (var touchLocation in touches)
            {
                if (touchLocation.Id == Id)
                {
                    touch = touchLocation;
                    break;
                }

                TouchLocation earliestTouchLocation;
                if (!touchLocation.TryGetPreviousLocation(out earliestTouchLocation))
                    earliestTouchLocation = touchLocation;

                if (Id == -1)
                {
                    if (TouchArea.Contains(earliestTouchLocation.Position.ToPoint()))
                    {
                        touch = earliestTouchLocation;
                        break;
                    }
                }
            }

            if (touch.HasValue)
            {
                Id = touch.Value.Id;
            }
            else
            {
                Id = -1;
            }
        }
    }