1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
void D3DGraphics::DrawCircle( int cordX,int cordY, int r, int red, int green, int blue )
{
for( int x = 0 ; x < r ; x++ )
{
int y = sqrt( float( r * r - x * x ) ) + 0.5f;
PutPixel( cordX + x,cordY + y,red,green,blue );
PutPixel( cordX - x,cordY - y,red,green,blue );
PutPixel( cordX - x,cordY + y,red,green,blue );
PutPixel( cordX + x,cordY - y,red,green,blue );
if( y < x )
break;
}
for( int y = 0 ; y < r ; y++ )
{
int x = sqrt( float( r * r - y * y ) ) + 0.5f;
PutPixel( cordX + x,cordY + y,red,green,blue );
PutPixel( cordX - x,cordY - y,red,green,blue );
PutPixel( cordX - x,cordY + y,red,green,blue );
PutPixel( cordX + x,cordY - y,red,green,blue );
if( x < y )
break;
}
}
|