示例#1
0
        public void AdjustViewPortIfNecessary()
        {
            foreach (IMovable?vehicle in _gameBoard.GetMovables())
            {
                if (vehicle.Follow)
                {
                    (int x, int y) = _pixelMapper.CoordsToViewPortPixels(vehicle.Column, vehicle.Row);

                    double easing  = 10;
                    int    adjustX = Convert.ToInt32(((_pixelMapper.ViewPortWidth / 2) - x) / easing);
                    int    adjustY = Convert.ToInt32(((_pixelMapper.ViewPortHeight / 2) - y) / easing);

                    if (adjustX != 0 || adjustY != 0)
                    {
                        _pixelMapper.AdjustViewPort(adjustX, adjustY);
                    }
                    break;
                }
            }
        }
示例#2
0
 public void ContinueDrag(int x, int y)
 {
     _pixelMapper.AdjustViewPort(x - _lastX, y - _lastY);
     _lastX = x;
     _lastY = y;
 }