Hi, i am trying to draw polygons.The problem is i cannot get the the last side drawn to meet up with the first drawn, why?
#include "DarkGDK.h"
void DarkGDK ( void )
{
int sides=8;
int startx=50;
int starty=300;
int x=50;
int y=250;
float intangle=((180*sides)-360)/sides ;
float exangle=180-intangle;
dbSyncOn ();
while (LoopGDK ( ) )
{
for (int l=0;l<sides;l++)
{
dbText(10,10,"hello");
x = startx + (dbCOS(l*exangle) * 40);
y = starty + (dbSIN(l*exangle) * 40);
dbLine(startx,starty,x,y);
startx=x;
starty=y;
}
startx=50;
starty=300;
x=50;
y=250;
dbSync ( );
}
}