Exemplo n.º 1
0
 public void RenderIcons()
 {
     Board.ForEach(
         (point) =>
     {
         if (source[point] is Piece piece)
         {
             cells[point.x, point.y].SetImage(Icons.GetImage(piece.GetType(), piece.GetColour()));
         }
         else
         {
             cells[point.x, point.y].SetImage(null);
         }
     });
 }
Exemplo n.º 2
0
        public Renderer(Grid grid, Mouse mouse)
        {
            grid.RowDefinitions.Clear();
            grid.ColumnDefinitions.Clear();
            grid.Children.Clear();

            for (int i = 0; i < 8; i++)
            {
                grid.RowDefinitions.Add(new RowDefinition());
                grid.ColumnDefinitions.Add(new ColumnDefinition());
            }

            Board.ForEach(
                (point) =>
            {
                cells[point.x, point.y] = new Cell(new Point(point.x, point.y), mouse);
                grid.Children.Add(cells[point.x, point.y]);
            });
            Icons.RegisterListener(RenderIcons);
        }