private bool CheckRotation() { if (figure.type != FigureType.O && figure.type != FigureType.Dot) { checkedFigure = new Figure(figure.type, figure.Position); checkedFigure.SetOffsetsToFigure(figure); checkedFigure.Rotate(); foreach (Point check in checkedFigure.GetAbsoluteCoordinates()) { if (check.Y < 0 || check.Y >= CellsYMax || check.X < 0 || check.X >= CellsXMax || board[check.Y, check.X] == CellState.Filled) { return(false); } } return(true); } else { return(false); } }
private void DrawNextFigure(Graphics graphics) { Brush figureBrush = Brushes.Blue; foreach (Point position in nextFigure.GetAbsoluteCoordinates()) { graphics.FillRectangle(figureBrush, position.X * CellSize + 1, position.Y * CellSize + 1, CellSize - 1, CellSize - 1); } }
private void DrawFigure(Graphics graphics) { Brush figureBrush = Brushes.Blue; foreach (Point position in figure.GetAbsoluteCoordinates()) { int xcoord = position.X * CellSize; int ycoord = position.Y * CellSize; graphics.FillRectangle(figureBrush, xcoord + 1, ycoord + 1, CellSize - 1, CellSize - 1); } for (int i = 0; i < CellsYMax; i++) { for (int j = 0; j < CellsXMax; j++) { if (board[i, j] == CellState.Filled) { graphics.FillRectangle(figureBrush, j * CellSize + 1, i * CellSize + 1, CellSize - 1, CellSize - 1); } } } }