コード例 #1
0
        public override bool Draw(int h, int w, int[,] pixels)
        {
            BresenhamLine line   = new BresenhamLine(h, w);
            bool          bDrawn = false;

            //draw a square for the rocket = easier to fill
            for (int i = 0; i < size; i++)
            {
                if (center_of_object.GetPoint().Y + i < h && center_of_object.GetPoint().Y + i > 0 && center_of_object.GetPoint().X > 0 && center_of_object.GetPoint().X + size < w)
                {
                    bDrawn = true;
                }

                line.DrawBresenhamLine(pixels, center_of_object.GetPoint().Y + i, center_of_object.GetPoint().X,
                                       center_of_object.GetPoint().Y + i, center_of_object.GetPoint().X + size, color);
            }

            return(bDrawn);
        }
コード例 #2
0
        public void OutlineHull(List <BoundaryMove> hull, AdvColor[,] new_pixels)
        {
            BresenhamLine line = new BresenhamLine(pixels.GetLength(1), pixels.GetLength(0));

            for (int i = 0; i < hull.Count; i++)
            {
                BoundaryMove p1 = hull[i];
                BoundaryMove p2;
                if (i == hull.Count - 1)
                {
                    p2 = hull[0];
                }
                else
                {
                    p2 = hull[i + 1];
                }

                line.DrawBresenhamLine(new_pixels, p1.X, p1.Y, p2.X, p2.Y, Color.White);
            }
        }