Пример #1
0
        // TODO: rewrite to event
        public virtual void Rotate(RotateDirection rd = RotateDirection.Right)
        { //TODO: Improve rotation. Working not enough good
            int height = Map.GetLength(1);
            int width  = Map.GetLength(0);
            var newmap = new Color?[height, width];

            if (rd == RotateDirection.Right) //TODO: Left rotation
            {
                for (int i = 0; i < width; i++)
                {
                    for (int j = 0; j < height; j++)
                    {
                        newmap[j, i] = Map[i, j];
                    }
                }
                Map = newmap;
            }

            TopBorder.Refresh();
            BottomBorder.Refresh();
            LeftBorder.Refresh();
            RightBorder.Refresh();
        }