Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>drawpoly() draw a polygon</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 drawpoly()              Draw a Polygon

 #include   <graphics.h>

 void far   drawpoly(npoint,ppoints);
 int        npoint;
 int far    *ppoints;

    drawpoly() draws a polygon with 'npoint' points. 'ppoints' points to
    a sequence of pairs of integers. Each pair of integers represents the
    ('x','y') coordinates of 'npoint'.
    There should be twice as many 'ppoints' as 'npoint'.  You must always
    'close' the polygon you are drawing, by repeating the first
    coordinates given. (A triangle, with three points, should have four
    sets of coordinates, the fourth being the same as the first.)  The
    polygon is drawn using the current line style and color.

    Returns:    Nothing.

   -------------------------------- Example ---------------------------------

    The following statements draw two figures.

           #include <graphics.h>

           main()
           {
               int gdriver = DETECT;
               int gmode;
               int fig1[] =
                    {25,100, 50,50, 150,50, 175,100,  25,100};
               int fig2[] =
                    {250,150, 300,100, 400,100, 350,150, 250,150};

               initgraph(&gdriver,&gmode,"");
               drawpoly(sizeof(fig1)/(2*sizeof(int)),fig1);
               drawpoly(5,fig2);
               getch();
               closegraph();
           }


See Also: fillpoly() getlinesettings() getbkcolor() graphresult()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson