Exemplo n.º 1
0
 public Game(int cupWidth, int cupHeight) {
     _Cup = new Cup(cupWidth, cupHeight);
 }
Exemplo n.º 2
0
        public DrawEventArgs(Cup cup, Shape shape, Point shapePoint, int level, int score)
            : base(level, score) {
            if (cup == null) {
                throw new ArgumentNullException("cup");
            }

            if (shape == null) {
                throw new ArgumentNullException("shape");
            }

            if (shapePoint == null) {
                throw new ArgumentNullException("shapePoint");
            }

            Cup = cup;
            Shape = shape;
            ShapePoint = shapePoint;
        }
Exemplo n.º 3
0
        private void DrawField(Image image, Cup cup, Shape shape, Point shapePoint) {
            using (Graphics g = Graphics.FromImage(image)) {
                g.Clear(Color.Black);

                for (int i = 0; i < cup.Width; i++) {
                    for (int j = 0; j < cup.Height; j++) {
                        if (cup[i, j] == Cell.Occupied) {
                            DrawCell(g, i, j, cup[i, j], Color.Green);
                        } else {
                            DrawCell(g, i, j, cup[i, j], Color.Gray);
                        }
                    }
                }

                if (shape != null) {
                    for (int i = 0; i < shape.Width; i++) {
                        for (int j = 0; j < shape.Height; j++) {
                            if (shape.Cells[i, j] == Cell.Occupied) {
                                Rectangle rect = new Rectangle((shapePoint.X + i) * RectSize, (shapePoint.Y + j) * RectSize, RectSize, RectSize);
                                g.FillRectangle(Brushes.Black, rect);
                                DrawCell(g, shapePoint.X + i, shapePoint.Y + j, Cell.Occupied, Color.Red);
                            }
                        }
                    }
                }
            }
        }